]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-ref-store: print hash algorithm
authorHan-Wen Nienhuys <hanwen@google.com>
Tue, 21 Dec 2021 13:15:00 +0000 (13:15 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Dec 2021 06:00:01 +0000 (22:00 -0800)
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>
t/helper/test-ref-store.c

index 24dd4bec08c4cd6afc2c33bddfd7c86710141428..3e4ddaee70557690e14c09ad5da34ddbab4a781a 100644 (file)
@@ -269,7 +269,7 @@ static int cmd_delete_ref(struct ref_store *refs, const char **argv)
        struct object_id old_oid;
 
        if (get_oid_hex(sha1_buf, &old_oid))
-               die("not sha-1");
+               die("cannot parse %s as %s", sha1_buf, the_hash_algo->name);
 
        return refs_delete_ref(refs, msg, refname, &old_oid, flags);
 }
@@ -284,9 +284,10 @@ static int cmd_update_ref(struct ref_store *refs, const char **argv)
        struct object_id old_oid;
        struct object_id new_oid;
 
-       if (get_oid_hex(old_sha1_buf, &old_oid) ||
-           get_oid_hex(new_sha1_buf, &new_oid))
-               die("not sha-1");
+       if (get_oid_hex(old_sha1_buf, &old_oid))
+               die("cannot parse %s as %s", old_sha1_buf, the_hash_algo->name);
+       if (get_oid_hex(new_sha1_buf, &new_oid))
+               die("cannot parse %s as %s", new_sha1_buf, the_hash_algo->name);
 
        return refs_update_ref(refs, msg, refname,
                               &new_oid, &old_oid,