git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] test-ref-store: print hash algorithm

From
Han-Wen Nienhuys via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 21, 2021, 13:15 UTC
Message-ID
<pull.1167.git.git.1640092500725.gitgitgadget@gmail.com>
From: Han-Wen Nienhuys <hanwen@google.com>

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>
---
    test-ref-store: print hash algorithm
    
    This provides a better error message in case SHA256 was inadvertently
    switched on through the environment.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1167%2Fhanwen%2Frefstore-print-hash-algo-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1167/hanwen/refstore-print-hash-algo-v1
Pull-Request: https://github.com/git/git/pull/1167
 t/helper/test-ref-store.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 24dd4bec08c..3e4ddaee705 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -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,

base-commit: 69a9c10c95e28df457e33b3c7400b16caf2e2962
-- 
gitgitgadget
Message 1 of 1 in “test-ref-store: print hash algorithm”
  1. test-ref-store: print hash algorithmHan-Wen Nienhuys via GitGitGadget, Dec 21, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.