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
index 0f8ddb6866b3d14c4e6b84f019110387c7f77319,a8ef73d9caeabb72632c7a63152b33aa71c55abc..d75b3805ea7fe3475564f337bf660d8155909445
@@@ -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