summaryrefslogtreecommitdiff
path: root/refs.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-19 00:08:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-02-07 21:48:47 (GMT)
commitdaebaa78137d59693a808c1f0bdec0ecb40fc12e (patch)
tree46a71938843dae2dade7b121a5d7c5eb7d6a65a9 /refs.h
parent3f1da57fffdcfb48bd8b85da347f310b955245d7 (diff)
downloadgit-daebaa78137d59693a808c1f0bdec0ecb40fc12e.zip
git-daebaa78137d59693a808c1f0bdec0ecb40fc12e.tar.gz
git-daebaa78137d59693a808c1f0bdec0ecb40fc12e.tar.bz2
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>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/refs.h b/refs.h
index d6c2fe2..1b2e2d3 100644
--- a/refs.h
+++ b/refs.h
@@ -147,4 +147,7 @@ int update_ref(const char *action, const char *refname,
const unsigned char *sha1, const unsigned char *oldval,
int flags, enum action_on_err onerr);
+extern int parse_hide_refs_config(const char *var, const char *value, const char *);
+extern int ref_is_hidden(const char *);
+
#endif /* REFS_H */