git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Daniel Barkalow <barkalow@iabervon.org>,
	Christian Couder <christian.couder@gmail.com>
Subject: Re: [RFC PATCH] revert: Implement --abort processing
Date: Wed, 1 Jun 2011 14:00:06 -0500	[thread overview]
Message-ID: <20110601190006.GB9730@elie> (raw)
In-Reply-To: <1306944446-11031-1-git-send-email-artagnon@gmail.com>

Ramkumar Ramachandra wrote:

> To abort, perform a "rerere clear" and "reset --hard" to the ref
> specified by the HEAD file introduced earlier in the series.

The above doesn't explain why, so it makes it harder to answer:

>  Should I be
>  re-implementing "reset --hard" like this?

So I'll try to fill in the blanks.  Wouldn't it be better to call
"reset --merge" code?  That is what "git merge --abort" does.

Let's consider an example.

Suppose I have run "git cherry-pick foo" and run into a conflict.  Now
I start to fix things up the way I like, but I suddenly realize that
the cause was cherry-picking the wrong commit; it's better to start
over and do that.  So I try to abort.

I have some changes to files that did not participate in the automatic
cherry-pick:

 1. for unrelated reasons, I bumped the version number in the Makefile
 as a reminder not to forget later, without commiting it or marking
 with "git add";

 2. I (manually) moved a declaration to a different header file to
 reflect differences between the codebase at the time of foo^ and HEAD,
 to get it to compile.  Which works, so I mark it with "git add" for
 incorporation into the corrected cherry-pick commit.

With "git reset --merge", (1) is left alone, while (2) is backed out,
unmerged entries are of course clobbered, and hazy cases in which I
make some changes, "git add", and then make more changes without "git
add" cause the operation to error out.  It would be nicer if git could
read my mind, but at first glance this seems like an okay second-best.

Are there other considerations or situations that would lead to a
different conclusion?  (Not a rhetorical question.)

Hope that helps,
Jonathan

  parent reply	other threads:[~2011-06-01 19:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <This is sli>
2011-06-01 16:07 ` [RFC PATCH] revert: Implement --abort processing Ramkumar Ramachandra
2011-06-01 16:24   ` Sverre Rabbelier
2011-06-01 17:38   ` Junio C Hamano
2011-06-01 19:00   ` Jonathan Nieder [this message]
2011-06-02 13:03     ` Ramkumar Ramachandra
2011-06-02 16:41       ` 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=20110601190006.GB9730@elie \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=christian.couder@gmail.com \
    --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).