upload-pack: strip refs before calling ref_is_hidden()
[gitweb.git] / upload-pack.c
index 89e832b64a0548ec79802dfc6911eff9f5c353be..4ca960ec9dc1966d735f908b41a1793a7eb36ae0 100644 (file)
@@ -316,10 +316,8 @@ static int reachable(struct commit *want)
 
        commit_list_insert_by_date(want, &work);
        while (work) {
-               struct commit_list *list = work->next;
-               struct commit *commit = work->item;
-               free(work);
-               work = list;
+               struct commit_list *list;
+               struct commit *commit = pop_commit(&work);
 
                if (commit->object.flags & THEY_HAVE) {
                        want->object.flags |= COMMON_KNOWN;
@@ -694,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;
        }
@@ -705,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;
 }
 
@@ -728,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) {