Re: git-rev-list bug?
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:21
Junio C Hamano [off-list ref] writes:
"Catalin Marinas" [off-list ref] writes:quoted
Sorry if this was previously discussed. I ran git-rev-list on a linear graph and tried to filter the results by a file name: git rev-list since.. path/to/file but it always shows the child commit of "since" even if it didn't touch the file. The same behaviour is for git-log (since it uses git-rev-list) but git-whatchanged seems to be fine. Is this the intended behaviour? The "stg patches" command based on git-rev-list used to work fine a few weeks ago but now it is always reporting the bottom patch in the stack as modifying a given file.I can confirm that this is a recent breakage, but since it is unfortunately my day-job day the more detailed analysis and fix needs to wait. Sorry.
To my surprise, it turns out that this regression was not very
recent. Bisecting points at this commite:
diff-tree 461cf59... (from 6b94f1e...)
Author: Linus Torvalds [off-list ref]
Date: Wed Jan 18 14:47:30 2006 -0800
rev-list: stop when the file disappears
The one thing I've considered doing (I really should) is to add a "stop
when you don't find the file" option to "git-rev-list". This patch does
some of the work towards that: it removes the "parent" thing when the
file disappears, so a "git annotate" could do do something like
git-rev-list --remove-empty --parents HEAD -- "$filename"
and it would get a good graph that stops when the filename disappears
(it's not perfect though: it won't remove all the unintersting commits).
It also simplifies the logic of finding tree differences a bit, at the
cost of making it a tad less efficient.
The old logic was two-phase: it would first simplify _only_ merges tree as
it traversed the tree, and then simplify the linear parts of the remainder
independently. That was pretty optimal from an efficiency standpoint
because it avoids doing any comparisons that we can see are unnecessary,
but it made it much harder to understand than it really needed to be.
The new logic is a lot more straightforward, and compares the trees as it
traverses the graph (ie everything is a single phase). That makes it much
easier to stop graph traversal at any point where a file disappears.
I haven't had time to dig into this deeper yet...