aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modfetch/codehost/git.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2018-08-09 23:17:45 -0400
committerRuss Cox <rsc@golang.org>2018-08-10 18:12:02 +0000
commit12d0a2884a9e1a12050807393fe0266d1b0b40fd (patch)
treeb7c6a32dd3b13a3d0ad1067d5b3068c63c13eb31 /src/cmd/go/internal/modfetch/codehost/git.go
parentccf04c60298783a1cb75965d97c0e2b6876e0afb (diff)
downloadgo-12d0a2884a9e1a12050807393fe0266d1b0b40fd.tar.gz
go-12d0a2884a9e1a12050807393fe0266d1b0b40fd.zip
cmd/go: do not try to understand git fetch --depth=1 errors
We used to try a git fetch --depth=1 of a specific hash and distinguish between an error meaning "that's not a hash I can give you directly" (in which case we fall through and pull the whole repo) and some other error like connection failure, bad ssh key (in which case we give up). We've had repeated problems trying to understand the error meanings so just stop doing that, and fall back to trying a full fetch on any error at all. If the error really was some kind of network or auth or i/o problem, then it will happen the second time and we can report it then. Fixes #26894. Change-Id: If1eaaddb87e8bfeff7a3894cce4ecef39802198c Reviewed-on: https://go-review.googlesource.com/128904 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modfetch/codehost/git.go')
-rw-r--r--src/cmd/go/internal/modfetch/codehost/git.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/go/internal/modfetch/codehost/git.go b/src/cmd/go/internal/modfetch/codehost/git.go
index 06c452ff45..87940a8f02 100644
--- a/src/cmd/go/internal/modfetch/codehost/git.go
+++ b/src/cmd/go/internal/modfetch/codehost/git.go
@@ -347,9 +347,9 @@ func (r *gitRepo) stat(rev string) (*RevInfo, error) {
if err == nil {
return r.statLocal(rev, ref)
}
- if !strings.Contains(err.Error(), "unadvertised object") && !strings.Contains(err.Error(), "no such remote ref") && !strings.Contains(err.Error(), "does not support shallow") {
- return nil, err
- }
+ // Don't try to be smart about parsing the error.
+ // It's too complex and varies too much by git version.
+ // No matter what went wrong, fall back to a complete fetch.
}
// Last resort.