diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-03-21 11:30:10 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-21 11:30:10 -0700 |
commit | beb2cdf5041104a7513301a9b20944a617eec94e (patch) | |
tree | 6f44e7c048bc9857025235064b956a5d1d53ee25 /read-cache.c | |
parent | Merge branch 'ma/config-page-only-in-list-mode' (diff) | |
parent | write_locked_index(): add flag to avoid writing unchanged index (diff) | |
download | tgif-beb2cdf5041104a7513301a9b20944a617eec94e.tar.xz |
Merge branch 'ma/skip-writing-unchanged-index'
Internal API clean-up to allow write_locked_index() optionally skip
writing the in-core index when it is not modified.
* ma/skip-writing-unchanged-index:
write_locked_index(): add flag to avoid writing unchanged index
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c index 977921d90c..d05eb725b5 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2538,6 +2538,12 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock, int new_shared_index, ret; struct split_index *si = istate->split_index; + if ((flags & SKIP_IF_UNCHANGED) && !istate->cache_changed) { + if (flags & COMMIT_LOCK) + rollback_lock_file(lock); + return 0; + } + if (istate->fsmonitor_last_update) fill_fsmonitor_bitmap(istate); |