feat: add newlines
option to handle when blank lines are added
#2028
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.
Takes any combination of
file
,hunk-header
, anddiff
to insert a blank line after the filename line, hunk header line, or after each diff hunk respectively.Handles edge cases like omitting both file and hunk-header but requesting newlines after diffs.
Ensures output never starts with a blank line (unless git somehow causes it to).
Commit boundaries are not handled due to the fact that git will insert a blank line between commits by itself unless --oneline is requested.
Closes #1944, #1517
Note: There are ~70 test failures I have not yet looked at. This PR took ~6 hours of non-stop work. If the maintainers could be so kind, please go through the failing tests and let me know if any of them are legitimate regressions or if they're harmless (e.g., tests expecting extraneous newlines that I have removed). Thank you ^^
From what I can tell,
git log -p
,git show -p
,git diff
, andgit add -p
/git restore -p
all work. So I believe there are no major functionality regressions.