builtin/pull: convert to struct object_id
[gitweb.git] / t / helper / test-sha1-array.c
index 09f77909716326bdb76a79d3c32d10b74702e1d5..b4bb97fcccc28ab0e2b2949992a52e00878b254d 100644 (file)
@@ -1,9 +1,10 @@
 #include "cache.h"
 #include "sha1-array.h"
 
-static void print_sha1(const unsigned char sha1[20], void *data)
+static int print_sha1(const unsigned char sha1[20], void *data)
 {
        puts(sha1_to_hex(sha1));
+       return 0;
 }
 
 int cmd_main(int argc, const char **argv)
@@ -13,16 +14,16 @@ int cmd_main(int argc, const char **argv)
 
        while (strbuf_getline(&line, stdin) != EOF) {
                const char *arg;
-               unsigned char sha1[20];
+               struct object_id oid;
 
                if (skip_prefix(line.buf, "append ", &arg)) {
-                       if (get_sha1_hex(arg, sha1))
+                       if (get_oid_hex(arg, &oid))
                                die("not a hexadecimal SHA1: %s", arg);
-                       sha1_array_append(&array, sha1);
+                       sha1_array_append(&array, oid.hash);
                } else if (skip_prefix(line.buf, "lookup ", &arg)) {
-                       if (get_sha1_hex(arg, sha1))
+                       if (get_oid_hex(arg, &oid))
                                die("not a hexadecimal SHA1: %s", arg);
-                       printf("%d\n", sha1_array_lookup(&array, sha1));
+                       printf("%d\n", sha1_array_lookup(&array, oid.hash));
                } else if (!strcmp(line.buf, "clear"))
                        sha1_array_clear(&array);
                else if (!strcmp(line.buf, "for_each_unique"))