From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] git-am: Keep index in case of abort with dirty index
Date: Thu, 26 Feb 2009 10:52:53 +0100 [thread overview]
Message-ID: <1235641973-18307-1-git-send-email-git@drmicha.warpmail.net> (raw)
In-Reply-To: <7v8wnu2x67.fsf@gitster.siamese.dyndns.org>
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>
---
Something like this?
git-am.sh | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index 8bcb206..7013fea 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -230,8 +230,10 @@ then
;;
,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
@@ -287,7 +289,11 @@ fi
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
--
1.6.2.rc1.30.gd43c
next prev parent reply other threads:[~2009-02-26 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 18:23 [Bug?] "git am --abort" loses previous "git add" Junio C Hamano
2009-02-26 9:52 ` Michael J Gruber [this message]
2009-02-26 19:23 ` [PATCH] git-am: Keep index in case of abort with dirty index Junio C Hamano
2009-02-26 19:24 ` [PATCH] git-am: make --abort less dangerous Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1235641973-18307-1-git-send-email-git@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).