feat(sync): add opt-in fast-forward of trunk branch after sync#702
feat(sync): add opt-in fast-forward of trunk branch after sync#702aviator-app[bot] merged 1 commit intomasterfrom
Conversation
Add --ff-trunk flag and sync.fastForwardTrunk config option to fast-forward the local trunk branch to its remote tracking branch after syncing. This keeps the local trunk up-to-date without requiring a manual checkout and pull. When the local trunk has diverged from remote, a warning message is shown instead of silently skipping.
Current Aviator status
This PR was merged using Aviator.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
✅ FlexReview StatusCommon Owner:
Review SLO: |
There was a problem hiding this comment.
Code Review
This pull request introduces a new --ff-trunk flag to the sync command, enabling users to fast-forward their local trunk branch to match the remote tracking branch. The changes include updates to the sync command flags, configuration settings, and a new Bubbletea model to handle the fast-forward logic. A critical issue was identified in the remote branch existence check, which currently uses a helper method hardcoded to origin instead of the dynamically retrieved remote name.
| } | ||
|
|
||
| // Check if the remote tracking branch exists. | ||
| remoteExists, err := m.repo.DoesRemoteBranchExist(ctx, m.trunk) |
There was a problem hiding this comment.
The DoesRemoteBranchExist helper method is hardcoded to use origin as the remote name (as seen in internal/git/git.go:244). Since the remote name can be configured and you've already retrieved it using m.repo.GetRemoteName(), you should check for the existence of the remote tracking branch using the actual remote name. Otherwise, this check will fail or return incorrect results for repositories where the remote is not named origin.
| remoteExists, err := m.repo.DoesRemoteBranchExist(ctx, m.trunk) | |
| remoteExists, err := m.repo.DoesRefExist(ctx, fmt.Sprintf("refs/remotes/%s/%s", remote, m.trunk)) |
Summary
--ff-trunkflag toav syncthat fast-forwards the local trunk branch (e.g., main/master) to match its remote tracking branch after syncingsync.fastForwardTrunkconfig option to enable this behavior by defaultTest plan
go build ./...passesgo tool golangci-lint runpassesav sync --ff-trunkand verify local trunk is updatedsync.fastForwardTrunkworks as default🤖 Generated with Claude Code