summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/sys/refdb_backend.h13
-rw-r--r--include/git2/transaction.h25
-rw-r--r--include/git2/types.h3
3 files changed, 41 insertions, 0 deletions
diff --git a/include/git2/sys/refdb_backend.h b/include/git2/sys/refdb_backend.h
index 3b216a287..d943e550f 100644
--- a/include/git2/sys/refdb_backend.h
+++ b/include/git2/sys/refdb_backend.h
@@ -153,6 +153,19 @@ struct git_refdb_backend {
* Remove a reflog.
*/
int (*reflog_delete)(git_refdb_backend *backend, const char *name);
+
+ /**
+ * Lock a reference. The opaque parameter will be passed to the unlock function
+ */
+ int (*lock)(void **payload_out, git_refdb_backend *backend, const char *refname);
+
+ /**
+ * Unlock a reference. Only one of target or symbolic_target
+ * will be set. success indicates whether to update the
+ * reference or discard the lock (if it's false)
+ */
+ int (*unlock)(git_refdb_backend *backend, void *payload, int success, int update_reflog,
+ const git_reference *ref, const git_signature *sig, const char *message);
};
#define GIT_REFDB_BACKEND_VERSION 1
diff --git a/include/git2/transaction.h b/include/git2/transaction.h
new file mode 100644
index 000000000..46f4cfba0
--- /dev/null
+++ b/include/git2/transaction.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+#ifndef INCLUDE_git_transaction_h__
+#define INCLUDE_git_transaction_h__
+
+#include "common.h"
+GIT_BEGIN_DECL
+
+GIT_EXTERN(int) git_transaction_new(git_transaction **out, git_repository *repo);
+GIT_EXTERN(int) git_transaction_lock(git_transaction *tx, const char *refname);
+GIT_EXTERN(int) git_transaction_set_target(git_transaction *tx, const char *refname, const git_oid *target, const git_signature *sig, const char *msg);
+
+GIT_EXTERN(int) git_transaction_set_symbolic_target(git_transaction *tx, const char *refname, const char *target, const git_signature *sig, const char *msg);
+GIT_EXTERN(int) git_transaction_set_reflog(git_transaction *tx, const char *refname, const git_reflog *reflog);
+GIT_EXTERN(int) git_transaction_commit(git_transaction *tx);
+GIT_EXTERN(void) git_transaction_free(git_transaction *tx);
+GIT_EXTERN(int) git_transaction_remove(git_transaction *tx, const char *refname);
+
+
+GIT_END_DECL
+#endif
diff --git a/include/git2/types.h b/include/git2/types.h
index 7ee7cc344..14b7071d2 100644
--- a/include/git2/types.h
+++ b/include/git2/types.h
@@ -171,6 +171,9 @@ typedef struct git_reference git_reference;
/** Iterator for references */
typedef struct git_reference_iterator git_reference_iterator;
+/** Transactional interface to references */
+typedef struct git_transaction git_transaction;
+
/** Merge heads, the input to merge */
typedef struct git_merge_head git_merge_head;