Merge branch 'bc/blame-doc-fix'
[gitweb.git] / lockfile.c
index 9268cdf325f3881104d6d12ef31639536b15dcb2..aa69210d8b3a9063517d2d84153dc3ba738bef30 100644 (file)
@@ -174,8 +174,16 @@ int hold_lock_file_for_update_timeout(struct lock_file *lk, const char *path,
                                      int flags, long timeout_ms)
 {
        int fd = lock_file_timeout(lk, path, flags, timeout_ms);
-       if (fd < 0 && (flags & LOCK_DIE_ON_ERROR))
-               unable_to_lock_die(path, errno);
+       if (fd < 0) {
+               if (flags & LOCK_DIE_ON_ERROR)
+                       unable_to_lock_die(path, errno);
+               if (flags & LOCK_REPORT_ON_ERROR) {
+                       struct strbuf buf = STRBUF_INIT;
+                       unable_to_lock_message(path, errno, &buf);
+                       error("%s", buf.buf);
+                       strbuf_release(&buf);
+               }
+       }
        return fd;
 }