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

Re: [PATCH] log: use true parents for diff even when rewriting

From
Thomas Rast <trast@inf.ethz.ch>
Date
Jul 23, 2013, 07:27 UTC
Message-ID
<87k3khpwhh.fsf@linux-k42r.v.cablecom.net>
In-Reply-To
<7v61w2clli.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 19 quoted lines
> Thomas Rast <trast@inf.ethz.ch> writes:
>
>> When using pathspec filtering in combination with diff-based log
>> output, parent simplification happens before the diff is computed.
>> The diff is therefore against the *simplified* parents.
>>
>> This works okay, arguably by accident, in the normal case: the pruned
>> commits did not affect the paths being filtered, so the diff against
>> the prune-result is the same as against the diff against the true
>> parents.
>>
>> However, --full-diff breaks this guarantee, and indeed gives pretty
>> spectacular results when comparing the output of
>>
>>   git log --graph --stat ...
>>   git log --graph --full-diff --stat ...
>>
>> (--graph internally kicks in parent simplification, much like
>> --parents).

Hmm, I stopped writing the message midway through. There should be another two paragraphs here about storing the original parent list on the side for later use when showing the diff.

Show 10 quoted lines
>> Perhaps like this.  It's getting a bit late, so I'm not sure if I'm
>> missing another user of the "true" parent list, but it does fix the
>> issue you reported.
>
> Conceptually I can see how this will change the history
> simplification in the vertical direction (skipping the ancestry
> chain and jumping directly to the closest grandparent that touched
> the specified path), but I am not sure how well this interacts with
> history simplification in the horizontal direciton (culling
> irrelevant side branches from the merge).

But isn't that similarly confusing for the user as Uwe's original problem? Suddenly we'd be showing a merge commit as an ordinary one, simply because the merged history did not affect the filtered pathspecs. Thus we would show everything that has been merged on the *other* files as a big diff. Would that be useful? It would certainly be a big difference in how the commit is shown.

> I also have to wonder if we always want to incur this save-parents
> overhead, or we are better off limiting it to only when --full-diff
> is in effect.

I haven't quite convinced myself that it is 100% safe to use the rewritten parents when --full-diff is not in effect...

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Junio C HamanoNext: Uwe Kleine-König
Message 5 of 9 in “git log anomalities”
  1. Uwe Kleine-KönigJul 22, 2013
  2. Thomas RastJul 22, 2013
  3. log: use true parents for diff even when rewritingThomas Rast, Jul 22, 2013
  4. Junio C HamanoJul 22, 2013
  5. Thomas RastJul 23, 2013
  6. Uwe Kleine-KönigJul 23, 2013
  7. Junio C HamanoJul 23, 2013
  8. log: use true parents for diff even when rewritingThomas Rast, Jul 31, 2013
  9. Jeff KingJul 31, 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.