Skip to content

rebase-branch: mark up range-diffs with ```diff code blocks#157

Merged
dscho merged 3 commits into
mainfrom
make-range-diffs-in-rebase-shears-colorful
Mar 29, 2026
Merged

rebase-branch: mark up range-diffs with ```diff code blocks#157
dscho merged 3 commits into
mainfrom
make-range-diffs-in-rebase-shears-colorful

Conversation

@dscho

@dscho dscho commented Mar 1, 2026

Copy link
Copy Markdown
Member

The range-diffs in the shears-builds PRs (e.g. git-for-windows/shears-builds#12) are currently rendered as plain monochrome text. By wrapping each range-diff entry in ```diff fenced code blocks instead, GitHub applies diff-style syntax highlighting, making them noticeably more readable. This is the same markup used in the "Rebase to Git " PRs at git-for-windows/git.

All three user-facing range-diff sites are updated (per-skip, per-resolution, and final summary); the correspondence-map generation and AI agent prompts are untouched.

The range-diffs presented to the user in the conflict report and in the
PR body are currently wrapped in plain triple-backtick code blocks, which
renders them as monochrome text. By using ```diff fenced code blocks
instead (one per range-diff entry), GitHub's Markdown renderer applies
diff-style syntax highlighting, making additions, deletions, and context
lines visually distinct (not full range-diff coloring, but noticeably
more readable than plain text).

The markup logic is the same sed pipeline used in the "Rebase to Git
<version>" PRs at git-for-windows/git, split into two functions:
`range_diff_with_markup` runs `git range-diff` with the given
arguments and pipes through the markup, propagating failure from
range-diff itself; `markup_range_diff` applies just the sed pipeline to
already-produced range-diff text on stdin, which is needed for the final
summary range-diff that gets annotated with upstream OIDs between
generation and rendering.

Only the three user-facing range-diff sites are affected (per-skip,
per-resolution, and final summary). The correspondence-map generation
and AI agent prompts remain untouched.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
dscho requested review from mjcheetham and rimrul March 1, 2026 08:52
dscho added 2 commits March 29, 2026 16:22
The shears branches use merging rebases, so the interesting changes
often happen inside merge commits (conflict resolutions). Without
--remerge-diff, range-diff shows these as empty, hiding exactly the
information that is most useful for reviewing the rebase result. By
passing --remerge-diff, the merge conflict resolutions are included
in the range-diff output, making problems visible at a glance.

Only the three user-facing range-diff call sites are affected (per-skip,
per-resolution, and final summary). The correspondence-map generation
and AI agent prompts remain untouched.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
When all patches rebase cleanly, the resulting PR is not very
interesting: everything went as expected. But when conflicts had to be
resolved (whether by skipping upstreamed patches or by surgical AI
resolution), the PR deserves closer attention, and that should be
obvious from the title without having to open it.

The rebase script now writes a small conflict-stats.txt file alongside
the conflict report. The workflow reads it and, when the total is
non-zero, rewrites the PR title to include the breakdown, e.g.
"Rebase shears/next: 3 conflict(s) (1 skipped, 2 resolved) (#12345)".
Trivial rebases with zero conflicts keep the plain title.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
dscho merged commit 7351be3 into main Mar 29, 2026
@dscho
dscho deleted the make-range-diffs-in-rebase-shears-colorful branch March 29, 2026 16:15
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.

1 participant