From: Junio C Hamano Date: Tue, 3 Oct 2017 06:42:48 +0000 (+0900) Subject: Merge branch 'jk/no-optional-locks' X-Git-Tag: v2.15.0-rc0~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4e93836a6a072e392b20d7daf604fd41e15ecf9;p=git 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 --- d4e93836a6a072e392b20d7daf604fd41e15ecf9 diff --cc builtin/commit.c index 0f8ddb6866,a8ef73d9ca..d75b3805ea --- a/builtin/commit.c +++ b/builtin/commit.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);