Subject: Re: breakage in revision traversal with pathspec

From: Kevin Bracey <[email-masked]>
Date: Wed, 11 Sep 2013 22:39:15 +0300

On 11/09/2013 21:24, Jonathan Nieder wrote:
> Kevin Bracey wrote:
>
>> On reflection I'm not sure what we should for the "simple history"
>> view of v1.8.3.1..v1.8.4. We're not rewriting parents, so we don't
>> get a chance to reconsider the merge as being zero-parent, and we do
>> have this little section of graph to traverse at the bottom:
>>
>>            1.8.3
>>              o----x----x----x----x---x---     (x = included, o = excluded, *=!treesame)
>>                  /
>>                 /*
>>    o--x--x--x--x
> [...]
>> 1) if identical to any on-graph parent, follow that one, and rewrite
>> the merge as a non-merge. We currently do not follow to an identical
>> off-graph parent. This long-standing comment in try_to_simplify_commit
>> applies: "Even if a merge with an uninteresting side branch brought
>> the entire change we are interested in, we do not want to lose the
>> other branches of this merge, so we just keep going."
>>
> [...]
>> I currently feel instinctively more disposed to dropping the older
>> "don't follow off-graph identical parents" rule. Let the default
>> history go straight to v1.8.3 even though it goes off the graph,
>> stopping us traversing the topic branch.
> Thanks for this analysis.  Interesting.
>
> The rule (1) comes from v1.3.0-rc1~13^2~6: ...
>
> I think you're right that dropping the "don't follow off-graph
> treesame parents" rule would be a sensible change.  The usual point of
> the "follow the treesame parent" rule is to avoid drawing undue
> attention to merges of ancient history where some of the parents are
> side-branches with an old version of the files being tracked and did
> not actually change those files.  That rationale applies just as much
> for a merge on top of an UNINTERESTING rev as any other merge.
I agree about the rationale still applying - why not follow off-graph, 
unless you're doing --ancestry-path? (Fortunately ancestry_path already 
disables simplify_history). That makes more sense if you try to ignore 
the misleading comment. In a typical "v1..v3" range, the temporal 
limiting means that it's paths to the mainline that will tend to be 
marked UNINTERESTING, not to the topic branches...

But I can imagine going off graph it may previously have tripped up 
other parts of the code. It could be that this Git 1.3.0 rule ended up 
covering over some of the older merge hiding logic flakiness. Maybe it's 
no longer necessary. I'll do some experiments.

Now, one bit of news - I have just figured out why gitk is behaving 
differently. It transforms ".." before it reaches git.

To see the effect at the command line: "git log v1.8.3..v.1.8.4" hides 
the merge, but "git log ^v1.8.3 v1.8.4" shows it. Whoops. A new example 
of a dotty shorthand not being exactly equivalent.

In the ".." case the v1.8.3 tag gets peeled before being sent to 
add_rev_cmdline , and the "mark bottom commits" logic works. But in the 
"^" case, the v1.8.3 doesn't get peeled. Junio - any thoughts on the 
correct place to fix that? (And gitk actually does ^<tag-sha>, just to 
be odd, so that needs to be handled too). Should these things be peeled 
in revs->cmdline or not? We should be consistent.

Kevin