Convert remaining callers of lookup_commit_reference* to object_id
[gitweb.git] / shallow.c
index 25b6db989bf4ab475bd7fa224c63b753d61f586e..1327ee16fc2d11c24cd58095d77141affe703d7f 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -27,13 +27,13 @@ void set_alternate_shallow_file(const char *path, int override)
        alternate_shallow_file = xstrdup_or_null(path);
 }
 
-int register_shallow(const unsigned char *sha1)
+int register_shallow(const struct object_id *oid)
 {
        struct commit_graft *graft =
                xmalloc(sizeof(struct commit_graft));
-       struct commit *commit = lookup_commit(sha1);
+       struct commit *commit = lookup_commit(oid->hash);
 
-       hashcpy(graft->oid.hash, sha1);
+       oidcpy(&graft->oid, oid);
        graft->nr_parent = -1;
        if (commit && commit->object.parsed)
                commit->parents = NULL;
@@ -65,10 +65,10 @@ int is_repository_shallow(void)
        is_shallow = 1;
 
        while (fgets(buf, sizeof(buf), fp)) {
-               unsigned char sha1[20];
-               if (get_sha1_hex(buf, sha1))
+               struct object_id oid;
+               if (get_oid_hex(buf, &oid))
                        die("bad shallow line: %s", buf);
-               register_shallow(sha1);
+               register_shallow(&oid);
        }
        fclose(fp);
        return is_shallow;
@@ -466,7 +466,7 @@ static uint32_t *paint_alloc(struct paint_info *info)
  * UNINTERESTING or BOTTOM is hit. Set the id-th bit in ref_bitmap for
  * all walked commits.
  */
-static void paint_down(struct paint_info *info, const unsigned char *sha1,
+static void paint_down(struct paint_info *info, const struct object_id *oid,
                       unsigned int id)
 {
        unsigned int i, nr;
@@ -475,7 +475,7 @@ static void paint_down(struct paint_info *info, const unsigned char *sha1,
        size_t bitmap_size = st_mult(sizeof(uint32_t), bitmap_nr);
        uint32_t *tmp = xmalloc(bitmap_size); /* to be freed before return */
        uint32_t *bitmap = paint_alloc(info);
-       struct commit *c = lookup_commit_reference_gently(sha1, 1);
+       struct commit *c = lookup_commit_reference_gently(oid->hash, 1);
        if (!c)
                return;
        memset(bitmap, 0, bitmap_size);
@@ -604,7 +604,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
        }
 
        for (i = 0; i < ref->nr; i++)
-               paint_down(&pi, ref->oid[i].hash, i);
+               paint_down(&pi, ref->oid + i, i);
 
        if (used) {
                int bitmap_size = ((pi.nr_bits + 31) / 32) * sizeof(uint32_t);