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

Re: Trimming 'deadheads' (TREESAME 2nd parent) from revision walks?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 19, 2021, 23:44 UTC
Message-ID
<87k0jcb01k.fsf@evledraar.gmail.com>
In-Reply-To
<YUeImAqA0SZAdA2R@coredump.intra.peff.net>
On Sun, Sep 19 2021, Jeff King wrote:
Show 22 quoted lines
> On Sat, Sep 18, 2021 at 03:18:47PM +0100, Philip Oakley wrote:
>
>> Is there a method within `git rev-list` to trim side branch merges where
>> the merge's tree is identical to the first parent's commit-tree?
>> [...]
>> From my reading of the `rev-list` manual this is similar to the <paths>
>> TREESAME capability, but without specifying any paths (maybe just `.` ?).
>
> Yes, I'd just do "git log ." for this. I don't think there's another way
> to trigger simplification. In try_to_simplify_commit(), we bail early
> unless revs->prune is set, and that is set only by the presence of
> pathspecs or by --simplify-by-decoration.
>
>> * Is there a proper term for the treesame condition of the commit-tree
>> (as recorded in the commit object)?
>
> In a one-parent commit, I'd just call it an empty commit. For a merge,
> it is really I'd probably call it an "ours" merge, since one obvious way
> to get there is with "git merge -s ours" (of course you can also just
> resolve all conflicts in favor of one parent). I don't know of another
> name (besides treesame, of course, but that generally implies a
> particular scope of interest given by a pathspec).
Isn't it a "theirs" merge, not "ours"? Per the description Philip has:
    In the Git-for Windows repository, the previous releases are
    'deadheaded' by merging with the upstream git, and simply taking the
    upstream's tree unconditionally[...]

I.e. if you're taking your tree unconditionally it's -s ours, but -s theirs for theirs. Except of course for the small matter of us not having a "-s theirs" yet.

I had a WIP patch a while ago for a "-s theirs -X N", for what sounds like a similar use-case: https://lore.kernel.org/git/87sh7sdtc1.fsf@evledraar.gmail.com/

Previous: Jeff KingNext: Philip Oakley
Message 3 of 9 in “Trimming 'deadheads' (TREESAME 2nd parent) from revision walks?”
  1. Philip OakleySep 18, 2021
  2. Jeff KingSep 19, 2021
  3. Ævar Arnfjörð BjarmasonSep 19, 2021
  4. Philip OakleySep 20, 2021
  5. Jeff KingSep 20, 2021
  6. Philip OakleySep 21, 2021
  7. Philip OakleySep 21, 2021
  8. Johannes SchindelinOct 5, 2021
  9. Philip OakleyOct 6, 2021

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.