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

Re: [PATCH 1/3] revlist.c: introduce --cherry for unsymmetric picking

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2011, 19:49 UTC
Message-ID
<7vmxlpi2vt.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4D625972.4090500@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 7 quoted lines
>> At the plumbing level (which 'git-cherry' was designed to be),
>> we should be able to ask for either (or both).  Adding a "we are only
>> interested in the right hand side" as a rev-list option is somewhat
>> distasteful and short-sighted.
>
> I don't understand this remark - isn't that exactly what you suggest
> below ("--right-only")? Then what is distasteful and short-sighted?

It does not give people an option to ask for only left side if you give only "--cherry" and nothing else. Don't you find that a bad taste?

Compare that with being explicit and supporting both --right/left-only. The point is to avoid making the internal implementation and plumbing interface needlessly limited to one use case, and instead keeping them flexible.

> Could you explain in what way the current implementation is not done
> "properly"?

Your "cherry" implementation limits its utility unnecessarily by assuming a few things it does not have to assume:

 - It only needs to discard left hand side, but not right hand side.
 - It only needs to work when patch-id equivalence filtering is on.
The former is easy to rectify, I think.

Right now, there is only one thing (cherry-pick) that works on a symmetric difference set and filter, so it may _appear_ that the latter does not matter, but by not tying the two unrelated concepts together and keeping the "right-side-only output" logic and "filter the symmetric difference set" logic orthogonal, you will leave the door open for others to add different filtering mode easier.

> So I think the plan is:
>
> - use a "right-only" flag rather than "cherry"
And perhaps left-only for symmetry.
> - make "--cherry" do "--cherry-pick --right-only" (with or without
> ".."->"...")
Yes.
> - simplify cmd_format_patch

As long as the internal machinery to run the right/left-only filtering of the result of cherry-pick filtering is done (i.e. step 1) and then the syntactic sugar --cherry synonym is implemented in terms of it (step 2), cmd_format_patch simplification would come as a natural consequence, I think.

The simplification does not have to be done as part of this series, though. I only mentioned it as a reason why we would want to get the internal for this topic (step 1) right, not tied too strongly to step 2.

Thanks.
Previous: Michael J Gruber
Message 15 of 15 in “revlist.c: introduce --cherry for unsymmetric picking”
  1. 1/3 revlist.c: introduce --cherry for unsymmetric pickingMichael J Gruber, Feb 18, 2011
  2. 2/3 t6007: Make sure we test --cherry-pickMichael J Gruber, Feb 18, 2011
  3. 3/3 rev-list: documentation and test for --cherryMichael J Gruber, Feb 18, 2011
  4. Junio C HamanoFeb 18, 2011
  5. Jay SoffianFeb 19, 2011
  6. Michael J GruberFeb 21, 2011
  7. 1/2 revlist.c: introduce --left/right-only for unsymmetric pickingMichael J Gruber, Feb 21, 2011
  8. Junio C HamanoFeb 22, 2011
  9. Junio C HamanoFeb 22, 2011
  10. Junio C HamanoFeb 22, 2011
  11. t6007: test rev-list --cherryMichael J Gruber, Feb 22, 2011
  12. 2/2 rev-list: documentation and test for --left/right-onlyMichael J Gruber, Feb 21, 2011
  13. Jay SoffianFeb 21, 2011
  14. Michael J GruberFeb 22, 2011
  15. Junio C HamanoFeb 21, 2011

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.