Merge branch 'jk/no-optional-locks'
authorJunio C Hamano <gitster@pobox.com>
Tue, 3 Oct 2017 06:42:48 +0000 (15:42 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Oct 2017 06:42:49 +0000 (15:42 +0900)
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

1  2 
builtin/commit.c
cache.h
environment.c
git.c

@@@ -1392,9 -1385,12 +1392,12 @@@ int cmd_status(int argc, const char **a
        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;
 +      s.is_initial = get_oid(s.reference, &oid) ? 1 : 0;
        if (!s.is_initial)
                hashcpy(s.sha1_commit, oid.hash);
  
diff --cc cache.h
Simple merge
diff --cc environment.c
Simple merge
diff --cc git.c
Simple merge