]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go/internal/modfetch/codehost: report git errors more accurately
authorKevin Burke <kevin@burke.dev>
Tue, 2 Mar 2021 19:54:36 +0000 (11:54 -0800)
committerKevin Burke <kev@inburke.com>
Fri, 5 Mar 2021 20:15:19 +0000 (20:15 +0000)
commit39bdd41d03725878f1fd6f8b500ba6700f03bdad
tree7c3203dc7263dbded5a4834109d7de23137cecf9
parent44721f4565858526545c69b4846daeea40843a98
cmd/go/internal/modfetch/codehost: report git errors more accurately

Previously, if you attempted to fetch a private repository, or your
Git/curl client failed for an unknown reason, codehost would return an
UnknownRevisionError, which reported that a given revision in go.mod
was "unknown". This is confusing to many users who can go look in
their browser for example and see that the commit-ish exists.

Instead check whether "git ls-remote" exited with an error, and if so,
return that instead of the UnknownRevision message.

Fixes #42751.

Change-Id: I0dbded878b2818280e61126a4493767d719ad577
Reviewed-on: https://go-review.googlesource.com/c/go/+/297950
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/go/internal/modfetch/codehost/git.go
src/cmd/go/testdata/script/mod_get_private_vcs.txt