Skip to content

Commit a4adca6

Browse files
committed
internal/stdlib: pass -f to git fetch in remoteGoRepo.clone
remoteGoRepo.clone inits a repo and then tries to fetch into the "main" branch of the repo. But if the user's settings are for the default branch to be called main, main will already exist and the fetch command will fail. The -f flag will cause the command to do the fetch even though the branch already exists. For golang/go#63254 For golang/go#63744 Change-Id: I33f414654088a67eae4bfa70424d0dc6c34903f0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/540635 LUCI-TryBot-Result: Go LUCI <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]> kokoro-CI: kokoro <[email protected]> Run-TryBot: Michael Matloob <[email protected]>
1 parent 4ff3e66 commit a4adca6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/stdlib/gorepo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (remoteGoRepo) clone(ctx context.Context, v, directory string) (refName str
4444
if err := cmd.Run(); err != nil {
4545
return "", err
4646
}
47-
cmd = exec.CommandContext(ctx, "git", "fetch", "--depth=1", "--", GoRepoURL, refName+":main")
47+
cmd = exec.CommandContext(ctx, "git", "fetch", "-f", "--depth=1", "--", GoRepoURL, refName+":main")
4848
cmd.Dir = directory
4949
if b, err := cmd.CombinedOutput(); err != nil {
5050
return "", fmt.Errorf("running git fetch: %v: %s", err, b)

0 commit comments

Comments
 (0)