fix(pager): render conflicted Git diffs - #1102
Draft
0xferrous wants to merge 1 commit into
Draft
Conversation
|
@0xferrous is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
When Git is paused during a conflicted merge or rebase,
git diffemits a combined diff usingdiff --cc/diff --combinedheaders and@@@hunk syntax. Withcore.pager = "hunk pager", Hunk previously treated this input as an empty review:The pager/difftool configuration was valid; Hunk’s patch sanitizer did not support Git’s combined conflict format.
Fix
Normalize combined Git patches into the existing unified patch format before parsing:
diff --git/@@syntax.--combined-all-pathsby retaining the first parent’s path.This keeps the behavior in the shared patch-sanitization layer used by Hunk’s existing consumers.
Reproduction
Configure Hunk as Git’s pager:
git config --global core.pager "hunk pager"Start a conflicting merge or rebase.
Run:
Before this change, Hunk displayed an empty review. After this change, it displays the conflicted file and its conflict markers.
Validation
bun run typecheckoxfmt --checkgit diff --checkpatchChangeset forhunkdiffVisual evidence was captured from the real Hunk TUI for the blank before state and rendered after state.
before:

after:
