mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Martin Ågren" <>
Cc: "Michael Haggerty" <>,
	"Rafael Ascensão" <>,
	"Junio C Hamano" <>,
	"David Turner" <>,
	"Jonathan Nieder" <>,
	"brian m. carlson" <>
Subject: [PATCH v2 1/3] refs.c: refer to "object ID", not "sha1", in error messages
Date: Thu, 10 May 2018 21:29:54 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

We have two error messages that complain about the "sha1". Because we
are about to touch one of these sites and add some tests, let's first
modernize the messages to say "object ID" instead.

While at it, make the second one use `error()` instead of `warning()`.
After printing the message, we do not continue, but actually drop the
lock and return -1 without deleting the pseudoref.

Signed-off-by: Martin Ågren <>
We could make error-reporting more consistent in general in this file,
but I'd rather not lose track of the original goal of this series.

 refs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/refs.c b/refs.c
index 64aadd14c9..7820a52c4f 100644
--- a/refs.c
+++ b/refs.c
@@ -684,7 +684,8 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
 		if (read_ref(pseudoref, &actual_old_oid))
 			die("could not read ref '%s'", pseudoref);
 		if (oidcmp(&actual_old_oid, old_oid)) {
-			strbuf_addf(err, "unexpected sha1 when writing '%s'", pseudoref);
+			strbuf_addf(err, "unexpected object ID when writing '%s'",
+				    pseudoref);
 			goto done;
@@ -722,7 +723,8 @@ static int delete_pseudoref(const char *pseudoref, const struct object_id *old_o
 		if (read_ref(pseudoref, &actual_old_oid))
 			die("could not read ref '%s'", pseudoref);
 		if (oidcmp(&actual_old_oid, old_oid)) {
-			warning("Unexpected sha1 when deleting %s", pseudoref);
+			error("unexpected object ID when deleting '%s'",
+			      pseudoref);
 			return -1;

  reply	other threads:[~2018-05-10 19:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 16:28 git update-ref fails to create reference. (bug) Rafael Ascensão
2018-05-04 18:26 ` Martin Ågren
2018-05-05 19:08   ` Rafael Ascensão
2018-05-06 13:35     ` [PATCH] refs: handle null-oid for pseudorefs Martin Ågren
2018-05-06 15:37       ` David Turner
2018-05-07  7:39       ` Michael Haggerty
2018-05-07 10:05         ` Martin Ågren
2018-05-10 19:29           ` [PATCH v2 0/3] refs: handle zero oid " Martin Ågren
2018-05-10 19:29             ` Martin Ågren [this message]
2018-05-10 19:29             ` [PATCH v2 2/3] t1400: add tests around adding/deleting pseudorefs Martin Ågren
2018-05-10 19:29             ` [PATCH v2 3/3] refs: handle zero oid for pseudorefs Martin Ågren

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:

  List information:

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

  git send-email \ \ \ \ \ \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

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 read-only IMAP folder(s) and NNTP newsgroup(s).