Skip to content

Commit a64d778

Browse files
committed
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 <[email protected]>
1 parent 0f49327 commit a64d778

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

git-merge.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,19 @@ allow_trivial_merge=t
2828

2929
dropsave() {
3030
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
31-
"$GIT_DIR/MERGE_SAVE" || exit 1
31+
"$GIT_DIR/MERGE_STASH" || exit 1
3232
}
3333

3434
savestate() {
3535
# 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"
3837
}
3938

4039
restorestate() {
41-
if test -f "$GIT_DIR/MERGE_SAVE"
40+
if test -f "$GIT_DIR/MERGE_STASH"
4241
then
4342
git reset --hard $head >/dev/null
44-
cpio -iuv <"$GIT_DIR/MERGE_SAVE"
43+
git stash apply $(cat "$GIT_DIR/MERGE_STASH")
4544
git update-index --refresh >/dev/null
4645
fi
4746
}
@@ -386,7 +385,7 @@ case "$use_strategies" in
386385
single_strategy=no
387386
;;
388387
*)
389-
rm -f "$GIT_DIR/MERGE_SAVE"
388+
rm -f "$GIT_DIR/MERGE_STASH"
390389
single_strategy=yes
391390
;;
392391
esac

0 commit comments

Comments
 (0)