Skip to content

feat(sync): add opt-in fast-forward of trunk branch after sync#702

Merged
aviator-app[bot] merged 1 commit intomasterfrom
ff_trunk_on_sync
Apr 6, 2026
Merged

feat(sync): add opt-in fast-forward of trunk branch after sync#702
aviator-app[bot] merged 1 commit intomasterfrom
ff_trunk_on_sync

Conversation

@draftcode
Copy link
Copy Markdown
Collaborator

Summary

  • Add --ff-trunk flag to av sync that fast-forwards the local trunk branch (e.g., main/master) to match its remote tracking branch after syncing
  • Add sync.fastForwardTrunk config option to enable this behavior by default
  • When the local trunk has diverged from remote, a warning is shown instead of silently skipping

Test plan

  • go build ./... passes
  • go tool golangci-lint run passes
  • Manual test: run av sync --ff-trunk and verify local trunk is updated
  • Manual test: verify diverged trunk shows warning message
  • Manual test: verify config option sync.fastForwardTrunk works as default

🤖 Generated with Claude Code

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.
@draftcode draftcode requested a review from a team as a code owner April 5, 2026 23:46
@aviator-app
Copy link
Copy Markdown
Contributor

aviator-app bot commented Apr 5, 2026

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

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.

@aviator-app
Copy link
Copy Markdown
Contributor

aviator-app bot commented Apr 5, 2026

✅ FlexReview Status

Common Owner: aviator-co/engineering (expert-load-balance assignment)
Owner and Assignment:

  • aviator-co/engineering (expert-load-balance assignment)
    Owned Files
    • 🔒 cmd/av/sync.go
    • 🔒 internal/config/config.go
    • 🔒 internal/git/gitui/ff_trunk.go

Review SLO: 7 business hours if PR size is <= 200 LOC for the first response.

@aviator-app aviator-app bot requested a review from jainankit April 5, 2026 23:46
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
remoteExists, err := m.repo.DoesRemoteBranchExist(ctx, m.trunk)
remoteExists, err := m.repo.DoesRefExist(ctx, fmt.Sprintf("refs/remotes/%s/%s", remote, m.trunk))

@aviator-app aviator-app bot merged commit 9b6c50a into master Apr 6, 2026
5 checks passed
@aviator-app aviator-app bot deleted the ff_trunk_on_sync branch April 6, 2026 17:59
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.

2 participants