From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [Bug?] "git am --abort" loses previous "git add"
Date: Wed, 25 Feb 2009 10:23:12 -0800 [thread overview]
Message-ID: <7v8wnu2x67.fsf@gitster.siamese.dyndns.org> (raw)
Consider this sequence:
pwd/master$ git add file
pwd/master$ git am 0001-patch.txt
Dirty index: cannot apply patches (dirty: file)
pwd/master|AM$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: file
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# 0001-patch.txt
pwd/master|AM$ git am --abort
pwd/master$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# 0001-patch.txt
# file
"git am" itself correctly detected that the index is dirty, and refrained
from doing anything (other than creating and leaving .git/rebase-apply).
It carefully kept what you added so far to the index.
But "git am --abort" is broken and loses the added changes from the index.
There probably are two possible fixes (I am not familiar with the --abort
that was bolted on recently, and haven't checked the code).
- Perhaps when "git am" fails with a dirty index (i.e. not even starting
to look at the patches and stopping with unapplicable patches), we
should discard .git/rebase-apply directory so that we do not even have
to tell users to run "git am --abort";
- Perhaps "git am --abort" can be told to tell this case from the usual
"patch in progress" case, and act differently.
My preference obviously would be the latter, as .git/rebase-apply/ could
be the only place that has the patches fed to "git am" from its standard
input.
next reply other threads:[~2009-02-25 18:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 18:23 Junio C Hamano [this message]
2009-02-26 9:52 ` [PATCH] git-am: Keep index in case of abort with dirty index Michael J Gruber
2009-02-26 19:23 ` 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=7v8wnu2x67.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/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).