git: add --no-optional-locks option
[gitweb.git] / builtin / commit.c
index 1a0da71a43cfef8818b52a3d27131e340725cef2..a8ef73d9caeabb72632c7a63152b33aa71c55abc 100644 (file)
@@ -1385,7 +1385,10 @@ int cmd_status(int argc, const char **argv, const char *prefix)
        read_cache_preload(&s.pathspec);
        refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &s.pathspec, NULL, NULL);
 
-       fd = hold_locked_index(&index_lock, 0);
+       if (use_optional_locks())
+               fd = hold_locked_index(&index_lock, 0);
+       else
+               fd = -1;
 
        s.is_initial = get_sha1(s.reference, oid.hash) ? 1 : 0;
        if (!s.is_initial)