refs: convert update_ref and refs_update_ref to use struct object_id
[gitweb.git] / t / helper / test-ref-store.c
index 05d8c4d8af093ad42d855b17d243fe07b8893bfb..af8dba95603ba68ffc78aa5089a2e97b10998030 100644 (file)
@@ -218,12 +218,12 @@ static int cmd_delete_ref(struct ref_store *refs, const char **argv)
        const char *refname = notnull(*argv++, "refname");
        const char *sha1_buf = notnull(*argv++, "old-sha1");
        unsigned int flags = arg_flags(*argv++, "flags");
-       unsigned char old_sha1[20];
+       struct object_id old_oid;
 
-       if (get_sha1_hex(sha1_buf, old_sha1))
+       if (get_oid_hex(sha1_buf, &old_oid))
                die("not sha-1");
 
-       return refs_delete_ref(refs, msg, refname, old_sha1, flags);
+       return refs_delete_ref(refs, msg, refname, &old_oid, flags);
 }
 
 static int cmd_update_ref(struct ref_store *refs, const char **argv)
@@ -233,15 +233,15 @@ static int cmd_update_ref(struct ref_store *refs, const char **argv)
        const char *new_sha1_buf = notnull(*argv++, "old-sha1");
        const char *old_sha1_buf = notnull(*argv++, "old-sha1");
        unsigned int flags = arg_flags(*argv++, "flags");
-       unsigned char old_sha1[20];
-       unsigned char new_sha1[20];
+       struct object_id old_oid;
+       struct object_id new_oid;
 
-       if (get_sha1_hex(old_sha1_buf, old_sha1) ||
-           get_sha1_hex(new_sha1_buf, new_sha1))
+       if (get_oid_hex(old_sha1_buf, &old_oid) ||
+           get_oid_hex(new_sha1_buf, &new_oid))
                die("not sha-1");
 
        return refs_update_ref(refs, msg, refname,
-                              new_sha1, old_sha1,
+                              &new_oid, &old_oid,
                               flags, UPDATE_REFS_DIE_ON_ERR);
 }