diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2014-01-19 15:05:08 -0800 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2014-01-20 17:15:13 -0500 |
| commit | e651e8e2b5c5eb021448fb0f0a36cb3f10fa9326 (patch) | |
| tree | c987d53e643065e1983bfd75e1549deb2c3edbb3 /src/merge.c | |
| parent | 6b92c99bcbf32de131754a4f750278f84bf5b766 (diff) | |
| download | libgit2-e651e8e2b5c5eb021448fb0f0a36cb3f10fa9326.tar.gz | |
Introduce diff3 mode for checking out conflicts
Diffstat (limited to 'src/merge.c')
| -rw-r--r-- | src/merge.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/merge.c b/src/merge.c index 124befc14..8554bf02b 100644 --- a/src/merge.c +++ b/src/merge.c @@ -2165,6 +2165,8 @@ static int merge_normalize_opts( git_repository *repo, git_merge_opts *opts, const git_merge_opts *given, + const git_merge_head *ancestor_head, + const git_merge_head *our_head, size_t their_heads_len, const git_merge_head **their_heads) { @@ -2184,8 +2186,20 @@ static int merge_normalize_opts( if (!opts->checkout_opts.checkout_strategy) opts->checkout_opts.checkout_strategy = default_checkout_strategy; - if (!opts->checkout_opts.our_label) - opts->checkout_opts.our_label = "HEAD"; + /* TODO: for multiple ancestors in merge-recursive, this is "merged common ancestors" */ + if (!opts->checkout_opts.ancestor_label) { + if (ancestor_head && ancestor_head->commit) + opts->checkout_opts.ancestor_label = git_commit_summary(ancestor_head->commit); + else + opts->checkout_opts.ancestor_label = "ancestor"; + } + + if (!opts->checkout_opts.our_label) { + if (our_head && our_head->ref_name) + opts->checkout_opts.our_label = our_head->ref_name; + else + opts->checkout_opts.our_label = "ours"; + } if (!opts->checkout_opts.their_label) { if (their_heads_len == 1 && their_heads[0]->ref_name) @@ -2480,9 +2494,6 @@ int git_merge( their_trees = git__calloc(their_heads_len, sizeof(git_tree *)); GITERR_CHECK_ALLOC(their_trees); - if ((error = merge_normalize_opts(repo, &opts, given_opts, their_heads_len, their_heads)) < 0) - goto on_error; - if ((error = git_repository__ensure_not_bare(repo, "merge")) < 0) goto on_error; @@ -2494,6 +2505,9 @@ int git_merge( error != GIT_ENOTFOUND) goto on_error; + if ((error = merge_normalize_opts(repo, &opts, given_opts, ancestor_head, our_head, their_heads_len, their_heads)) < 0) + goto on_error; + if (their_heads_len == 1 && ancestor_head != NULL && (merge_check_uptodate(result, ancestor_head, their_heads[0]) || |
