@matheusbsbs / matheus-bagliano / commits / a64d7784e8
Fork 0

git-merge: no reason to use cpio anymore

Now we have "git stash create", we can use it to safely stash away the dirty state in the tree. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Nov 1, 2007 at 14:30 UTC a64d7784e830b3140e7d0f2b45cb3d8fafb84cca
1 file changed +5 -6
git-merge.sh
+5 -6
@@ -28,20 +28,19 @@ allow_trivial_merge=t
28
29 dropsave() {
30 rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
31 - "$GIT_DIR/MERGE_SAVE" || exit 1
31 + "$GIT_DIR/MERGE_STASH" || exit 1
32 }
33
34 savestate() {
35 # Stash away any local modifications.
36 - git diff-index -z --name-only $head |
37 - cpio -0 -o >"$GIT_DIR/MERGE_SAVE"
36 + git stash create >"$GIT_DIR/MERGE_STASH"
37 }
38
39 restorestate() {
41 - if test -f "$GIT_DIR/MERGE_SAVE"
40 + if test -f "$GIT_DIR/MERGE_STASH"
41 then
42 git reset --hard $head >/dev/null
44 - cpio -iuv <"$GIT_DIR/MERGE_SAVE"
43 + git stash apply $(cat "$GIT_DIR/MERGE_STASH")
44 git update-index --refresh >/dev/null
45 fi
46 }
@@ -386,7 +385,7 @@ case "$use_strategies" in
385 single_strategy=no
386 ;;
387 *)
389 - rm -f "$GIT_DIR/MERGE_SAVE"
388 + rm -f "$GIT_DIR/MERGE_STASH"
389 single_strategy=yes
390 ;;
391 esac