git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] multi-commit cherry-pick messes up the order of commits

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 12, 2012, 20:11 UTC
Message-ID
<7vpqeo1y0i.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0kk0mVNaetr=triuVYva7inyx2aZvam81qTVA9=Q=UzGw@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> 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?
Not really.

A rough approximation would be that if you see any negative ones (either coming from A..B or ^A), you would always want to walk, giving everything to prepare_revision_walk()-and-then-get_revision() machiery.

Otherwise you have only zero [*1*] or more positive ones, and you pick them in the order you find in the pending list, without bothering the revision traversal machinery at all [*2*].

Show 5 quoted lines
> when I encounter the following command,
>
>   $ git cherry-pick maint ^master
>
> I should just pick two commits: maint, and ^master.

So the answer is aboslutely no. "maint ^master" is the same as saying "master..maint".

[Footnote]

*1* You would probably want to error out if you got zero positive ones in this case (i.e. absolutely nothing was given, neither positive nor negative).

*2* The reason this is "rough" approximation is because we would probably want to do Jonathan's "maint..master master..next" someday, and when that happens, we would need to do much more than "do we have any negative? then send it through to prepare_revision_walk()". But we are not there yet, so I think the above is actually more or less the complete implementation.

Previous: Jeff KingNext: Johannes Sixt
Message 19 of 24 in “[BUG] multi-commit cherry-pick messes up the order of commits”
  1. SZEDER GáborJan 11, 2012
  2. Christian CouderJan 12, 2012
  3. SZEDER GáborJan 12, 2012
  4. Ramkumar RamachandraJan 12, 2012
  5. Jeff KingJan 12, 2012
  6. Ramkumar RamachandraJan 12, 2012
  7. Ramkumar RamachandraJan 12, 2012
  8. Jeff KingJan 12, 2012
  9. Ramkumar RamachandraJan 12, 2012
  10. cherry-pick: add failing test for out-of-order pickRamkumar Ramachandra, Jan 12, 2012
  11. Jonathan NiederJan 12, 2012
  12. cherry-pick: add failing test for out-of-order pickRamkumar Ramachandra, Jan 12, 2012
  13. Jonathan NiederJan 12, 2012
  14. Junio C HamanoJan 12, 2012
  15. Ramkumar RamachandraJan 12, 2012
  16. Jeff KingJan 12, 2012
  17. Jonathan NiederJan 12, 2012
  18. Jeff KingJan 12, 2012
  19. Junio C HamanoJan 12, 2012
  20. Johannes SixtJan 12, 2012
  21. Ramkumar RamachandraJan 12, 2012
  22. Jonathan NiederJan 12, 2012
  23. Jonathan NiederJan 12, 2012
  24. Junio C HamanoJan 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.