Skip to content

Conversation

@Byron
Copy link
Collaborator

@Byron Byron commented May 18, 2025

This PR should improve the diff quality as it introduces a Sink that calculates Git diffs with hunks similar to what xdiff does.
At least in theory, as I didn't vet the algorithm, just the implementation.

This makes using the new Sink a bit of a leap of faith, as it uses enough slice-indices to make panics quite possible. There is also not a lot of tests, nor is there a fuzzer setup, so anything could happen.
Ideally, it will just work though, and if it gives trouble it should be easy to revert the commit.

It will probably be used in bat soon: sharkdp/bat#3235 (comment).

And lastly, here is two diffs that show where the new algorithm differs - the slider is at the bottom of the diff, and the upper diff is more desirable thanks to the new algorithm.

Tasks

  • update gix for GitDiff Sink
  • Bonus: Additional updates to auto-updateable dependencies
  • use new Sink when creating unified diffs

@vercel
Copy link

vercel bot commented May 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 18, 2025 9:02pm

@Byron Byron marked this pull request as ready for review May 18, 2025 20:59
@vercel
Copy link

vercel bot commented May 18, 2025

@Byron is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the rust Pull requests that update Rust code label May 18, 2025
@Byron
Copy link
Collaborator Author

Byron commented May 19, 2025

The E2E tests seem to be genuinely failing, even though I have trouble seeing how this is related.
The frontend shows diffs like normal.

@Byron
Copy link
Collaborator Author

Byron commented May 19, 2025

Checked with the team and we decided it's OK to merge it, noting that:

  • there is a risk this panics and if that happens we can undo this change easily in unified_diff.rs
  • it has the potential to fix a current problem where V2 and V3 diffs don't match up

CC @krlvi .

@Byron Byron merged commit 600f957 into gitbutlerapp:master May 19, 2025
18 of 20 checks passed
@Byron Byron deleted the git-style-diffs branch May 19, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant