fix: prefer origin/<default> as diff base over stale local branch#397
Merged
tomasz-tomczyk merged 1 commit intomainfrom Apr 30, 2026
Merged
fix: prefer origin/<default> as diff base over stale local branch#397tomasz-tomczyk merged 1 commit intomainfrom
tomasz-tomczyk merged 1 commit intomainfrom
Conversation
Auto-detect now diffs against the remote-tracking ref when origin/<defaultBranch> exists locally, falling back to the bare local name otherwise. The local default branch is often stale relative to upstream, producing diffs bloated with commits already merged on the remote. Closes #377 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #397 +/- ##
==========================================
- Coverage 66.70% 66.70% -0.01%
==========================================
Files 19 19
Lines 8211 8220 +9
==========================================
+ Hits 5477 5483 +6
- Misses 2310 2312 +2
- Partials 424 425 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
origin/<branch>for merge-base when the remote-tracking ref exists, instead of the bare local name.mainis often stale relative toorigin/main(e.g. when feature branches are based onorigin/mainafter a fetch but before amainfast-forward), producing diffs bloated with already-merged upstream commits.defaultBaseRef()helper threaded throughdetectVCSChanges,resolveGitContext,changedFilesOnFeature, and thecrit pullcodepaths. Thebase_branchconfig override is unchanged — already acceptsorigin/main.DefaultBaseRef(); Sapling backend returns the bare default (no equivalent remote convention).Closes #377
Review
Test plan
TestDefaultBaseRef_PrefersOrigincovers no-remote, with-remote, and override pathsTestMergeBase_OriginMain(the issue reporter's exact workflow) still passesgo test -race -count=1 ./...green🤖 Generated with Claude Code