-
-
Notifications
You must be signed in to change notification settings - Fork 335
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
Diff between worktree and index #805
Conversation
773ea1f
to
66c3d03
Compare
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.
Many thanks for getting this massive ball rolling and for researching and implementing this massively important feature! It's much appreciated.
A whopping two ours later I took a look at everything but the tests. When I get to it, probably tomorrow, I will probably write some as well or try to fix the existing failure.
What would be great if we could make sure that the naming/semantics of this 'diff' are similar to gix-diff
which uses different language due to a different way of thinking. Rather, it asks the question: What do I have to do to turn X in to Y? We can tune the question to yield a typical git status
if that's feasible, or leave such a transformation to the application layer if it's not a natural fit.
I think it's also important to differentiate between changes of worktree and index and index and the tree it was created from (maybe that was already the intent and it just read differently in the docs though).
thanks for the review!
I agree I will try to match the terminology. Altough in this case it's "how do I get the worktree from the index" (which the
Right now I only implemented a diff between index and worktree. The code currently ever acceses the ODB in any way. The code here is modeled after the Worktree and index diff is also important and I want to tackle that in the future but I would like to go step by step here. For example for helix we don't need the index to blob diff so if I finish that work first then I can unblock peoples work and then look at the index/commit diff next. Note that AFAIK git doesn't actually implement a tree to index diff. Instead, it implements an index to index diff and simply checks out a new (in memory) index (unless I missed something). |
I think the source of me writing this was the misunderstanding of how
Yes, that makes perfect sense. Thanks for sharing as well, I wasn't aware of it doing index-to-index diff, but can imagine that it simplifies the implementation quite a bit. |
5994742
to
b15a1f7
Compare
@Byron I think this is ready for a second look. There are still some things missing (mostly waiting on the fs cache) but that should not change the implementation a lot. |
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.
Thanks so much!
When trying to get started I noticed that these two files were binary blobs instead of git-lfs
stand-ins.
- gix-worktree/tests/fixtures/generated-archives/
- gix-worktree/tests/fixtures/generated-archives/status_unchanged.tar.xz
Knowing too well that this probably means I will have trouble pushing to this branch while being unable to fix it myself, could you rewrite these commits and renormalize these files with git-lfs
installed?
Thanks a lot.
I am sort of confused about git lfs. I do have it installed and normally all I needed to do was git add and git LFS picked them up so I am not sure exactly why some files didn't get picked up :/ I will try again |
Maybe a commit was done with |
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.
I did an online-only review which probably makes it a bit superficial, but it's a start I hope.
My general advice is to add unit-tests where feasible and a lot of doc strings to keep track of all the subtleties that might be entailed and transfer them to the future maintainers. Right now, you know most and learned that with a lot of study, and this valuable knowledge should definitely be persisted one way or another. Maybe I am just overly anxious though.
In this session unfortunately I had to stop at index/status.rs
, but I will try to give it another go today or definitely tomorrow.
Conflicts ========= * gix-worktree/src/index/checkout.rs * gix-worktree/src/lib.rs * gix/src/config/cache/access.rs
…ed at runtime. Right now git may be compiled without these capabilities, even though on some platforms it might make perfect sense to enable them by default or enable them on a per repository basis. This is now possible thanks to added gitoxide specific functions.
With it one can read entries and read paths at the same time.
I have reviewed everything in detail and want to thank you again for such great work! It's much appreciated and will soon be run a lot :D! Here a the highlights of my adjustments:
What's missing is the reorganization/shuffle of code to |
The reorganization is most probably done 🎉. I refrained from moving everything from
Nearly I am done because I might put Today I might not get to finishing it, but tomorrow for sure. |
And it's finally done! The solution was to properly (some some docs) frame the purpose of the Additionally, I left the 'changes-to-obtain' centric documentation but renamed the function to Overall, for code-sharing, there is All in all, I believe that the current module and crate layout will aid the future development of index to index diffs as well as untracked file detection (and references to these I have removed to nudge you to find better places in the new layout :)). Of course, nothing is perfect and nor is this, and I am happy to assist with any questions or suggestions you might have. Merge imminent! |
Conflicts ========= * gix-index/src/entry/mod.rs * gix-utils/src/lib.rs
An initial prototype for computing diffs between the worktree and the index.
Currently, doesn't compute untracked files (needs a separate function) and doesn't handle git-attributes/filters and symlinks correctly. This work is blocked on improvements to the FS cache #400.
Currently, we only support emitting these change events. Post-processing steps like copy/rename detection are therefore also missing. There is also a lot of potential for performance improvements/parallelization.
We likely also want to integrate the diff here with the infrastructure in
gix-diff
/gix
(for example for copy detection) in some capacity but I am not sure how to best approach that from an architectural perspective.Ok for Byron review the PR on video?
If I think the review will be helpful for the community, then I might record and publish a video.