diff options
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/merge.h | 59 | ||||
-rw-r--r-- | include/git2/types.h | 3 |
2 files changed, 58 insertions, 4 deletions
diff --git a/include/git2/merge.h b/include/git2/merge.h index 955840569..af8f36063 100644 --- a/include/git2/merge.h +++ b/include/git2/merge.h @@ -23,13 +23,13 @@ GIT_BEGIN_DECL /** - * Flags for tree_many diff options. A combination of these flags can be - * passed in via the `flags` value in the `git_diff_tree_many_options`. + * Flags for `git_mrege_tree` options. A combination of these flags can be + * passed in via the `flags` vlaue in the `git_merge_tree_opts`. */ typedef enum { /** Detect renames */ GIT_MERGE_TREE_FIND_RENAMES = (1 << 0), -} git_merge_tree_flags; +} git_merge_tree_flag_t; /** * Automerge options for `git_merge_trees_opts`. @@ -44,7 +44,7 @@ typedef enum { typedef struct { unsigned int version; - git_merge_tree_flags flags; + git_merge_tree_flag_t flags; /** Similarity to consider a file renamed (default 50) */ unsigned int rename_threshold; @@ -96,6 +96,57 @@ GIT_EXTERN(int) git_merge_base_many( size_t length); /** + * Creates a `git_merge_head` from the given reference + * + * @param out pointer to store the git_merge_head result in + * @param repo repository that contains the given reference + * @param ref reference to use as a merge input + * @return zero on success, -1 on failure. + */ +GIT_EXTERN(int) git_merge_head_from_ref( + git_merge_head **out, + git_repository *repo, + git_reference *ref); + +/** + * Creates a `git_merge_head` from the given fetch head data + * + * @param out pointer to store the git_merge_head result in + * @param repo repository that contains the given commit + * @param branch_name name of the (remote) branch + * @param remote_url url of the remote + * @param oid the commit object id to use as a merge input + * @return zero on success, -1 on failure. + */ +GIT_EXTERN(int) git_merge_head_from_fetchhead( + git_merge_head **out, + git_repository *repo, + const char *branch_name, + const char *remote_url, + const git_oid *oid); + +/** + * Creates a `git_merge_head` from the given commit id + * + * @param out pointer to store the git_merge_head result in + * @param repo repository that contains the given commit + * @param oid the commit object id to use as a merge input + * @return zero on success, -1 on failure. + */ +GIT_EXTERN(int) git_merge_head_from_oid( + git_merge_head **out, + git_repository *repo, + const git_oid *oid); + +/** + * Frees a `git_merge_head` + * + * @param the merge head to free + */ +GIT_EXTERN(void) git_merge_head_free( + git_merge_head *head); + +/** * Merge two trees, producing a `git_index` that reflects the result of * the merge. * diff --git a/include/git2/types.h b/include/git2/types.h index 43751d3b0..d97bbcb30 100644 --- a/include/git2/types.h +++ b/include/git2/types.h @@ -168,6 +168,9 @@ typedef struct git_reference git_reference; /** Iterator for references */ typedef struct git_reference_iterator git_reference_iterator; +/** Merge heads, the input to merge */ +typedef struct git_merge_head git_merge_head; + /** Basic type of any Git reference. */ typedef enum { |