git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"SZEDER Gábor" <szeder@ira.uka.de>,
	"Christian Couder" <christian.couder@gmail.com>,
	"Christian Couder" <chriscool@tuxfamily.org>,
	git@vger.kernel.org, "Jonathan Nieder" <jrnieder@gmail.com>
Subject: Re: [BUG] multi-commit cherry-pick messes up the order of commits
Date: Thu, 12 Jan 2012 14:47:10 -0500	[thread overview]
Message-ID: <20120112194710.GA28148@sigill.intra.peff.net> (raw)
In-Reply-To: <CALkWK0kk0mVNaetr=triuVYva7inyx2aZvam81qTVA9=Q=UzGw@mail.gmail.com>

On Fri, Jan 13, 2012 at 12:55:58AM +0530, Ramkumar Ramachandra wrote:

> Junio C Hamano wrote:
> > You should be able to look at revs->cmdline and tell if you need to let
> > cherry-pick walk (i.e. "cherry-pick master..next"), or if the user wants
> > individual commits (i.e. "cherry-pick A B C").
> >
> > And you do prepare_revision_walk() only when you need to walk; otherwise
> > you use the contents of revs->pending in order.

I am tempted to suggest that cherry-pick should not feed its arguments
to the revision machinery in the first place, but instead accept a set
of arguments, each argument of which is either a single commit
(interpreted by get_sha1) or a range specifier (which can be fed to
setup-revisions). And then get a linearized set of commits for _each_
argument independently and concatenate them (possibly eliminating
duplicates). That would make all of these work as most people would
expect:

  git cherry-pick A B C
  git cherry-pick A..B
  git cherry-pick A..B B..C

but would be a regression for:

  git cherry-pick B ^A

versus the current code. I suspect that the latter form is not all that
commonly used, though, and certainly I would accept it as a casualty of
making the "A B C" form work. My only hesitation is that it is in fact a
regression.

> Okay, just to make sure I understand this correctly: if more than one
> argument is literally specified, I should not set up the revision
> walker and pick the commits listed in revs->pending, correct?  Then,
> when I encounter the following command,
> 
>   $ git cherry-pick maint ^master
> 
> I should just pick two commits: maint, and ^master.

But ^master is not a commit, it is a negation. So it is nonsensical if
the arguments are considered independent of each other (you _could_
use a heuristic to guess that they are not independent, but I'd rather
not go there). So you'd probably end up just rejecting the arguments.

-Peff

  reply	other threads:[~2012-01-12 19:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11 17:31 [BUG] multi-commit cherry-pick messes up the order of commits SZEDER Gábor
2012-01-12 13:31 ` Christian Couder
2012-01-12 14:44   ` SZEDER Gábor
2012-01-12 16:35     ` Ramkumar Ramachandra
2012-01-12 16:53     ` Jeff King
2012-01-12 17:09       ` Ramkumar Ramachandra
2012-01-12 17:14         ` Ramkumar Ramachandra
2012-01-12 17:15         ` Jeff King
2012-01-12 17:26           ` Ramkumar Ramachandra
2012-01-12 17:50             ` [PATCH] cherry-pick: add failing test for out-of-order pick Ramkumar Ramachandra
2012-01-12 18:32               ` Jonathan Nieder
2012-01-12 19:05                 ` [PATCH v2] " Ramkumar Ramachandra
2012-01-12 19:33                   ` Jonathan Nieder
2012-01-12 18:25         ` [BUG] multi-commit cherry-pick messes up the order of commits Junio C Hamano
2012-01-12 19:25           ` Ramkumar Ramachandra
2012-01-12 19:47             ` Jeff King [this message]
2012-01-12 20:11               ` Jonathan Nieder
2012-01-12 20:17                 ` Jeff King
2012-01-12 20:11             ` Junio C Hamano
2012-01-12 19:21         ` Johannes Sixt
2012-01-12 19:29           ` Ramkumar Ramachandra
2012-01-12 19:34             ` Jonathan Nieder
2012-01-12 17:47       ` Jonathan Nieder
2012-01-12 18: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=20120112194710.GA28148@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=artagnon@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=szeder@ira.uka.de \
    /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).