Skip to content

Commit

Permalink
upload-pack: strip refs before calling ref_is_hidden()
Browse files Browse the repository at this point in the history
Make hideRefs handling in upload-pack consistent with the behavior
described in the documentation by stripping refs before comparing them
with prefixes in hideRefs.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
lfos authored and gitster committed Nov 5, 2015
1 parent 92cab49 commit 00b293e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions upload-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ static int mark_our_ref(const char *refname, const struct object_id *oid)
{
struct object *o = lookup_unknown_object(oid->hash);

if (ref_is_hidden(refname)) {
if (refname && ref_is_hidden(refname)) {
o->flags |= HIDDEN_REF;
return 1;
}
Expand All @@ -703,7 +703,7 @@ static int mark_our_ref(const char *refname, const struct object_id *oid)
static int check_ref(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
{
mark_our_ref(refname, oid);
mark_our_ref(strip_namespace(refname), oid);
return 0;
}

Expand All @@ -726,7 +726,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, oid))
if (mark_our_ref(refname_nons, oid))
return 0;

if (capabilities) {
Expand Down

0 comments on commit 00b293e

Please sign in to comment.