Add diff-so-fancy.fileNameRulerShape - #545
Merged
scottchiefbaker merged 1 commit intoSep 28, 2026
Merged
Conversation
git show draws file names in a box whose width follows the file name, which looks ragged across a commit touching many files. Setting this option to ruler restores the full width ruler. Default is box, so nothing changes unless the option is set. Documented in the README and the man page. Closes so-fancy#522.
VXNCXNX
force-pushed
the
feat/file-name-ruler-shape
branch
from
August 31, 2026 19:57
c47e75b to
a8b0807
Compare
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.
Closes #522.
Adds
diff-so-fancy.fileNameRulerShape, using the option name @mzimnn proposed in the issue:The motivation from the thread is that box width follows the file name, so a commit touching many files renders ragged, while the ruler is always full width.
Implementation
Two lines of behavior. The
git showbranch already set$ruler_shape = 'box'unconditionally; it now takes the configured value, read through the samegit_config()helper asrulerWidth.draw_ruleritself is untouched.Anything that isn't
ruler(case-insensitively) falls back tobox. That matters more than it looks:draw_ruler'sif/elsifhas noelse, so an unrecognized shape would silently print nothing. Checked with an empty string,banana,RULER,boxand unset.Default is unchanged
Not just asserted — I ran the original and patched scripts over all 36 fixtures and diffed the output. stdout is byte-identical across every one. (The only difference anywhere is a line number inside a pre-existing Perl warning on
latin1.diff, shifted by one because the file gained a line.)Only
git showis affected. Ordinarygit diffrulers are untouched, per your note in the thread that changing those would cause riots.Documentation
You asked for implementation and documentation, so both:
README.md, in the same format as the neighbouring options=head1 OPTIONSblock, soman diff-so-fancylists it tooWhile there I noticed a pre-existing copy/paste slip in that POD: the
shortHeadersentry is labelledB<rulerWidth:>. I left it alone to keep this diff focused, but happy to fix it here or separately.Tests
One bats test added;
make testgoes 53 → 54 passing, 0 failures. Verified load-bearing against the unpatched script:(Submodules needed
git submodule update --init --recursivefor bats to run.)