Skip to content

Commit c0bdd65

Browse files
Martin Ågrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ccdcbd5 commit c0bdd65

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

refs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,8 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
684684
if (read_ref(pseudoref, &actual_old_oid))
685685
die("could not read ref '%s'", pseudoref);
686686
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);
688689
rollback_lock_file(&lock);
689690
goto done;
690691
}
@@ -722,7 +723,8 @@ static int delete_pseudoref(const char *pseudoref, const struct object_id *old_o
722723
if (read_ref(pseudoref, &actual_old_oid))
723724
die("could not read ref '%s'", pseudoref);
724725
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);
726728
rollback_lock_file(&lock);
727729
return -1;
728730
}

0 commit comments

Comments
 (0)