git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug?] "git am --abort" loses previous "git add"
@ 2009-02-25 18:23 Junio C Hamano
  2009-02-26  9:52 ` [PATCH] git-am: Keep index in case of abort with dirty index Michael J Gruber
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2009-02-25 18:23 UTC (permalink / raw)
  To: git

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-26 19:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 18:23 [Bug?] "git am --abort" loses previous "git add" Junio C Hamano
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

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).