Skip to content

Conversation

LunarLambda
Copy link

Takes any combination of file, hunk-header, and diff 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, and git add -p / git restore -p all work. So I believe there are no major functionality regressions.

Takes any combination of `file`, `hunk-header`, and `diff` 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 dandavison#1944, dandavison#1517
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.

🐛 Unable to remove extra blank line preceding file and hunk headers
1 participant