Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Fetch before branch check during initial clone #2371

Merged
merged 1 commit into from
Aug 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions git/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,17 @@ func (r *Repo) step(bg context.Context) bool {
defer cancel()

if r.branch != "" {
r.mu.Lock()
// The remote may have changed between `RepoNew` and this
// iteration of `RepoCloned`. Fetch again to pick-up any
// changes that may have been made.
err := r.fetch(ctx)
r.mu.Unlock()
if err != nil {
r.setUnready(RepoCloned, err)
return false
}

ok, err := refExists(ctx, dir, "refs/heads/"+r.branch)
if err != nil {
r.setUnready(RepoCloned, err)
Expand Down