Repository navigation
fix(adopt): set upstream tracking when adopting remote branches - #755
Conversation
Current Aviator status
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.
|
✅ FlexReview StatusCommon Owner:
Review SLO: |
There was a problem hiding this comment.
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.
| hasChild := make(map[string]bool) | ||
| for _, ab := range branches { | ||
| hasChild[ab.Parent.Name] = true | ||
| _ = vm.repo.BranchSetUpstream(context.Background(), ab.Name, remote) |
There was a problem hiding this comment.
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.
| _ = 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) | |
| } |
av adopt --remotefetched branches directly intorefs/heads/Xand never set upstream tracking, so a subsequentgit pullfailed with "There is no tracking information for the current branch."This sets tracking only for the
--remotepath (those branches have open PRs on the remote, soorigin/Xis the correct upstream — matching what av already configures on push). Plainav adopt/--parentare left as-is, since those branches may not exist on the remote yet.refs/remotes/<remote>/X) alongside the local branch, since the explicit refspec bypasses the defaultorigin/*mapping.BranchSetUpstreamfor each adopted branch after adoption.