Skip to content

fix(adopt): set upstream tracking when adopting remote branches - #755

Merged
aviator-app[bot] merged 1 commit into
masterfrom
adopt-remote-set-upstream-tracking
Jun 2, 2026
Merged

aviator-app[bot] merged 1 commit into
masterfrom
adopt-remote-set-upstream-tracking

Conversation

@simsinght

Copy link
Copy Markdown
Contributor

av adopt --remote fetched branches directly into refs/heads/X and never set upstream tracking, so a subsequent git pull failed with "There is no tracking information for the current branch."

This sets tracking only for the --remote path (those branches have open PRs on the remote, so origin/X is the correct upstream — matching what av already configures on push). Plain av adopt / --parent are left as-is, since those branches may not exist on the remote yet.

  • Fetch the remote-tracking ref (refs/remotes/<remote>/X) alongside the local branch, since the explicit refspec bypasses the default origin/* mapping.
  • Call BranchSetUpstream for each adopted branch after adoption.

@simsinght
simsinght requested a review from a team as a code owner June 2, 2026 19:21
@aviator-app

aviator-app Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

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 (commit 90ed202).


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

aviator-app Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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/adopt.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 tulioz June 2, 2026 19:21

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

Copy link
Copy Markdown

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 updates the branch adoption process in cmd/av/adopt.go to configure upstream tracking. It fetches the remote-tracking ref and calls BranchSetUpstream during adoption. The reviewer noted that the error from BranchSetUpstream is silently ignored and suggested logging a warning instead of discarding the error.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread cmd/av/adopt.go
hasChild := make(map[string]bool)
for _, ab := range branches {
hasChild[ab.Parent.Name] = true
_ = vm.repo.BranchSetUpstream(context.Background(), ab.Name, remote)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The error returned by BranchSetUpstream is silently ignored. If setting the upstream tracking branch fails, the user won't be notified, and subsequent git operations (like git pull) might still fail with tracking errors.

Consider logging a warning when this call fails. Note that you will need to import "github.com/sirupsen/logrus" in this file to use logrus.

Suggested change
_ = vm.repo.BranchSetUpstream(context.Background(), ab.Name, remote)
if err := vm.repo.BranchSetUpstream(context.Background(), ab.Name, remote); err != nil {
logrus.WithError(err).Warnf("failed to set upstream tracking for branch %s", ab.Name)
}

@aviator-app
aviator-app Bot merged commit 90ed202 into master Jun 2, 2026
5 checks passed
@aviator-app
aviator-app Bot deleted the adopt-remote-set-upstream-tracking branch June 2, 2026 21:17
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