summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2017-10-05 20:32:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-06 01:07:18 (GMT)
commit8dc3834610b676c2eb64cfe2a08b8b3d05be05df (patch)
treeac574f6d4262d4484dbd9db11cb97cf6cf484c20 /cache.h
parentd13cd4c92760d8fe01fb51fbab556a4d1f3713b4 (diff)
downloadgit-8dc3834610b676c2eb64cfe2a08b8b3d05be05df.zip
git-8dc3834610b676c2eb64cfe2a08b8b3d05be05df.tar.gz
git-8dc3834610b676c2eb64cfe2a08b8b3d05be05df.tar.bz2
cache.h: document `write_locked_index()`
The next patches will tweak the behavior of this function. Document it in order to establish a basis for those patches. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index ea6c236..e9d9556 100644
--- a/cache.h
+++ b/cache.h
@@ -601,9 +601,25 @@ extern int do_read_index(struct index_state *istate, const char *path,
extern int read_index_from(struct index_state *, const char *path);
extern int is_index_unborn(struct index_state *);
extern int read_index_unmerged(struct index_state *);
+
+/* For use with `write_locked_index()`. */
#define COMMIT_LOCK (1 << 0)
#define CLOSE_LOCK (1 << 1)
+
+/*
+ * Write the index while holding an already-taken lock. The flags may
+ * contain at most one of `COMMIT_LOCK` and `CLOSE_LOCK`.
+ *
+ * Unless a split index is in use, write the index into the lockfile.
+ *
+ * With a split index, write the shared index to a temporary file,
+ * adjust its permissions and rename it into place, then write the
+ * split index to the lockfile. If the temporary file for the shared
+ * index cannot be created, fall back to the behavior described in
+ * the previous paragraph.
+ */
extern int write_locked_index(struct index_state *, struct lock_file *lock, unsigned flags);
+
extern int discard_index(struct index_state *);
extern void move_index_extensions(struct index_state *dst, struct index_state *src);
extern int unmerged_index(const struct index_state *);