feat: smart merge base for depot ci run by 121watts · Pull Request #467 · depot/cli
Instead of always diffing against origin/main, detectPatch now checks if the current branch has been pushed. If origin/<branch> exists, its SHA is used as the merge base — so the patch contains only unpushed local changes rather than the entire branch diff against main. Uses the local tracking ref (not a live fetch) since the user may not have pulled and the tracking ref is guaranteed to exist on GitHub. Falls back to the default-branch merge base for unpushed topic branches. DEP-3888 Made-with: Cursor
- Log a warning to stderr when merge base detection fails instead of silently skipping patch mode. - Update Cobra Long text to accurately describe the new branch-aware patch behavior. Made-with: Cursor
The fast path was using rev-parse to get the SHA of origin/<branch>, which could be ahead of HEAD. This caused git diff to generate a reverse patch undoing remote commits when the tracking ref was ahead. Now both paths use merge-base to find the common ancestor, ensuring the diff only contains unpushed local changes. Applied via @cursor push command
The OnDefaultBranch test hardcoded origin/main but CI's git defaults to master. Now discovers the actual default branch name dynamically, matching how the production code works. Also fixes extra blank lines caught by go fmt. Made-with: Cursor
121watts
deleted the
watts/dep-3888-smart-merge-base
branch
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