diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2013-07-03 01:00:45 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2013-11-05 10:00:39 -0500 |
| commit | 039db728f3a0477129e664f0fd8c08316a9e8b62 (patch) | |
| tree | ef86e21bc11aec3fe2a8c860a169c84ab7ccc875 /include/git2/merge.h | |
| parent | ae26c4b80f6d144df0e7915f72c64c5daf73ca50 (diff) | |
| download | libgit2-039db728f3a0477129e664f0fd8c08316a9e8b62.tar.gz | |
merge branch into current, updating workdir
Diffstat (limited to 'include/git2/merge.h')
| -rw-r--r-- | include/git2/merge.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/git2/merge.h b/include/git2/merge.h index 62fd7d723..3354fbeab 100644 --- a/include/git2/merge.h +++ b/include/git2/merge.h @@ -66,6 +66,29 @@ typedef struct { /** + * Option flags for `git_merge`. + * + * GIT_MERGE_NO_FASTFORWARD - Do not fast-forward. + */ +typedef enum { + GIT_MERGE_NO_FASTFORWARD = 1, + GIT_MERGE_FASTFORWARD_ONLY = 2, +} git_merge_flags_t; + +typedef struct { + unsigned int version; + + git_merge_flags_t merge_flags; + git_merge_tree_opts merge_tree_opts; + + git_checkout_opts checkout_opts; +} git_merge_opts; + +#define GIT_MERGE_OPTS_VERSION 1 +#define GIT_MERGE_OPTS_INIT {GIT_MERGE_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTS_INIT} + + +/** * Find a merge base between two commits * * @param out the OID of a merge base between 'one' and 'two' @@ -168,6 +191,43 @@ GIT_EXTERN(int) git_merge_trees( const git_tree *their_tree, const git_merge_tree_opts *opts); +/** + * Merges the given commits into HEAD, producing a new commit. + * + * @param out the results of the merge + * @param repo the repository to merge + * @param merge_heads the heads to merge into + * @param merge_heads_len the number of heads to merge + * @param flags merge flags + */ +GIT_EXTERN(int) git_merge( + git_merge_result **out, + git_repository *repo, + const git_merge_head **their_heads, + size_t their_heads_len, + const git_merge_opts *opts); + +/** + * Returns true if a merge is up-to-date (we were asked to merge the target + * into itself.) + */ +GIT_EXTERN(int) git_merge_result_is_uptodate(git_merge_result *merge_result); + +/** + * Returns true if a merge is eligible for fastforward + */ +GIT_EXTERN(int) git_merge_result_is_fastforward(git_merge_result *merge_result); + +/** + * Gets the fast-forward OID if the merge was a fastforward. + * + * @param out the OID of the fast-forward + * @param merge_result the results of the merge + */ +GIT_EXTERN(int) git_merge_result_fastforward_oid(git_oid *out, git_merge_result *merge_result); + +GIT_EXTERN(void) git_merge_result_free(git_merge_result *merge_result); + /** @} */ GIT_END_DECL #endif |
