]> git.ipfire.org Git - thirdparty/git.git/blobdiff - upload-pack.c
Add several uses of get_object_hash.
[thirdparty/git.git] / upload-pack.c
index d0bc3ca07ab1b005884c80901ea8dee04452b71a..c6b05c6017bbaa8bf872153adb4678d48a6bc3ba 100644 (file)
@@ -324,7 +324,7 @@ static int reachable(struct commit *want)
                        break;
                }
                if (!commit->object.parsed)
-                       parse_object(commit->object.sha1);
+                       parse_object(get_object_hash(commit->object));
                if (commit->object.flags & REACHABLE)
                        continue;
                commit->object.flags |= REACHABLE;
@@ -647,7 +647,7 @@ static void receive_needs(void)
                        if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
                                packet_write(1, "shallow %s",
                                                sha1_to_hex(object->sha1));
-                               register_shallow(object->sha1);
+                               register_shallow(get_object_hash(*object));
                                shallow_nr++;
                        }
                        result = result->next;
@@ -661,7 +661,7 @@ static void receive_needs(void)
                                        sha1_to_hex(object->sha1));
                                object->flags &= ~CLIENT_SHALLOW;
                                /* make sure the real parents are parsed */
-                               unregister_shallow(object->sha1);
+                               unregister_shallow(get_object_hash(*object));
                                object->parsed = 0;
                                parse_commit_or_die((struct commit *)object);
                                parents = ((struct commit *)object)->parents;
@@ -673,14 +673,14 @@ static void receive_needs(void)
                                add_object_array(object, NULL, &extra_edge_obj);
                        }
                        /* make sure commit traversal conforms to client */
-                       register_shallow(object->sha1);
+                       register_shallow(get_object_hash(*object));
                }
                packet_flush(1);
        } else
                if (shallows.nr > 0) {
                        int i;
                        for (i = 0; i < shallows.nr; i++)
-                               register_shallow(shallows.objects[i].item->sha1);
+                               register_shallow(get_object_hash(*shallows.objects[i].item));
                }
 
        shallow_nr += shallows.nr;
@@ -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 (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(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, oid))
+       if (mark_our_ref(refname_nons, refname, oid))
                return 0;
 
        if (capabilities) {