Fastpath the normal case by not checking that index matches HEAD.
The merge strategy would check this itself and typically does it by using git-read-tree -m -u 3-way merge. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 28, 2005 at 16:29 UTC
60fa056052b8233c22098a711ab780679d0c5b7e
1 file changed
+4
-7
git-merge.sh
+4
-7
@@ -24,7 +24,9 @@ dropsave() {
24
}
25
26
savestate() {
27
- git diff -r -z --name-only $head | cpio -0 -o >"$GIR_DIR/MERGE_SAVE"
27
+ # Stash away any local modifications.
28
+ git-diff-index -r -z --name-only $head |
29
+ cpio -0 -o >"$GIR_DIR/MERGE_SAVE"
30
}
31
32
restorestate() {
@@ -149,12 +151,7 @@ esac
151
# we use, it would operate on the index, possibly affecting the
152
# working tree, and when resolved cleanly, have the desired tree
153
# in the index -- this means that the index must be in sync with
152
-# the $head commit.
153
-files=$(git-diff-index --cached --name-only $head) || exit
154
-if [ "$files" ]; then
155
- echo >&2 "Dirty index: cannot merge (dirty: $files)"
156
- exit 1
157
-fi
154
+# the $head commit. The strategies are responsible to ensure this.
155
156
case "$use_strategies" in
157
?*' '?*)