Skip to content
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: leverage BStr for debug printing #4082

Merged
merged 6 commits into from
Jul 14, 2024
Merged

Conversation

yuja
Copy link
Contributor

@yuja yuja commented Jul 13, 2024

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

Copy link
Contributor

@ilyagr ilyagr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, BStr seems like it should simplify diffing and conflicts, or at least debugging of them. Thank you!

lib/src/diff.rs Outdated Show resolved Hide resolved
@ilyagr
Copy link
Contributor

ilyagr commented Jul 14, 2024

Also, this is not related directly to this PR, but I should share the successor to #3977 soon. It seems to make a lot of sense to use the bstr in conflict processing too, e.g. https://docs.rs/bstr/latest/bstr/struct.LinesWithTerminator.html, but if we both work on that code, there will be merge conflicts.

yuja added 6 commits July 14, 2024 15:31
I'm going to replace some Debug impls with BStr, and we already depend on
"bstr" through "gix".
This helps migrate internal [u8] variables to BStr.

b"" literals in tests are changed to &str to get around potential type
incompatibility between &[u8; N].
For the same reason as the previous patch. I'm going to make DiffHunk leverage
BStr wrapper instead of custom Debug impl.

b"" literals in tests are changed to &str to get around type incompatibility
between &[u8; N].
@yuja yuja force-pushed the push-vzvqvrwupmzz branch from f703601 to 4f28590 Compare July 14, 2024 06:33
@yuja yuja merged commit 6f6381d into jj-vcs:main Jul 14, 2024
17 checks passed
@yuja yuja deleted the push-vzvqvrwupmzz branch July 14, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants