{"thread":{"id":"57129","subject":"[PATCH] test-ref-store: print hash algorithm","startedAt":"2021-12-21T13:15:04Z","lastAt":"2021-12-21T13:15:04Z","messageCount":1,"participants":["Han-Wen Nienhuys via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"444607","messageId":"pull.1167.git.git.1640092500725.gitgitgadget@gmail.com","threadId":"57129","inReplyTo":null,"subject":"[PATCH] test-ref-store: print hash algorithm","fromName":"Han-Wen Nienhuys via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-12-21T13:15:00Z","receivedAt":"2021-12-21T13:15:04Z","isPatch":true,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"From: Han-Wen Nienhuys <hanwen@google.com>\n\nThis provides a better error message in case SHA256 was inadvertently switched\non through the environment.\n\nSigned-off-by: Han-Wen Nienhuys <hanwen@google.com>\n---\n    test-ref-store: print hash algorithm\n    \n    This provides a better error message in case SHA256 was inadvertently\n    switched on through the environment.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1167%2Fhanwen%2Frefstore-print-hash-algo-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1167/hanwen/refstore-print-hash-algo-v1\nPull-Request: https://github.com/git/git/pull/1167\n\n t/helper/test-ref-store.c | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c\nindex 24dd4bec08c..3e4ddaee705 100644\n--- a/t/helper/test-ref-store.c\n+++ b/t/helper/test-ref-store.c\n@@ -269,7 +269,7 @@ static int cmd_delete_ref(struct ref_store *refs, const char **argv)\n \tstruct object_id old_oid;\n \n \tif (get_oid_hex(sha1_buf, &old_oid))\n-\t\tdie(\"not sha-1\");\n+\t\tdie(\"cannot parse %s as %s\", sha1_buf, the_hash_algo->name);\n \n \treturn refs_delete_ref(refs, msg, refname, &old_oid, flags);\n }\n@@ -284,9 +284,10 @@ static int cmd_update_ref(struct ref_store *refs, const char **argv)\n \tstruct object_id old_oid;\n \tstruct object_id new_oid;\n \n-\tif (get_oid_hex(old_sha1_buf, &old_oid) ||\n-\t    get_oid_hex(new_sha1_buf, &new_oid))\n-\t\tdie(\"not sha-1\");\n+\tif (get_oid_hex(old_sha1_buf, &old_oid))\n+\t\tdie(\"cannot parse %s as %s\", old_sha1_buf, the_hash_algo->name);\n+\tif (get_oid_hex(new_sha1_buf, &new_oid))\n+\t\tdie(\"cannot parse %s as %s\", new_sha1_buf, the_hash_algo->name);\n \n \treturn refs_update_ref(refs, msg, refname,\n \t\t\t       &new_oid, &old_oid,\n\nbase-commit: 69a9c10c95e28df457e33b3c7400b16caf2e2962\n-- \ngitgitgadget\n"}]}