summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@lfos.de>2015-11-03 08:58:16 +0100
committerJunio C Hamano <gitster@pobox.com>2015-11-05 11:25:02 -0800
commit78a766ab6eaaa91c2638158bd4fda06a93291da0 (patch)
tree3318ee5a30e7227c2c20b46d2a8b7118ed8d3050 /upload-pack.c
parent00b293e519d1aa0c5b57ae9359ec5306d7023b3f (diff)
downloadgit-78a766ab6eaaa91c2638158bd4fda06a93291da0.tar.gz
hideRefs: add support for matching full refs
In addition to matching stripped refs, one can now add hideRefs patterns that the full (unstripped) ref is matched against. To distinguish between stripped and full matches, those new patterns must be prefixed with a circumflex (^). This commit also removes support for the undocumented and unintended hideRefs settings ".have" (suppressing all "have" lines) and "capabilities^{}" (suppressing the capabilities line). Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 4ca960ec9d..08efb1de7b 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -688,11 +688,12 @@ static void receive_needs(void)
}
/* return non-zero if the ref is hidden, otherwise 0 */
-static int mark_our_ref(const char *refname, const struct object_id *oid)
+static int mark_our_ref(const char *refname, const char *refname_full,
+ const struct object_id *oid)
{
struct object *o = lookup_unknown_object(oid->hash);
- if (refname && ref_is_hidden(refname)) {
+ if (ref_is_hidden(refname, refname_full)) {
o->flags |= HIDDEN_REF;
return 1;
}
@@ -700,10 +701,12 @@ static int mark_our_ref(const char *refname, const struct object_id *oid)
return 0;
}
-static int check_ref(const char *refname, const struct object_id *oid,
+static int check_ref(const char *refname_full, const struct object_id *oid,
int flag, void *cb_data)
{
- mark_our_ref(strip_namespace(refname), oid);
+ const char *refname = strip_namespace(refname_full);
+
+ mark_our_ref(refname, refname_full, oid);
return 0;
}
@@ -726,7 +729,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
const char *refname_nons = strip_namespace(refname);
struct object_id peeled;
- if (mark_our_ref(refname_nons, oid))
+ if (mark_our_ref(refname_nons, refname, oid))
return 0;
if (capabilities) {