gitweb: Remove unused variables in git_shortlog_body and git_heads
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index 2d9c1dc5d385b9bfcce293ba6d2c21018b9ae0af..02850b69083f793becacc59a0da97a8f69367e4e 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -294,6 +294,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *path,
        int plen,
        const unsigned char *old_sha1, int mustexist)
 {
+       const char *orig_path = path;
        struct ref_lock *lock;
        struct stat st;
 
@@ -303,7 +304,11 @@ static struct ref_lock *lock_ref_sha1_basic(const char *path,
        plen = strlen(path) - plen;
        path = resolve_ref(path, lock->old_sha1, mustexist);
        if (!path) {
+               int last_errno = errno;
+               error("unable to resolve reference %s: %s",
+                       orig_path, strerror(errno));
                unlock_ref(lock);
+               errno = last_errno;
                return NULL;
        }
        lock->lk = xcalloc(1, sizeof(struct lock_file));
@@ -379,7 +384,6 @@ static int log_ref_write(struct ref_lock *lock,
                        lock->log_file, strerror(errno));
        }
 
-       setup_ident();
        committer = git_committer_info(1);
        if (msg) {
                maxlen = strlen(committer) + strlen(msg) + 2*40 + 5;