summaryrefslogtreecommitdiff
path: root/src/index.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-02-03 22:31:10 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2015-02-14 09:25:36 -0500
commit41fae48df21c7d1140da539cb61fa3fd0598a3e7 (patch)
tree0a022196f9c01f9036f24a4b6abb2f2dfb299828 /src/index.h
parentbe8404a7680fa1951e20abdaea704156b3345876 (diff)
downloadlibgit2-41fae48df21c7d1140da539cb61fa3fd0598a3e7.tar.gz
indexwriter: an indexwriter for repo operations
Provide git_indexwriter_init_for_operation for the common locking pattern in merge, rebase, revert and cherry-pick.
Diffstat (limited to 'src/index.h')
-rw-r--r--src/index.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/index.h b/src/index.h
index d151f6614..6d2904fdc 100644
--- a/src/index.h
+++ b/src/index.h
@@ -97,6 +97,7 @@ extern int git_index_snapshot_find(
typedef struct {
git_index *index;
git_filebuf file;
+ unsigned int should_write:1;
} git_indexwriter;
#define GIT_INDEXWRITER_INIT { NULL, GIT_FILEBUF_INIT }
@@ -104,6 +105,16 @@ typedef struct {
/* Lock the index for eventual writing. */
extern int git_indexwriter_init(git_indexwriter *writer, git_index *index);
+/* Lock the index for eventual writing by a repository operation: a merge,
+ * revert, cherry-pick or a rebase. Note that the given checkout strategy
+ * will be updated for the operation's use so that checkout will not write
+ * the index.
+ */
+extern int git_indexwriter_init_for_operation(
+ git_indexwriter *writer,
+ git_repository *repo,
+ unsigned int *checkout_strategy);
+
/* Write the index and unlock it. */
extern int git_indexwriter_commit(git_indexwriter *writer);