Draw squash-merged branches as merged in the Graph - #89
Merged
Merged
Conversation
Squash and rebase merges leave no merge commit, so a finished pull request's tip never becomes an ancestor of the default branch. Recover the landing by content: a mainline commit newer than the branch's merge base whose patch-id equals the branch's whole base..tip diff (squash) or its tip commit (rebase). Three streamed patch-id passes, never a spawn per branch.
A branch that landed by squash or rebase merge now reads as merged: a dashed merge connector into its landing commit, the landing wears the branch's merge ring, and it counts as merged everywhere a merge source does (Hide merged, claim priority, structure-only, upstream comparison, packing lead-out).
A dashed connector read as pending or provisional — dashes already mean WIP, guessed branch names and backport twins here — while the branch is plainly merged. Draw the squash connector exactly like a merge instead, and name the squash where an expert looks: the landing commit's detail pane says "Squash of <branch>", linking to that branch's changes.
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.
Problem
Repos that land pull requests with squash (or rebase) merges — e.g. a merge queue configured to squash — leave no merge commit behind. The branch tip never becomes an ancestor of the default branch, so the Graph drew finished PRs as live, unmerged branches, next to real-merge PRs that did read as merged. Confusing.
Fix
Recover the landing by content instead of ancestry:
graph/squash.ts) — from the loaded window, find branch tips not reachable from the default branch (local or remote, whichever is newer) and each tip's merge base with it.git/read/squash-landings.ts) — a branch landed when a mainline commit newer than its merge base has the samepatch-id --stableas the branch's wholebase..tipdiff (squash) or its tip commit (rebase merge). Three streamed patch-id passes (thediff-tree --stdinpipeline, generalised to also diff ranges via<tip> <base>lines) — never a spawn per branch.squashedge into its landing commit.<branch>", linking to that branch's changes view.The hook only re-asks when the mainline tip or candidate set changes, and keeps the last answer while loading, so watcher refreshes don't re-run git or flicker.
Tests
squash-landings.test.ts, real git): multi-commit squash merge, rebase merge, never-landed branch, base cutoff.squash.test.ts): candidate/merge-base derivation, remote-ahead default branch, synced branches, tags/HEAD/out-of-window skips.squashedBranchesByLanding(landing → squashed branches).Verified visually on a squash-merge-queue repo: all four squash-landed branches connect into their
(#N)commit like merges; the landing's detail pane names the squashed branch and opens it (same files/stat as the squash commit).🤖 Generated with Claude Code