]> git.ipfire.org Git - thirdparty/git.git/commit - refs.c
upload/receive-pack: allow hiding ref hierarchies
authorJunio C Hamano <gitster@pobox.com>
Sat, 19 Jan 2013 00:08:30 +0000 (16:08 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Feb 2013 21:48:47 +0000 (13:48 -0800)
commitdaebaa78137d59693a808c1f0bdec0ecb40fc12e
tree46a71938843dae2dade7b121a5d7c5eb7d6a65a9
parent3f1da57fffdcfb48bd8b85da347f310b955245d7
upload/receive-pack: allow hiding ref hierarchies

A repository may have refs that are only used for its internal
bookkeeping purposes that should not be exposed to the others that
come over the network.

Teach upload-pack to omit some refs from its initial advertisement
by paying attention to the uploadpack.hiderefs multi-valued
configuration variable.  Do the same to receive-pack via the
receive.hiderefs variable.  As a convenient short-hand, allow using
transfer.hiderefs to set the value to both of these variables.

Any ref that is under the hierarchies listed on the value of these
variable is excluded from responses to requests made by "ls-remote",
"fetch", etc. (for upload-pack) and "push" (for receive-pack).

Because these hidden refs do not count as OUR_REF, an attempt to
fetch objects at the tip of them will be rejected, and because these
refs do not get advertised, "git push :" will not see local branches
that have the same name as them as "matching" ones to be sent.

An attempt to update/delete these hidden refs with an explicit
refspec, e.g. "git push origin :refs/hidden/22", is rejected.  This
is not a new restriction.  To the pusher, it would appear that there
is no such ref, so its push request will conclude with "Now that I
sent you all the data, it is time for you to update the refs.  I saw
that the ref did not exist when I started pushing, and I want the
result to point at this commit".  The receiving end will apply the
compare-and-swap rule to this request and rejects the push with
"Well, your update request conflicts with somebody else; I see there
is such a ref.", which is the right thing to do. Otherwise a push to
a hidden ref will always be "the last one wins", which is not a good
default.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt
builtin/receive-pack.c
refs.c
refs.h
t/t5512-ls-remote.sh
t/t5516-fetch-push.sh
upload-pack.c