summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-10-03 06:42:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-03 06:42:49 (GMT)
commitd4e93836a6a072e392b20d7daf604fd41e15ecf9 (patch)
tree69f37e3a5a7239b416a0c75b9d52114cb9e048d3 /builtin
parentd9ec072a2903f31a0e1afde4125f62b9fc57f620 (diff)
parent27344d6a6c8056664966e11acf674e5da6dd7ee3 (diff)
downloadgit-d4e93836a6a072e392b20d7daf604fd41e15ecf9.zip
git-d4e93836a6a072e392b20d7daf604fd41e15ecf9.tar.gz
git-d4e93836a6a072e392b20d7daf604fd41e15ecf9.tar.bz2
Merge branch 'jk/no-optional-locks'
Some commands (most notably "git status") makes an opportunistic update when performing a read-only operation to help optimize later operations in the same repository. The new "--no-optional-locks" option can be passed to Git to disable them. * jk/no-optional-locks: git: add --no-optional-locks option
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 0f8ddb6..d75b380 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1392,7 +1392,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_oid(s.reference, &oid) ? 1 : 0;
if (!s.is_initial)