summaryrefslogtreecommitdiff
path: root/include/git2/transaction.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-06-28 06:39:38 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-09-30 15:44:32 +0200
commitab8d9242f54e2c570f86a45a509b9420911a4d44 (patch)
tree6070f721e7e93982a0fe37882e5700de5c1186a9 /include/git2/transaction.h
parentbdeb8772fe846eeeea92cb2d9adb85315f3b8417 (diff)
downloadlibgit2-ab8d9242f54e2c570f86a45a509b9420911a4d44.tar.gz
Introduce reference transactions
A transaction allows you to lock multiple references and set up changes for them before applying the changes all at once (or as close as the backend supports). This can be used for replication purposes, or for making sure some operations run when the reference is locked and thus cannot be changed.
Diffstat (limited to 'include/git2/transaction.h')
-rw-r--r--include/git2/transaction.h25
1 files changed, 25 insertions, 0 deletions
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