Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
cruessler wants to merge 15 commits into gitui-org:master
base: master
Choose a base branch
Loading
from cruessler:use-gitoxide-for-get-diff

Conversation

Copy link
Collaborator

@cruessler cruessler commented Jul 31, 2025
edited
Loading

This is a draft PR that is still somewhat rough around the edges. It replaces the libgit2 logic in get_diff with gitoxide. 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 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:

  • gitoxide does 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 Add HunkHeader and DiffLineType to ConsumeHunk::consume_hunk GitoxideLabs/gitoxide#2102 . Once gitoxide has dedicated data structures, I should be able to simplify this PR considerably.
  • gitoxide does not provide extended headers such as @@ -315,6 +315,12 @@ impl ConsumeHunk for FileDiff { the same way git2 does (unless I’m missing something). The impl ConsumeHunk for FileDiff { is not part of what we get from gitoxide. As far as I can see, this only affects the UI.
  • gitoxide produces different diffs than git2 in 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 for git2 compatibility (and I think there’s strong reasons to do that).

extrawurst reacted with hooray emoji
@cruessler cruessler force-pushed the use-gitoxide-for-get-diff branch from 9d457fd to 62744a0 Compare August 8, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /