Skip to content

Commit abeef9c

Browse files
mhaggergitster
authored andcommitted
rename_ref(): integrate lock_ref_sha1_basic() errors into ours
Now that lock_ref_sha1_basic() gives us back its error messages via a strbuf, incorporate its error message into our error message rather than emitting two separate error messages. Signed-off-by: Michael Haggerty <[email protected]>
1 parent 5b2d8d6 commit abeef9c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

refs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,9 +2907,8 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
29072907

29082908
lock = lock_ref_sha1_basic(newrefname, NULL, NULL, NULL, 0, NULL, &err);
29092909
if (!lock) {
2910-
error("%s", err.buf);
2910+
error("unable to rename '%s' to '%s': %s", oldrefname, newrefname, err.buf);
29112911
strbuf_release(&err);
2912-
error("unable to lock %s for update", newrefname);
29132912
goto rollback;
29142913
}
29152914
hashcpy(lock->old_sha1, orig_sha1);
@@ -2923,9 +2922,8 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
29232922
rollback:
29242923
lock = lock_ref_sha1_basic(oldrefname, NULL, NULL, NULL, 0, NULL, &err);
29252924
if (!lock) {
2926-
error("%s", err.buf);
2925+
error("unable to lock %s for rollback: %s", oldrefname, err.buf);
29272926
strbuf_release(&err);
2928-
error("unable to lock %s for rollback", oldrefname);
29292927
goto rollbacklog;
29302928
}
29312929

0 commit comments

Comments
 (0)