diff options
| author | Michael Matloob <matloob@golang.org> | 2023-11-07 16:39:36 -0500 |
|---|---|---|
| committer | Michael Matloob <matloob@golang.org> | 2023-11-08 19:32:06 +0000 |
| commit | a4adca6c8b468d22e171cc196849c04df6adcdb8 (patch) | |
| tree | 74109c26a0aaa83943ef6b4ddaf7b59a56c1f4af /internal/stdlib/gorepo.go | |
| parent | 4ff3e66113e4f33f61260adba313dbee89dafdbe (diff) | |
| download | go-x-pkgsite-a4adca6c8b468d22e171cc196849c04df6adcdb8.tar.xz | |
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'internal/stdlib/gorepo.go')
| -rw-r--r-- | internal/stdlib/gorepo.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/stdlib/gorepo.go b/internal/stdlib/gorepo.go index 5e0a4e5e..10c361e4 100644 --- a/internal/stdlib/gorepo.go +++ b/internal/stdlib/gorepo.go @@ -44,7 +44,7 @@ func (remoteGoRepo) clone(ctx context.Context, v, directory string) (refName str if err := cmd.Run(); err != nil { return "", err } - cmd = exec.CommandContext(ctx, "git", "fetch", "--depth=1", "--", GoRepoURL, refName+":main") + cmd = exec.CommandContext(ctx, "git", "fetch", "-f", "--depth=1", "--", GoRepoURL, refName+":main") cmd.Dir = directory if b, err := cmd.CombinedOutput(); err != nil { return "", fmt.Errorf("running git fetch: %v: %s", err, b) |
