Repository navigation
fix(pager): render conflicted Git diffs - #1102
Conversation
|
@0xferrous is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
|
Nice. Is this ready? (currently marked as draft) |
8211497 to
542303e
Compare
|
PR author is not in the allowed authors list. |
During paused merges and rebases, Git emits merge conflicts as `diff --cc` or `diff --combined` patches instead of ordinary `diff --git` blocks. Normalize those combined headers and hunks into a first-parent unified diff so Hunk can parse and render them. Add unit and static-renderer coverage for conflicts, binary entries, quoted paths, and multiple parents.
`git show` puts merge-commit metadata before its combined diff. The metadata stripper recognized only ordinary patch headers, so it discarded the entire `diff --cc` or `diff --combined` body and Hunk showed no files. Recognize combined patch headers as the end of metadata and add regression coverage for merge-commit output.
|
Rebased onto current Review found combined path normalization could drop a real top-level Validation passed:
This comment was generated by Pi using GPT-6.1-sol |
542303e to
bbea1fc
Compare
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:
