summaryrefslogtreecommitdiff
path: root/tests/rebase/merge.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-02-11 10:11:21 -0800
committerEdward Thomson <ethomson@github.com>2016-02-11 10:49:25 -0800
commita202e0d45bcfd672cf1ff75abc192e6a592874ba (patch)
tree62da08fff9ad113906dd89ebf528d2eb8cc30d8e /tests/rebase/merge.c
parentee6673070a6134f0a1743c866583b14a305b6a43 (diff)
downloadlibgit2-a202e0d45bcfd672cf1ff75abc192e6a592874ba.tar.gz
rebase: allow custom merge_options
Allow callers of rebase to specify custom merge options. This may allow custom conflict resolution, or failing fast when conflicts are detected.
Diffstat (limited to 'tests/rebase/merge.c')
-rw-r--r--tests/rebase/merge.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c
index 33eadb7ed..c60113b64 100644
--- a/tests/rebase/merge.c
+++ b/tests/rebase/merge.c
@@ -565,3 +565,33 @@ void test_rebase_merge__custom_checkout_options(void)
git_reference_free(upstream_ref);
git_rebase_free(rebase);
}
+
+void test_rebase_merge__custom_merge_options(void)
+{
+ git_rebase *rebase;
+ git_reference *branch_ref, *upstream_ref;
+ git_annotated_commit *branch_head, *upstream_head;
+ git_rebase_options rebase_options = GIT_REBASE_OPTIONS_INIT;
+ git_rebase_operation *rebase_operation;
+
+ rebase_options.merge_options.flags |=
+ GIT_MERGE_FAIL_ON_CONFLICT |
+ GIT_MERGE_SKIP_REUC;
+
+ cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/asparagus"));
+ cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master"));
+
+ cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
+ cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
+
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_options));
+
+ cl_git_fail_with(GIT_EMERGECONFLICT, git_rebase_next(&rebase_operation, rebase));
+
+ git_annotated_commit_free(branch_head);
+ git_annotated_commit_free(upstream_head);
+ git_reference_free(branch_ref);
+ git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
+}
+