-
-
Notifications
You must be signed in to change notification settings - Fork 690
Use gitoxide in get_diff #2685
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
base: master
Are you sure you want to change the base?
Use gitoxide in get_diff #2685
Conversation
9d457fd to
62744a0
Compare
|
it looks like GitoxideLabs/gitoxide#2102 is merged, so we can move forward on this, right? |
Yes, we can, thanks for the reminder! I’ll have a look once I get to it. |
|
I’ve merged the latest |
This is a draft PR that is still somewhat rough around the edges. It replaces the
libgit2logic inget_diffwithgitoxide. A few things don’t work yet, but the code is already capable of generating correct diffs in some cases. I hope to get this PR into a reviewable/mergable state by the end of next week, but I won’t make any promises. :-)This will hopefully also address #2665.
Update 2026-01-16
I’ve updated to the latest changes in
gix_diff’s API. Some keyboard shortcuts don’t yet work as expected in all scenarios which I will have a look at next.Update 2025-08-08
I’m now down to just 4 tests not passing! Also, as I’d hoped, this PR addesses #2665, completely eliminating any CPU load because binary files are ignored by the diff algorithm.
There’s a few remaining issues/open questions:
gitoxidedoes not provide structured diffs yet which is why this PR, as a workaround, resorts to string matching on a given hunk’s lines. This will hopefully be addressed upstream through AddHunkHeaderandDiffLineTypetoConsumeHunk::consume_hunkGitoxideLabs/gitoxide#2102. Oncegitoxidehas dedicated data structures, I should be able to simplify this PR considerably.gitoxidedoes not provide extended headers such as@@ -315,6 +315,12 @@ impl ConsumeHunk for FileDiff {the same waygit2does (unless I’m missing something). Theimpl ConsumeHunk for FileDiff {is not part of what we get fromgitoxide. As far as I can see, this only affects the UI.gitoxideproduces different diffs thangit2in certain cases which is known as the “slider problem”. I hope to be able to address this upstream as well, but it will take time and it will block this PR if we’re aiming forgit2compatibility (and I think there’s strong reasons to do that).