-
Notifications
You must be signed in to change notification settings - Fork 510
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
New crate for calculating hunk dependencies #5197
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
d3e3950
to
dea6a8e
Compare
dea6a8e
to
6f31a5a
Compare
6f31a5a
to
5824e8a
Compare
5824e8a
to
1709709
Compare
@mtsgrd i see that this is still work in progress - one quick suggestions: it would be a good idea to make your internal members/methods/functions |
@krlvi yes, work in progress. Also, thanks, I'll do that. If you have more of that kind of feedback then please keep it coming. :) |
I do not envy you for this task, but also think that it's a great idea to solve this issue for good, pinning it down with as many tests as it takes. Since blame is mentioned, I thought I'd CC @cruessler who is working on a first version of |
Cool i can take a look and leave some notes. What is the entry point of the library as far as usage goes? |
@krlvi the Everything should be considered very experimental, I am at the stage where I managed to get it conceptually working, and tidied up a bit. I would expect there to be errors still, but like @Byron says we can lock it down with sufficient testing. |
1709709
to
179bcb9
Compare
Since this code is still in an early stage, instead of commenting on individual things, i would like to encourage you to consider this from an API design standpoint. For example, instead of objects and builders, think about
Currently it appears that the caller would need to have a mutable Instead a mutable struct you can consider getting the full structure as an arg. If you really want to use a mutable struct, perhaps the I hope this is helpful |
Sounds obvious now that you say it, thanks. |
179bcb9
to
62fd9ac
Compare
62fd9ac
to
4ffa660
Compare
4ffa660
to
b55825a
Compare
b55825a
to
7ca7d77
Compare
7ca7d77
to
7f8369e
Compare
7f8369e
to
e9a48e4
Compare
Adds new crate with code for calculating dependencies between workspace changes and workspace commits. What we ultimately want to understand is: given an uncommitted change, do the old line numbers intersect with anything committed in the workspace?
The problem we have to overcome is that we the workspace changes are produced by diffing the working directory against the workspace commit. It means changes from one stack can offset line numbers in changes from a different stack. The most intuitive way of checking if they touch the same lines is to use regular git blame, but it suffers from two problems, 1) speed and 2) lack of --reverse flag in git2. The latter means we can't detect intersections with deleted lines.
If we don't calculate these dependencies correctly it means a user might be able to move a hunk into a stack where it cannot be committed. So the solution here is that we build up the same information we would get from blame by adding diffs together.
TODO:
Follow-up PR for integration this code: #5252