Skip to content

Commit

Permalink
git-merge: no reason to use cpio anymore
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Nov 1, 2007
1 parent 0f49327 commit a64d778
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions git-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,19 @@ allow_trivial_merge=t

dropsave() {
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
"$GIT_DIR/MERGE_SAVE" || exit 1
"$GIT_DIR/MERGE_STASH" || exit 1
}

savestate() {
# Stash away any local modifications.
git diff-index -z --name-only $head |
cpio -0 -o >"$GIT_DIR/MERGE_SAVE"
git stash create >"$GIT_DIR/MERGE_STASH"
}

restorestate() {
if test -f "$GIT_DIR/MERGE_SAVE"
if test -f "$GIT_DIR/MERGE_STASH"
then
git reset --hard $head >/dev/null
cpio -iuv <"$GIT_DIR/MERGE_SAVE"
git stash apply $(cat "$GIT_DIR/MERGE_STASH")
git update-index --refresh >/dev/null
fi
}
Expand Down Expand Up @@ -386,7 +385,7 @@ case "$use_strategies" in
single_strategy=no
;;
*)
rm -f "$GIT_DIR/MERGE_SAVE"
rm -f "$GIT_DIR/MERGE_STASH"
single_strategy=yes
;;
esac
Expand Down

0 comments on commit a64d778

Please sign in to comment.