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

Re: [PATCH v3] range-diff: add --matched-only to skip one-sided commits

From
Ben Knoble <ben.knoble@gmail.com>
Date
Nov 2, 2026, 16:47 UTC
Message-ID
<73E9A266-5224-43CC-ABC4-83FBC6B77F13@gmail.com>
In-Reply-To
<CAHwyqnVtN79Y7SAWb4YFRCqCO6+Jq9-9tZ9Jho4ec8pjVJR00Q@mail.gmail.com>
Show 52 quoted lines
> Le 2 nov. 2026 à 05:11, Harald Nordgren <haraldnordgren@gmail.com> a écrit :
> 
> On Mon, Nov 2, 2026 at 10:21 AM Junio C Hamano <gitster@pobox.com> wrote:
>> 
>> "Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>> 
>>> From: Harald Nordgren <haraldnordgren@gmail.com>
>>> 
>>> Reviewing a range-diff often means scrolling past commits that were
>>> simply added or dropped, when only the ones that correspond between
>>> the two ranges are of interest.
>>> 
>>> --left-only and --right-only already each suppress one of those
>>> one-sided groups, but they are defined as "only show this side" and
>>> so cannot be given together, which is exactly why show_range_diff()
>>> already rejected that combination. Give the "show only the commits
>>> that correspond on both sides" behavior its own name, --matched-only,
>>> instead of asking users to reach for a combination that errors out.
>>> 
>>> Extend the existing '--left-only'/'--right-only' conflict check to
>>> also reject any combination with --matched-only, since all three
>>> narrow the output in ways that cannot be combined.
>>> 
>>> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
>>> ---
>>>    range-diff: add --matched-only to skip one-sided commits
>>> 
>>>    Add git range-diff --matched-only to only show commits that correspond
>>>    between the two ranges, skipping ones that were only added or only
>>>    removed.
>>> 
>>>    Changes in v2:
>>> 
>>>     * Update docs and commit message.
>>>     * Use die_for_incompatible_opt3.
>> 
>> This is more than 6 weeks old and looking at the archive, nobody
>> (including me) was really interested in the topic.  Anybody wants to
>> take a fresh look at the topic?
>> 
>> Unless we see some volunteers to give it a review in a few weeks, I
>> will discard the topic out of my tree, as 'seen' has been crowded
>> with topics that have been collecting dust without getting many
>> reviews.
> 
> That's a bit sad. I wonder if no one is commenting on it because the
> code is too trivial, meaning nothing that stands out to comment on.
> All it does is allow left_only and right_only to run at the same time,
> and the majority of the new code is tests.
> 
> 
> Harald

I just skimmed the v3 message, and I’m missing the motivation. When looking at a range-diff, why would I want to hide the added/deleted commits?

I suppose when rebasing, I might want to not show the dropped fixup commits or something in a range-diff of @{1}…, but I’m having a hard time coming up with another use case.

Doesn’t mean there aren’t any! [But the patch might get more and better reviews if it is well motivated?] Anyway, I’d be curious to learn what motivated Harald, as it might be useful to my own workflows, in which case I might be able to review more.

Previous: Harald NordgrenNext: Harald Nordgren
Message 12 of 23 in “range-diff: add --matched-only to skip one-sided commits”
  1. range-diff: add --matched-only to skip one-sided commitsHarald Nordgren via GitGitGadget, Sep 11, 2026
  2. Junio C HamanoSep 11, 2026
  3. Harald NordgrenSep 11, 2026
  4. Junio C HamanoSep 11, 2026
  5. Harald NordgrenSep 11, 2026
  6. Junio C HamanoSep 11, 2026
  7. range-diff: add --matched-only to skip one-sided commitsHarald Nordgren via GitGitGadget, Sep 11, 2026
  8. Junio C HamanoSep 14, 2026
  9. range-diff: add --matched-only to skip one-sided commitsHarald Nordgren via GitGitGadget, Sep 15, 2026
  10. Junio C HamanoNov 2, 2026
  11. Harald NordgrenNov 2, 2026
  12. Ben KnobleNov 2, 2026
  13. Harald NordgrenNov 2, 2026
  14. Harald NordgrenNov 2, 2026
  15. Matt HunterNov 3, 2026
  16. Junio C HamanoNov 3, 2026
  17. Ben KnobleNov 3, 2026
  18. Matt HunterNov 3, 2026
  19. Junio C HamanoNov 3, 2026
  20. Kristoffer HaugsbakkNov 4, 2026
  21. Ben KnobleNov 4, 2026
  22. Kristoffer HaugsbakkNov 4, 2026
  23. Junio C HamanoNov 2, 2026

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.