Fix #2037: show-config displays incomplete hunk-header-style#2114
Open
cobyfrombrooklyn-bot wants to merge 1 commit into
Open
Fix #2037: show-config displays incomplete hunk-header-style#2114cobyfrombrooklyn-bot wants to merge 1 commit into
cobyfrombrooklyn-bot wants to merge 1 commit into
Conversation
Fix dandavison#2037: --show-config now correctly displays special attributes (file, line-number, omit-code-fragment) in the hunk-header-style value. Previously, only the parsed Style was shown (e.g. 'syntax'), dropping the special keywords. With the default 'line-number syntax', show-config would display just 'syntax'. Now it correctly shows 'line-number syntax'. Added two test cases that verify the fix for both the default style and a custom 'file syntax' configuration.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2037
Problem
--show-configdrops special attributes (file,line-number,omit-code-fragment) from thehunk-header-stylevalue. With the defaultline-number syntax, it displays justsyntax.Fix
Reconstructs the full
hunk-header-stylevalue inshow_config()by prepending the special attribute keywords based on the parsed boolean flags before the style string.Tests
Added two test cases in
src/subcommands/show_config.rs:test_show_config_hunk_header_style_includes_special_attributes— verifies default style showsline-number syntaxtest_show_config_hunk_header_style_with_file— verifies customfile syntaxis displayed correctlyBoth tests fail without the fix and pass with it. Full test suite (439 tests) passes.
Tested on macOS ARM (Apple Silicon).