refs.c: refer to "object ID", not "sha1", in error messages

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 <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin Ågren committed May 10, 2018 at 21:29 UTC c0bdd658bd2f06dc1c0d8fd578e80831f8d53b43
1 file changed +4 -2
refs.c
+4 -2
@@ -684,7 +684,8 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
684 if (read_ref(pseudoref, &actual_old_oid))
685 die("could not read ref '%s'", pseudoref);
686 if (oidcmp(&actual_old_oid, old_oid)) {
687 - strbuf_addf(err, "unexpected sha1 when writing '%s'", pseudoref);
687 + strbuf_addf(err, "unexpected object ID when writing '%s'",
688 + pseudoref);
689 rollback_lock_file(&lock);
690 goto done;
691 }
@@ -722,7 +723,8 @@ static int delete_pseudoref(const char *pseudoref, const struct object_id *old_o
723 if (read_ref(pseudoref, &actual_old_oid))
724 die("could not read ref '%s'", pseudoref);
725 if (oidcmp(&actual_old_oid, old_oid)) {
725 - warning("Unexpected sha1 when deleting %s", pseudoref);
726 + error("unexpected object ID when deleting '%s'",
727 + pseudoref);
728 rollback_lock_file(&lock);
729 return -1;
730 }