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
This commit is contained in:
Junio C Hamano
2017-10-03 15:42:48 +09:00
6 changed files with 41 additions and 1 deletions

View File

@ -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)