diff options
author | Edward Thomson <ethomson@github.com> | 2016-05-03 15:22:22 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-05-03 15:29:44 -0400 |
commit | c7b4bbffcc559b03422f81d7c11ac762e2753fbf (patch) | |
tree | a7e5f0fa9e44592744f4ebc19765b6648e606597 /tests/rebase/merge.c | |
parent | 4d384d6bbe3efc72fb212a2c5c71c8064a2cee54 (diff) | |
download | libgit2-c7b4bbffcc559b03422f81d7c11ac762e2753fbf.tar.gz |
rebase: test rebase (merge) w/ no common ancestor
Diffstat (limited to 'tests/rebase/merge.c')
-rw-r--r-- | tests/rebase/merge.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c index 2d6df369e..74507e258 100644 --- a/tests/rebase/merge.c +++ b/tests/rebase/merge.c @@ -525,6 +525,54 @@ void test_rebase_merge__finish_with_ids(void) git_rebase_free(rebase); } +void test_rebase_merge__no_common_ancestor(void) +{ + git_rebase *rebase; + git_reference *branch_ref, *upstream_ref; + git_annotated_commit *branch_head, *upstream_head; + git_rebase_operation *rebase_operation; + git_oid commit_id, expected_final_id; + + cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/barley")); + 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, NULL)); + + cl_git_pass(git_rebase_next(&rebase_operation, rebase)); + cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, + NULL, NULL)); + + cl_git_pass(git_rebase_next(&rebase_operation, rebase)); + cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, + NULL, NULL)); + + cl_git_pass(git_rebase_next(&rebase_operation, rebase)); + cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, + NULL, NULL)); + + cl_git_pass(git_rebase_next(&rebase_operation, rebase)); + cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, + NULL, NULL)); + + cl_git_pass(git_rebase_next(&rebase_operation, rebase)); + cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature, + NULL, NULL)); + + cl_git_pass(git_rebase_finish(rebase, signature)); + + git_oid_fromstr(&expected_final_id, "71e7ee8d4fe7d8bf0d107355197e0a953dfdb7f3"); + cl_assert_equal_oid(&expected_final_id, &commit_id); + + 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); +} + static void test_copy_note( const git_rebase_options *opts, bool should_exist) |