summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-03-21 11:30:10 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-03-21 11:30:10 -0700
commitbeb2cdf5041104a7513301a9b20944a617eec94e (patch)
tree6f44e7c048bc9857025235064b956a5d1d53ee25 /cache.h
parentMerge branch 'ma/config-page-only-in-list-mode' (diff)
parentwrite_locked_index(): add flag to avoid writing unchanged index (diff)
downloadtgif-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 'cache.h')
-rw-r--r--cache.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index d06932ed0b..a61b2d3f0d 100644
--- a/cache.h
+++ b/cache.h
@@ -599,6 +599,7 @@ extern int read_index_unmerged(struct index_state *);
/* For use with `write_locked_index()`. */
#define COMMIT_LOCK (1 << 0)
+#define SKIP_IF_UNCHANGED (1 << 1)
/*
* Write the index while holding an already-taken lock. Close the lock,
@@ -615,6 +616,9 @@ extern int read_index_unmerged(struct index_state *);
* With `COMMIT_LOCK`, the lock is always committed or rolled back.
* Without it, the lock is closed, but neither committed nor rolled
* back.
+ *
+ * If `SKIP_IF_UNCHANGED` is given and the index is unchanged, nothing
+ * is written (and the lock is rolled back if `COMMIT_LOCK` is given).
*/
extern int write_locked_index(struct index_state *, struct lock_file *lock, unsigned flags);