1
0
mirror of https://github.com/git/git.git synced 2025-03-30 19:10:25 +00:00

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>
This commit is contained in:
Junio C Hamano 2007-11-01 14:30:30 -07:00
parent 0f49327c97
commit a64d7784e8

View File

@ -28,20 +28,19 @@ allow_trivial_merge=t
dropsave() { dropsave() {
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \ rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
"$GIT_DIR/MERGE_SAVE" || exit 1 "$GIT_DIR/MERGE_STASH" || exit 1
} }
savestate() { savestate() {
# Stash away any local modifications. # Stash away any local modifications.
git diff-index -z --name-only $head | git stash create >"$GIT_DIR/MERGE_STASH"
cpio -0 -o >"$GIT_DIR/MERGE_SAVE"
} }
restorestate() { restorestate() {
if test -f "$GIT_DIR/MERGE_SAVE" if test -f "$GIT_DIR/MERGE_STASH"
then then
git reset --hard $head >/dev/null 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 git update-index --refresh >/dev/null
fi fi
} }
@ -386,7 +385,7 @@ case "$use_strategies" in
single_strategy=no single_strategy=no
;; ;;
*) *)
rm -f "$GIT_DIR/MERGE_SAVE" rm -f "$GIT_DIR/MERGE_STASH"
single_strategy=yes single_strategy=yes
;; ;;
esac esac