]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.13] cmd/go/internal/modfetch/codehost: work around an apparent...
authorBryan C. Mills <bcmills@google.com>
Mon, 16 Sep 2019 13:39:10 +0000 (09:39 -0400)
committerBryan C. Mills <bcmills@google.com>
Wed, 25 Sep 2019 15:42:05 +0000 (15:42 +0000)
commitfb86bbb3155340860720ba6cba37cc0f18536796
tree5b6cc0bc26b406cee0ceea6941e7c0e0b78402b2
parent94227d241b4bbfa4ffbf836c0d3174d7ee1e430b
[release-branch.go1.13] cmd/go/internal/modfetch/codehost: work around an apparent bug in 'git fetch --unshallow'

When 'git fetch' is passed the '--unshallow' flag, it assumes that the
local and remote refs are equal.¹ However, we were fetching an
expanded set of refs explicitly in the same command, violating that
assumption.

Now we first expand the set of refs, then unshallow the repo in a
separate fetch. Empirically, this seems to work, whereas the opposite
order does not.

¹https://github.com/git/git/blob/4c86140027f4a0d2caaa3ab4bd8bfc5ce3c11c8a/transport.c#L1303-L1309

Updates #34266
Fixes #34477

Change-Id: Ie97eb7c1223f944003a1e31d0ec9e69aad0efc0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/196961
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
(cherry picked from commit 1804bbab6285754f69a0683e60fc5590429dc1d1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/197060
src/cmd/go/internal/modfetch/codehost/git.go
src/cmd/go/testdata/script/mod_get_direct.txt [new file with mode: 0644]