git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Han-Wen Nienhuys <hanwenn@gmail.com>,
	Han-Wen Nienhuys <hanwen@google.com>
Subject: [PATCH] test-ref-store: print hash algorithm
Date: Tue, 21 Dec 2021 13:15:00 +0000	[thread overview]
Message-ID: <pull.1167.git.git.1640092500725.gitgitgadget@gmail.com> (raw)

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

                 reply	other threads:[~2021-12-21 13:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1167.git.git.1640092500725.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hanwen@google.com \
    --cc=hanwenn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).