Skip to content

Commit

Permalink
rename_ref(): integrate lock_ref_sha1_basic() errors into ours
Browse files Browse the repository at this point in the history
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 <mhagger@alum.mit.edu>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed May 11, 2015
1 parent 5b2d8d6 commit abeef9c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2907,9 +2907,8 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms

lock = lock_ref_sha1_basic(newrefname, NULL, NULL, NULL, 0, NULL, &err);
if (!lock) {
error("%s", err.buf);
error("unable to rename '%s' to '%s': %s", oldrefname, newrefname, err.buf);
strbuf_release(&err);
error("unable to lock %s for update", newrefname);
goto rollback;
}
hashcpy(lock->old_sha1, orig_sha1);
Expand All @@ -2923,9 +2922,8 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
rollback:
lock = lock_ref_sha1_basic(oldrefname, NULL, NULL, NULL, 0, NULL, &err);
if (!lock) {
error("%s", err.buf);
error("unable to lock %s for rollback: %s", oldrefname, err.buf);
strbuf_release(&err);
error("unable to lock %s for rollback", oldrefname);
goto rollbacklog;
}

Expand Down

0 comments on commit abeef9c

Please sign in to comment.