-
-
Notifications
You must be signed in to change notification settings - Fork 346
Skip uninteresting commits for blame #1743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip uninteresting commits for blame #1743
Conversation
20a90a2
to
efa0057
Compare
I think (and hope :-)) that this PR is now ready for the first round of reviews. There’s still two or three Also, the traversal is now much closer to what
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a massive speedup, fantastic work! And sorry for the late (first) review, I am now totally behind on emails each, catching up only during the weekend.
When looking at the commits I saw that they are a bit all over the place, often touching multiple crates at the same time. This is OK when not using <prefix>: <subject>
notation, but it's not otherwise.
Can we practice this by adjusting the <prefix>: <subject>
commits so that they only touch a single crate? This can be followed by an adapt to changes in <crate>
commit to make fixes that make it compile (yes, unfortunately not every commit would pass CI, but it's for getting proper changelogs).
In that moment, please feel free to squash other commits that might not be so valuable all by themselves.
I am also more than happy to do this as part of my review, just let me know.
Sure, no problem, thanks a lot for the detailed explanation! (I wasn’t aware that this means accepting intermediate commits that don’t pass CI.) I will rearrange the commits, but I will only get to it on Monday or Tuesday, so feel free to take over if you get to it earlier! |
efa0057
to
57b85fe
Compare
I finally got to re-arranging this PR’s commits. It’s now 3 commits, one per crate touched. The commit messages might need to be adapted as I probably don’t know all the conventions yet. I tried to capture as much information as possible in the individual commit message, so you have something to work with. Let me know if that works for you! |
For a way to obtain a commit either by ODB lookup, or by retrieving it from the commit-graph. This is useful for the implementation of custom traversals.
This is breaking because it takes a commitgraph cache as argument , and because it replaces the `traverse` by `suspect`. Switch to date order for traversing the commit history, as opposed to topo order. This is also what `git blame` does. Skip suspects that have no associated unblamed hunks Pass blame to parent in `process_change`. `git`’s algorithm only seems to keep the current suspect for unblamed hunks that were the direct result of splitting an existing unblamed hunk because it matched with a change. All other hunks appear to be blamed on the parent without further checks. Add assertion that lines always match.
57b85fe
to
4428838
Compare
Thanks a lot, this is wonderful! Previously, using
Turning off the commit-graph also prevents Git to use the bloom filter for paths, but it turns out that I didn't even have these included. When calculating them, Git gets even faster.
It's notable that if both aren't using the commitgraph, It feels we already have come a long way, yet there is so much more to be done here. |
This PR is a PoC. It is a first attempt at implementing custom graph traversal for
blame::file
. This allows us to skip commits that we know don’t contain changes to the file being blamed. The PR is rough around the edges and contains a lot ofTODO
s andtodo!()
s.A first round of tests showed a significant reduction in the number of commits traversed for
gix blame STABILITY.md
:Also, profiling
gix blame STABILITY.md
on my machine revealed that the command took about 20 % less time to run.