summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2591838)
raw | patch | inline | side by side (parent: 2591838)
author | Michael J Gruber <git@drmicha.warpmail.net> | |
Thu, 26 Feb 2009 09:52:53 +0000 (10:52 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 27 Feb 2009 07:06:27 +0000 (23:06 -0800) |
git am --abort resets the index unconditionally. But in case a previous
git am exited due to a dirty index it is preferable to keep that index.
Make it so.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git am exited due to a dirty index it is preferable to keep that index.
Make it so.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-am.sh | patch | blob | history |
diff --git a/git-am.sh b/git-am.sh
index 8bcb206022ae5d4ae82d2a37d8f79454c043ad78..351b4f86fa9f0690d1afdfd90aa0ad820590fe78 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
;;
,t)
git rerere clear
- git read-tree --reset -u HEAD ORIG_HEAD
- git reset ORIG_HEAD
+ test -f "$dotest/dirtyindex" || {
+ git read-tree --reset -u HEAD ORIG_HEAD
+ git reset ORIG_HEAD
+ }
rm -fr "$dotest"
exit ;;
esac
+ rm -f "$dotest/dirtyindex"
else
# Make sure we are not given --skip, --resolved, nor --abort
test "$skip$resolved$abort" = "" ||
case "$resolved" in
'')
files=$(git diff-index --cached --name-only HEAD --) || exit
- test "$files" && die "Dirty index: cannot apply patches (dirty: $files)"
+ if test "$files"
+ then
+ : >"$dotest/dirtyindex"
+ die "Dirty index: cannot apply patches (dirty: $files)"
+ fi
esac
if test "$(cat "$dotest/utf8")" = t