-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch remote branch before switching to it
For the "push to branch" feature, the controller must either switch to the branch given, or create it starting at the checked-out HEAD. The func `switchBranch` encapsulates this decision -- but it assumes that if the branch exists at the remote, it will have been fetched when cloning, and this is not always true. In particular, cloning with go-git avoids fetching all refs: https://github.com/fluxcd/source-controller/blob/v0.11.0/pkg/git/gogit/checkout.go This commit adds a step to fetch the remote branch to a local branch, before attempting to switch to the local branch. This makes `switchBranch` a little simpler, and doesn't rely on any refs having been fetched ahead of time. Signed-off-by: Michael Bridgen <michael@weave.works>
- Loading branch information
Showing
1 changed file
with
81 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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