summaryrefslogtreecommitdiff
path: root/src/index.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.h')
-rw-r--r--src/index.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/index.h b/src/index.h
index 2eb93fb17..d151f6614 100644
--- a/src/index.h
+++ b/src/index.h
@@ -94,4 +94,22 @@ extern int git_index_snapshot_find(
const char *path, size_t path_len, int stage);
+typedef struct {
+ git_index *index;
+ git_filebuf file;
+} git_indexwriter;
+
+#define GIT_INDEXWRITER_INIT { NULL, GIT_FILEBUF_INIT }
+
+/* Lock the index for eventual writing. */
+extern int git_indexwriter_init(git_indexwriter *writer, git_index *index);
+
+/* Write the index and unlock it. */
+extern int git_indexwriter_commit(git_indexwriter *writer);
+
+/* Cleanup an index writing session, unlocking the file (if it is still
+ * locked and freeing any data structures.
+ */
+extern void git_indexwriter_cleanup(git_indexwriter *writer);
+
#endif