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

add diff --ignore-all-space/--ignore-space-change flags #4586

Merged
merged 6 commits into from
Oct 6, 2024

Conversation

yuja
Copy link
Contributor

@yuja yuja commented Oct 5, 2024

#3781

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

yuja added 3 commits October 5, 2024 11:08
We're likely to use the right (or new) context lines in rendered diffs, but
it's odd that the hunks iterator choose which context hunk to return. We'll
also need both contents to calculate left/right line numbers.

Since the hunk content types are the same, I also split enum DiffHunk into
{ kind, contents } pair.
I'm going to add an options struct for git diff, but GitOptions, UnifiedOptions,
StatOptions, etc. sound odd.
UnifiedDiffOptions could be wrapped by GitDiffOptions, but there are no Git-diff
specific options right now.
@yuja yuja force-pushed the push-oollvxqwrtvt branch from 7c45d2f to 127c743 Compare October 5, 2024 04:04
yuja added 3 commits October 5, 2024 19:28
These flags only apply to line-based diffs. This is easy, and seems still useful
to highlight whitespace changes (that could be ignored by line diffing.)

I've added short options only to "diff"-like commands. It seemed unclear if
they were added to deeply-nested commands such as "op log".

Closes jj-vcs#3781
This should make the next patch a bit easier to read.
Since context lines are styled in the same way as diff lines, it makes sense
to highlight words within context lines.
@yuja yuja force-pushed the push-oollvxqwrtvt branch from 127c743 to 436b0ba Compare October 5, 2024 10:29
cli/src/diff_util.rs Show resolved Hide resolved
@martinvonz
Copy link
Member

Thanks!

@yuja yuja merged commit 68f4860 into jj-vcs:main Oct 6, 2024
18 checks passed
@yuja yuja deleted the push-oollvxqwrtvt branch October 6, 2024 00:45
@martinvonz
Copy link
Member

Regarding --git format and unified diffs, I think we have told people to use jj diff --git for now for creating patches to apply to Git repos etc. Maybe we should try to implement something like git format-patch soon so we can avoid pointing people to jj diff --git. Then we can drop support for --git and maybe rename it --unified or something like that. We can also stop including the annoying a/ and b/ prefixes and such if we don't have to worry about compatiblity.

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