test-sha1-array: convert most code to struct object_id
This helper is very small, so convert the entire thing. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Mar 26, 2017 at 16:01 UTC
57836f10ad47c2b2c3b94502024758871841091f
1 file changed
+5
-5
t/helper/test-sha1-array.c
+5
-5
@@ -14,16 +14,16 @@ int cmd_main(int argc, const char **argv)
14
15
while (strbuf_getline(&line, stdin) != EOF) {
16
const char *arg;
17
- unsigned char sha1[20];
17
+ struct object_id oid;
18
19
if (skip_prefix(line.buf, "append ", &arg)) {
20
- if (get_sha1_hex(arg, sha1))
20
+ if (get_oid_hex(arg, &oid))
21
die("not a hexadecimal SHA1: %s", arg);
22
- sha1_array_append(&array, sha1);
22
+ sha1_array_append(&array, oid.hash);
23
} else if (skip_prefix(line.buf, "lookup ", &arg)) {
24
- if (get_sha1_hex(arg, sha1))
24
+ if (get_oid_hex(arg, &oid))
25
die("not a hexadecimal SHA1: %s", arg);
26
- printf("%d\n", sha1_array_lookup(&array, sha1));
26
+ printf("%d\n", sha1_array_lookup(&array, oid.hash));
27
} else if (!strcmp(line.buf, "clear"))
28
sha1_array_clear(&array);
29
else if (!strcmp(line.buf, "for_each_unique"))