-
Notifications
You must be signed in to change notification settings - Fork 377
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
Fix diff interactivefilter when decoration option is enabled #367
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -837,38 +837,100 @@ src/align.rs | |
|
||
#[test] | ||
fn test_color_only_output_is_in_one_to_one_correspondence_with_input() { | ||
_do_test_output_is_in_one_to_one_correspondence_with_input(&["--color-only", "true"]); | ||
_do_test_output_is_in_one_to_one_correspondence_with_input(&[ | ||
"--color-only", | ||
"true", | ||
"--hunk-header-style", | ||
"normal", | ||
"--line-numbers", | ||
]); | ||
_do_test_output_is_in_one_to_one_correspondence_with_input(&[ | ||
"--color-only", | ||
"true", | ||
"--file-style", | ||
"blue", | ||
"--commit-style", | ||
"omit", | ||
"--hunk-header-style", | ||
"omit", | ||
"--hunk-header-decoration-style", | ||
"omit", | ||
]); | ||
_do_test_output_is_in_one_to_one_correspondence_with_input(&[ | ||
"--color-only", | ||
"true", | ||
"--file-style", | ||
"blue", | ||
"--commit-style", | ||
"red", | ||
"--hunk-header-style", | ||
"syntax", | ||
"--hunk-header-decoration-style", | ||
"box", | ||
]); | ||
let user_suppliable_configs: &[&[&str]] = &[ | ||
&["--color-only", "--light"], | ||
&["--color-only", "--dark"], | ||
&["--color-only", "--line-numbers"], | ||
&["--color-only", "--side-by-side"], | ||
&["--color-only", "--diff-highlight"], | ||
&["--color-only", "--diff-so-fancy"], | ||
&["--color-only", "--navigate"], | ||
&["--color-only", "--hyperlinks"], | ||
&["--color-only", "--keep-plus-minus-markers"], | ||
&["--color-only", "--raw"], | ||
&["--color-only", "--syntax-theme", "Monokai Extended"], | ||
&["--color-only", "--minus-style", "syntax bold auto"], | ||
&["--color-only", "--zero-style", "red strike"], | ||
&["--color-only", "--plus-style", "red blink"], | ||
&["--color-only", "--minus-emph-style", "red dim"], | ||
&["--color-only", "--minus-non-emph-style", "red hidden"], | ||
&["--color-only", "--plus-emph-style", "red reverse"], | ||
&["--color-only", "--plus-non-emph-style", "red bold ul"], | ||
&["--color-only", "--commit-style", "red bold ul"], | ||
&[ | ||
"--color-only", | ||
"--commit-decoration-style", | ||
"bold yellow box ul", | ||
], | ||
&["--color-only", "--file-style", "red bold ul"], | ||
&[ | ||
"--color-only", | ||
"--file-decoration-style", | ||
"bold yellow box ul", | ||
], | ||
&["--color-only", "--hunk-header-style", "red bold ul"], | ||
&[ | ||
"--color-only", | ||
"--hunk-header-decoration-style", | ||
"bold yellow box ul", | ||
], | ||
&[ | ||
"--color-only", | ||
"--line-numbers", | ||
"--line-numbers-minus-style", | ||
"#444444", | ||
], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently, these It's just my opinion. |
||
&[ | ||
"--color-only", | ||
"--line-numbers", | ||
"--line-numbers-zero-style", | ||
"#444444", | ||
], | ||
&[ | ||
"--color-only", | ||
"--line-numbers", | ||
"--line-numbers-plus-style", | ||
"#444444", | ||
], | ||
&[ | ||
"--color-only", | ||
"--line-numbers", | ||
"--line-numbers-left-format", | ||
"{nm:>4}┊", | ||
], | ||
&[ | ||
"--color-only", | ||
"--line-numbers", | ||
"--line-numbers-right-format", | ||
"{np:>4}│", | ||
], | ||
&[ | ||
"--color-only", | ||
"--line-numbers", | ||
"--line-numbers-left-style", | ||
"blue", | ||
], | ||
&[ | ||
"--color-only", | ||
"--line-numbers", | ||
"--line-numbers-right-style", | ||
"blue", | ||
], | ||
&["--color-only", "--file-modified-label", "hogehoge"], | ||
&["--color-only", "--file-removed-label", "hogehoge"], | ||
&["--color-only", "--file-added-label", "hogehoge"], | ||
&["--color-only", "--file-renamed-label", "hogehoge"], | ||
&["--color-only", "--max-line-length", "1"], | ||
&["--color-only", "--width", "1"], | ||
&["--color-only", "--tabs", "10"], | ||
&["--color-only", "--24-bit-color", "always"], | ||
&["--color-only", "--inspect-raw-lines", "false"], | ||
&["--color-only", "--whitespace-error-style", "22 reverse"], | ||
]; | ||
|
||
for config in user_suppliable_configs { | ||
_do_test_output_is_in_one_to_one_correspondence_with_input(config); | ||
} | ||
} | ||
|
||
fn _do_test_output_is_in_one_to_one_correspondence_with_input(args: &[&str]) { | ||
|
@@ -882,6 +944,9 @@ src/align.rs | |
|
||
// Although git patch options only checks the line counts of input and output, | ||
// we should check if they are identical as well to avoid unexpected decoration. | ||
if args.contains(&"--max-line-length") { | ||
return; | ||
} | ||
for n in 0..input_lines.len() { | ||
let input_line = input_lines[n]; | ||
// If config.line_numbers is enabled, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Ryuta69, thanks for this PR! I have one question: aren't these already set to "none" by the
color-only
feature? (see the way that feature "inherits" from theraw
feature)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dandavison
Thank you for review!
Oh, is that supposed to be? If so, currently it seems not working when a user supply some options in gitconfig.
In order to give priority to the options in features/** even when a user supply option in gitconfig, I think we must switch the conditions below (Of course only switching them would break some tests such as
features::tests::test_main_section_overrides_feature
. I still need extra check.)delta/src/options/get.rs
Lines 54 to 72 in 1ca0615
Currently, both not working as you suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Ryuta69, sorry to be slow -- I was meaning to look into what we're discussing here but didn't find time yet. Definitely looking forward to having this PR in the next release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dandavison
Sure! The first priority is your schedule, and I'll help when you have a time. Again, thank you for this great OSS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this sounds like a potential headache -- let's just keep the hard-coded override to "none" that you have, and we can maybe worry in the future about whether the none-value was supposed to be inherited from the feature automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dandavison
I understand, thank you for review.
If I find a way to solve, I'm going to create PR.