git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eduardo Habkost <ehabkost@raisama.net>, git@vger.kernel.org
Subject: Re: Bug: 'git am --abort' can silently reset the wrong branch
Date: Fri, 8 May 2009 05:12:18 -0400	[thread overview]
Message-ID: <20090508091218.GC29737@coredump.intra.peff.net> (raw)
In-Reply-To: <7v7i0s0y03.fsf@alter.siamese.dyndns.org>

On Fri, May 08, 2009 at 02:01:16AM -0700, Junio C Hamano wrote:

> > Switching branches and clobbering some other branch
> > with --abort is just _one_ thing you can do to screw yourself. You could
> > also have been doing useful work on the _same_ branch, and that would
> > get clobbered by --abort.  However, I'm not sure if we have a good way
> > of telling the difference between "work which I did to try to get these
> > patches to apply, but which should be thrown away when I abort" and
> > "work which I did because I forgot I had an active git-am".
> 
> I think I've said this already, but honestly speaking, I think --abort
> should not do --reset at all, but just remove the $dotest directory.  Or
> perhaps introduce a --clear option to do so.

I assumed that people actually liked the current "reset" behavior, so I
didn't want to propose getting rid of it.  Personally, I hate it. So I
would be very happy to see it ripped out entirely, and then that neatly
solves the problem (i.e., it now errs on the side of not throwing away
work).

> What I sometimes see to my users happen is to try applying to the oldest
> integration branch the patch (the users think) ought to apply, see it fail
> to apply, switch to a bit newer branch and run "am" again (trusting that
> it will pick up the material from $dotest), repeat the above and then give
> up with "git am --abort".  I do not think anybody can offhand explain to
> which branch and to what state the command takes the user back to in such
> a situation without looking at what the code actually does X-<; even
> though I think it should take the user back to the original branch, I do
> not think that is what the code does.

No, the current code clobbers whatever is in the current HEAD with
ORIG_HEAD. So not only might you set another random branch back to the
originally am'd branch, but if you did a pull in between you can pick up
some random commit.

-Peff

  reply	other threads:[~2009-05-08  9:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06 19:19 Bug: 'git am --abort' can silently reset the wrong branch Eduardo Habkost
2009-05-08  8:28 ` Jeff King
2009-05-08  8:37   ` Sverre Rabbelier
2009-05-08  9:01   ` Junio C Hamano
2009-05-08  9:12     ` Jeff King [this message]
2009-05-25 10:43       ` [RFC PATCH] am: do not do any reset on --abort Jeff King
2009-05-25 11:49         ` Johannes Schindelin
2009-05-25 12:00           ` Jeff King
2009-05-25 12:17             ` Johannes Sixt
2009-05-25 15:54               ` Avery Pennarun
2009-05-25 16:00                 ` Jeff King
2009-05-25 16:02               ` Jeff King
2009-05-25 16:10                 ` Avery Pennarun
2009-05-25 22:23         ` 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=20090508091218.GC29737@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=ehabkost@raisama.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).