summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2013-12-02 14:10:04 -0500
committerEdward Thomson <ethomson@microsoft.com>2013-12-03 10:18:53 -0500
commiteac938d96eccb39c30ce94adf7f8cdc06df098fe (patch)
treec988491670ff34769ebfc5ea041e40256935a4d9 /include
parent553d33732aa69f5dab717181fc3a72b42ce07339 (diff)
downloadlibgit2-eac938d96eccb39c30ce94adf7f8cdc06df098fe.tar.gz
Bare naked merge and rebase
Diffstat (limited to 'include')
-rw-r--r--include/git2/merge.h20
-rw-r--r--include/git2/revert.h37
2 files changed, 50 insertions, 7 deletions
diff --git a/include/git2/merge.h b/include/git2/merge.h
index 3354fbeab..8a1dfec2e 100644
--- a/include/git2/merge.h
+++ b/include/git2/merge.h
@@ -192,6 +192,26 @@ GIT_EXTERN(int) git_merge_trees(
const git_merge_tree_opts *opts);
/**
+ * Merge two commits, producing a `git_index` that reflects the result of
+ * the merge.
+ *
+ * The returned index must be freed explicitly with `git_index_free`.
+ *
+ * @param out pointer to store the index result in
+ * @param repo repository that contains the given trees
+ * @param our_commit the commit that reflects the destination tree
+ * @param their_commit the commit to merge in to `our_commit`
+ * @param opts the merge tree options (or null for defaults)
+ * @return zero on success, -1 on failure.
+ */
+GIT_EXTERN(int) git_merge_commits(
+ git_index **out,
+ git_repository *repo,
+ const git_commit *our_commit,
+ const git_commit *their_commit,
+ const git_merge_tree_opts *opts);
+
+/**
* Merges the given commits into HEAD, producing a new commit.
*
* @param out the results of the merge
diff --git a/include/git2/revert.h b/include/git2/revert.h
index fe84238c5..86a6e26cb 100644
--- a/include/git2/revert.h
+++ b/include/git2/revert.h
@@ -34,13 +34,36 @@ typedef struct {
#define GIT_REVERT_OPTS_INIT {GIT_REVERT_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTS_INIT}
/**
-* Reverts the given commits, producing changes in the working directory.
-*
-* @param repo the repository to revert
-* @param commits the commits to revert
-* @param commits_len the number of commits to revert
-* @param flags merge flags
-*/
+ * Reverts the given commit against the given "our" commit, producing an
+ * index that reflects the result of the revert.
+ *
+ * The returned index must be freed explicitly with `git_index_free`.
+ *
+ * @param out pointer to store the index result in
+ * @param repo the repository that contains the given commits
+ * @param revert_commit the commit to revert
+ * @param our_commit the commit to revert against (eg, HEAD)
+ * @param mainline the parent of the revert commit, if it is a merge
+ * @param merge_tree_opts the merge tree options (or null for defaults)
+ * @return zero on success, -1 on failure.
+ */
+int git_revert_commit(
+ git_index **out,
+ git_repository *repo,
+ git_commit *revert_commit,
+ git_commit *our_commit,
+ unsigned int mainline,
+ const git_merge_tree_opts *merge_tree_opts);
+
+/**
+ * Reverts the given commit, producing changes in the working directory.
+ *
+ * @param repo the repository to revert
+ * @param commits the commits to revert
+ * @param commits_len the number of commits to revert
+ * @param flags merge flags
+ * @return zero on success, -1 on failure.
+ */
GIT_EXTERN(int) git_revert(
git_repository *repo,
git_commit *commit,