test-ref-store: print hash algorithm
This provides a better error message in case SHA256 was inadvertently switched on through the environment. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Han-Wen Nienhuys committed
Dec 21, 2021 at 13:15 UTC
57eb3681449d7b4703bb124e482440759724419f
1 file changed
+5
-4
t/helper/test-ref-store.c
+5
-4
@@ -269,7 +269,7 @@ static int cmd_delete_ref(struct ref_store *refs, const char **argv)
269
struct object_id old_oid;
270
271
if (get_oid_hex(sha1_buf, &old_oid))
272
- die("not sha-1");
272
+ die("cannot parse %s as %s", sha1_buf, the_hash_algo->name);
273
274
return refs_delete_ref(refs, msg, refname, &old_oid, flags);
275
}
@@ -284,9 +284,10 @@ static int cmd_update_ref(struct ref_store *refs, const char **argv)
284
struct object_id old_oid;
285
struct object_id new_oid;
286
287
- if (get_oid_hex(old_sha1_buf, &old_oid) ||
288
- get_oid_hex(new_sha1_buf, &new_oid))
289
- die("not sha-1");
287
+ if (get_oid_hex(old_sha1_buf, &old_oid))
288
+ die("cannot parse %s as %s", old_sha1_buf, the_hash_algo->name);
289
+ if (get_oid_hex(new_sha1_buf, &new_oid))
290
+ die("cannot parse %s as %s", new_sha1_buf, the_hash_algo->name);
291
292
return refs_update_ref(refs, msg, refname,
293
&new_oid, &old_oid,