summaryrefslogtreecommitdiff
path: root/advice.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2011-12-17 05:45:39 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-12-19 11:21:29 -0800
commit02f7914734eb8360cf314d887931c5d5ad0d8046 (patch)
treea325da2c32573f36b36df0f60b70c7a939073508 /advice.c
parentUpdate draft release notes for 1.7.8.1 (diff)
downloadtgif-02f7914734eb8360cf314d887931c5d5ad0d8046.tar.xz
remote-curl: don't pass back fake refs
When receive-pack advertises its list of refs, it generally hides the capabilities information after a NUL at the end of the first ref. However, when we have an empty repository, there are no refs, and therefore receive-pack writes a fake ref "capabilities^{}" with the capabilities afterwards. On the client side, git reads the result with get_remote_heads(). We pick the capabilities from the end of the line, and then call check_ref() to make sure the ref name is valid. We see that it isn't, and don't bother adding it to our list of refs. However, the call to check_ref() is enabled by passing the REF_NORMAL flag to get_remote_heads. For the regular git transport, we pass REF_NORMAL in get_refs_via_connect() if we are doing a push (since only receive-pack uses this fake ref). But in remote-curl, we never use this flag, and we accept the fake ref as a real one, passing it back from the helper to the parent git-push. Most of the time this bug goes unnoticed, as the fake ref won't match our refspecs. However, if "--mirror" is used, then we see it as remote cruft to be pruned, and try to pass along a deletion refspec for it. Of course this refspec has bogus syntax (because of the ^{}), and the helper complains, aborting the push. Let's have remote-curl mirror what the builtin get_refs_via_connect() does (at least for the case of using git protocol; we can leave the dumb info/refs reader as it is). This also fixes pushing with --mirror to a smart-http remote that uses alternates. The fake ".have" refs the server gives to avoid unnecessary network transfer has a similar bad interactions with the machinery. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'advice.c')
0 files changed, 0 insertions, 0 deletions