]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modfetch/codehost: work around an apparent bug in 'git fetch --unshallow'
authorBryan C. Mills <bcmills@google.com>
Mon, 16 Sep 2019 13:39:10 +0000 (09:39 -0400)
committerBryan C. Mills <bcmills@google.com>
Tue, 24 Sep 2019 18:20:52 +0000 (18:20 +0000)
commit1804bbab6285754f69a0683e60fc5590429dc1d1
treebaa2606972393acea7f802305802d032fd0367d9
parent47d27a87f962606230ef9b1a4d42253ceae95f94
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

Fixes #34266

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>
src/cmd/go/internal/modfetch/codehost/git.go
src/cmd/go/testdata/script/mod_get_direct.txt [new file with mode: 0644]