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

Re: [PATCH v2 3/8] cherry-pick: add --skip-empty option

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 5, 2013, 18:13 UTC
Message-ID
<7vsj0w1l4v.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAMP44s1X=M2sV9OiHS_ggVjmu6txBQVSdK+aK6PnQm5-9EpQgw@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 14 quoted lines
> On Tue, Jun 4, 2013 at 1:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>
>>> You didn't answer, what happens when you run --skip-empty and --allow-empty?
>>
>> I'll answer to a slightly different question: What should happen?
>>
>> I think it should error out, because --allow-empty is about
>> "allowing empty commits to be preserved", and --skip-empty is about
>> "skipping empty commits (as it says on the package)".
>
> Exactly, so they are related after all. However, --allow-empty says this:
>
> "By default, cherry-picking an empty commit will fail,"

OK, that is a very good point. Especially because by the time reader reaches this new description, --allow-empty has already mentioned this, we can just be brief and it is sufficient to say "Instead of failing," upfront.

> In fact, it might make sense to change the default in v2.0 to
> --empty-commits=skip. If it makes sense in 'git rebase', why doesn't
> it in 'git cherry-pick'?

I think the primary reason behind the "Why are you picking a no-op? Let me stop to make sure you didn't make a mistake." is because cherry-pick and revert have long been operations for a single commit explicitly given by the user, not bunch of commits in a range.

These two operating modes are conceptually very different, even when we consider scripted use. A script that feeds one commit at a time has a chance to do patch equivalence or user-interactive filtering on its own, and would be helped by the "are you sure you meant to record that no-op?" check if it filtered in a wrong way (e.g. the user specified an empty commit by mistake). One that feeds a range, on the other hand, relies on or at least expects cherry-pick to have such smart, and a smarter cherry-pick could select what to pick from the given range.

In the longer term, especially if we envision to move large part of logic to prepare the sequencer insn list from rebase to cherry-pick, a ranged cherry-pick should learn a way to filter the range with patch equivalence, for example. Once that happens, the behaviour would become inconsistent at the end-user level if we stopped at a commit only because it was not exactly patch equivalent to another one that is already on the branch we are cherry-picking to, but ended up to be a no-op, while we did not stop at another commit because patch equivalence filtered it out beforehand to skip it. Skipping a no-op by default would remove that inconsistency.

So in that sense, one could argue that it may be a bugfix to skip commits that become no-op when replayed, when picking a range of commits (but not a single one). And I do not think you would need to wait until 2.0 for such a change.

Previous: Felipe ContrerasNext: Felipe Contreras
Message 14 of 33 in “cherry-pick: improvements”
  1. 0/8 cherry-pick: improvementsFelipe Contreras, May 29, 2013
  2. 1/8 sequencer: remove useless indentationFelipe Contreras, May 29, 2013
  3. 2/8 sequencer: trivial fixFelipe Contreras, May 29, 2013
  4. 3/8 cherry-pick: add --skip-empty optionFelipe Contreras, May 29, 2013
  5. Junio C HamanoJun 3, 2013
  6. Junio C HamanoJun 3, 2013
  7. Felipe ContrerasJun 3, 2013
  8. Junio C HamanoJun 3, 2013
  9. Felipe ContrerasJun 4, 2013
  10. Junio C HamanoJun 4, 2013
  11. Felipe ContrerasJun 4, 2013
  12. Junio C HamanoJun 4, 2013
  13. Felipe ContrerasJun 5, 2013
  14. Junio C HamanoJun 5, 2013
  15. Felipe ContrerasJun 6, 2013
  16. Antoine PelisseJun 4, 2013
  17. 4/8 cherry-pick: store rewritten commitsFelipe Contreras, May 29, 2013
  18. Junio C HamanoJun 3, 2013
  19. Felipe ContrerasJun 3, 2013
  20. 5/8 sequencer: run post-rewrite hookFelipe Contreras, May 29, 2013
  21. Junio C HamanoJun 3, 2013
  22. Felipe ContrerasJun 3, 2013
  23. Thomas RastJun 4, 2013
  24. 6/8 cherry-pick: add support to copy notesFelipe Contreras, May 29, 2013
  25. 7/8 revert/cherry-pick: add --quiet optionFelipe Contreras, May 29, 2013
  26. Ramkumar RamachandraMay 29, 2013
  27. Felipe ContrerasMay 29, 2013
  28. Ramkumar RamachandraMay 29, 2013
  29. Felipe ContrerasMay 29, 2013
  30. Junio C HamanoJun 3, 2013
  31. 8/8 revert/cherry-pick: add --skip optionFelipe Contreras, May 29, 2013
  32. Ramkumar RamachandraMay 29, 2013
  33. Felipe ContrerasMay 29, 2013

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.