summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-12-18 05:55:46 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2018-03-22 16:09:34 +0100
commit8f212f64a0cb01abab35b3333b0d405cb9a1639c (patch)
tree569f263a1a1db1dc2e85a41ab0083fa589c2986e /include/git2
parent72e60347ffc4383091d4b74f8f42ee6233c8a654 (diff)
downloadlibgit2-8f212f64a0cb01abab35b3333b0d405cb9a1639c.tar.gz
commit: introduce _fromstate()
This variant of the commit creation function takes the reference to update, the tree and the parents from the current branch, index and merging state, allowing for simpler use of a common use-case.
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/commit.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h
index 692b3bdd9..e184e1cc6 100644
--- a/include/git2/commit.h
+++ b/include/git2/commit.h
@@ -443,6 +443,27 @@ GIT_EXTERN(int) git_commit_create_buffer(
size_t parent_count,
const git_commit *parents[]);
+/*
+ * Create a new commit from the current state and update the current branch
+ *
+ * Creates a new commit, similarly to the other functions. This
+ * variant takes the current state of the repository instead of
+ * arguments.
+ *
+ * The current branch will be updated. The tree will be created from
+ * the repository's index. The parents will be taken from HEAD and
+ * MERGE_HEAD, if applicable.
+ *
+ * @see git_commit_create
+ */
+GIT_EXTERN(int) git_commit_create_fromstate(
+ git_oid *id,
+ git_repository *repo,
+ const git_signature *author,
+ const git_signature *committer,
+ const char *message_encoding,
+ const char *message);
+
/**
* Create a commit object from the given buffer and signature
*