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>
Martin Ågren committed
Oct 5, 2017 at 22:32 UTC
8dc3834610b676c2eb64cfe2a08b8b3d05be05df
1 file changed
+16
cache.h
+16
@@ -601,9 +601,25 @@ extern int do_read_index(struct index_state *istate, const char *path,
601
extern int read_index_from(struct index_state *, const char *path);
602
extern int is_index_unborn(struct index_state *);
603
extern int read_index_unmerged(struct index_state *);
604
+
605
+/* For use with `write_locked_index()`. */
606
#define COMMIT_LOCK (1 << 0)
607
#define CLOSE_LOCK (1 << 1)
608
+
609
+/*
610
+ * Write the index while holding an already-taken lock. The flags may
611
+ * contain at most one of `COMMIT_LOCK` and `CLOSE_LOCK`.
612
+ *
613
+ * Unless a split index is in use, write the index into the lockfile.
614
+ *
615
+ * With a split index, write the shared index to a temporary file,
616
+ * adjust its permissions and rename it into place, then write the
617
+ * split index to the lockfile. If the temporary file for the shared
618
+ * index cannot be created, fall back to the behavior described in
619
+ * the previous paragraph.
620
+ */
621
extern int write_locked_index(struct index_state *, struct lock_file *lock, unsigned flags);
622
+
623
extern int discard_index(struct index_state *);
624
extern void move_index_extensions(struct index_state *dst, struct index_state *src);
625
extern int unmerged_index(const struct index_state *);