git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Andrew Wong <andrew.kw.w@gmail.com>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Andrew Wong <andrew.w-lists@sohovfx.com>,
	Andrew Wong <andrew.w@sohovfx.com>,
	Jay Soffian <jaysoffian@gmail.com>
Subject: Re: [PATCH] rebase -i: remove CHERRY_PICK_HEAD when cherry-pick failed
Date: Tue, 3 Apr 2012 09:45:05 -0500	[thread overview]
Message-ID: <20120403144505.GE15589@burratino> (raw)
In-Reply-To: <CALkWK0nmNWaOKcyGH2N0s3B1AFD-+3vHz1BBc3U=RMEFLNuc7A@mail.gmail.com>

(cc-ing Jay, expert on the CHERRY_PICK_HEAD facility)
Hi all,

Ramkumar Ramachandra wrote:
> Andrew Wong wrote:

>> Instead of having the sequencer catch errors and remove CHERRY_PICK_HEAD
>> for its caller's sake, let its caller do the work. This way, the
>> sequencer doesn't have to check all points of failures where its caller
>> doesn't want CHERRY_PICK_HEAD.
>
> This part makes sense.

Sorry, I think I've missed the point.  Can you explain to me what
problem this is solving, aside from somehow dividing responsibility
for the CHERRY_PICK_HEAD file among different tools?

>From the surrounding thread, it looks like the following sequence of
commands is at stake:

	git checkout -b tmp v1.7.9
	git cherry-pick 6e1c9bb^2^
	git rebase -i --onto 6e1c9bb HEAD^
	git rebase --continue

The pick works fine and is just part of the setup.  The rebase produces

	The previous cherry-pick is now empty, possibly due to conflict resolution.
	If you wish to commit it anyway, use:

	    git commit --allow-empty

	Otherwise, please use 'git reset'

CHERRY_PICK_HEAD points to "run-command: optionally kill children on
exit" to help the user understand how to resolve the conflict.
Normally print_advice() would remove it because the caller has set
GIT_CHERRY_PICK_HELP to indicate that it wants to use some other
mechanism than "git commit" to deal with resolved conflicts.
Unfortunately the GIT_CHERRY_PICK_HELP facility does not give the
caller a way to specify an alternative message for this case, like:

	The previous cherry-pick is now empty, possibly due to conflict resolution.

	When you have resolved this problem run "git rebase --continue".
	If you would prefer to skip this patch, instead run "git rebase --skip".
	To check out the original branch and stop rebasing run "git rebase --abort".

In fact, "git cherry-pick" does not handle this case at all.  It lets
"git commit" notice the lack of change.  "git commit" emits a message
and follows the usual rules for a failed commit, including preserving
CHERRY_PICK_HEAD to help the operator clean up.

Ok.  Now the user (sensibly) ignores the message from cherry-pick and
just runs "git rebase --continue".  The rebase finishes but nobody
feels it's his responsibility to remove the .git/CHERRY_PICK_HEAD file
and it gets left behind.

For symptom relief, your patch makes sense, though I haven't checked
it in detail yet.  The description distracted me --- it would be
better to say "this sequence of commands has this bad consequence;
this patch papers over the problem to make people happier until the
underlying problem can be addressed" instead of pretending the design
was almost sane and we are just fixing the last detail. ;-)

I suspect a more appropriate long-term fix would involve "git
cherry-pick" noticing when a patch has resolved to nothing instead of
leaving it to "git commit" to detect that.

Sensible?
Jonathan

  reply	other threads:[~2012-04-03 14:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 22:56 Rebase regression in v1.7.9? Felipe Contreras
2012-02-01 17:27 ` Andrew Wong
2012-02-01 19:30   ` Felipe Contreras
2012-03-18 21:37 ` [PATCH] rebase -i: remove CHERRY_PICK_HEAD when cherry-pick failed Andrew Wong
2012-03-19 16:51   ` Junio C Hamano
2012-03-19 21:00     ` Andrew Wong
2012-03-24 20:03       ` Andrew Wong
2012-04-02 22:38         ` Andrew Wong
2012-04-02 23:08           ` Junio C Hamano
2012-04-03  5:15             ` Junio C Hamano
2012-04-03  6:32   ` Ramkumar Ramachandra
2012-04-03 14:45     ` Jonathan Nieder [this message]
2012-04-03 21:01       ` Andrew Wong
2012-04-03 21:08         ` Jonathan Nieder
2012-04-03 21:12           ` Jonathan Nieder
2012-04-03 21:22             ` Andrew Wong
2012-04-03 21:26               ` Jonathan Nieder
2012-04-03 23:11                 ` Andrew Wong
2012-04-04 18:11                   ` Jonathan Nieder
2012-04-04 19:23                     ` Andrew Wong
2012-04-04 20:16                       ` Jonathan Nieder
2012-04-04 20:20                         ` Jonathan Nieder

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120403144505.GE15589@burratino \
    --to=jrnieder@gmail.com \
    --cc=andrew.kw.w@gmail.com \
    --cc=andrew.w-lists@sohovfx.com \
    --cc=andrew.w@sohovfx.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jaysoffian@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).