Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-08-25 22:29:50 +0400
committerEdward Thomson <ethomson@microsoft.com>2014-10-27 05:59:36 +0300
commitb6b636a7fad2d87067df4df47f37b57467ad6bb6 (patch)
tree7819ee83d1c21015aa606d0cac49a20ddacb233f /tests/rebase
parent18b439b9beee050de0dbf2f4649609764a69fb3c (diff)
rebase: init/open a git_rebase object
Diffstat (limited to 'tests/rebase')
-rw-r--r--tests/rebase/abort.c17
-rw-r--r--tests/rebase/merge.c92
-rw-r--r--tests/rebase/setup.c29
3 files changed, 88 insertions, 50 deletions
diff --git a/tests/rebase/abort.c b/tests/rebase/abort.c
index 896eb4805..c6d27f19d 100644
--- a/tests/rebase/abort.c
+++ b/tests/rebase/abort.c
@@ -20,14 +20,16 @@ void test_rebase_abort__cleanup(void)
static void test_abort(git_merge_head *branch, git_merge_head *onto)
{
+ git_rebase *rebase;
git_reference *head_ref, *branch_ref = NULL;
git_signature *signature;
git_status_list *statuslist;
git_reflog *reflog;
const git_reflog_entry *reflog_entry;
+ cl_git_pass(git_rebase_open(&rebase, repo));
cl_git_pass(git_signature_new(&signature, "Rebaser", "rebaser@example.com", 1404157834, -400));
- cl_git_pass(git_rebase_abort(repo, signature));
+ cl_git_pass(git_rebase_abort(rebase, signature));
cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
@@ -58,10 +60,12 @@ static void test_abort(git_merge_head *branch, git_merge_head *onto)
git_reference_free(head_ref);
git_reference_free(branch_ref);
git_signature_free(signature);
+ git_rebase_free(rebase);
}
void test_rebase_abort__merge(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *onto_ref;
git_signature *signature;
git_merge_head *branch_head, *onto_head;
@@ -74,7 +78,7 @@ void test_rebase_abort__merge(void)
cl_git_pass(git_signature_new(&signature, "Rebaser", "rebaser@example.com", 1404157834, -400));
- cl_git_pass(git_rebase(repo, branch_head, NULL, onto_head, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL));
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
test_abort(branch_head, onto_head);
@@ -86,10 +90,12 @@ void test_rebase_abort__merge(void)
git_reference_free(branch_ref);
git_reference_free(onto_ref);
+ git_rebase_free(rebase);
}
void test_rebase_abort__detached_head(void)
{
+ git_rebase *rebase;
git_oid branch_id;
git_reference *onto_ref;
git_signature *signature;
@@ -103,7 +109,7 @@ void test_rebase_abort__detached_head(void)
cl_git_pass(git_signature_new(&signature, "Rebaser", "rebaser@example.com", 1404157834, -400));
- cl_git_pass(git_rebase(repo, branch_head, NULL, onto_head, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL));
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
test_abort(branch_head, onto_head);
@@ -114,10 +120,12 @@ void test_rebase_abort__detached_head(void)
git_merge_head_free(onto_head);
git_reference_free(onto_ref);
+ git_rebase_free(rebase);
}
void test_rebase_abort__old_style_head_file(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *onto_ref;
git_signature *signature;
git_merge_head *branch_head, *onto_head;
@@ -130,7 +138,7 @@ void test_rebase_abort__old_style_head_file(void)
cl_git_pass(git_signature_new(&signature, "Rebaser", "rebaser@example.com", 1404157834, -400));
- cl_git_pass(git_rebase(repo, branch_head, NULL, onto_head, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL));
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
p_rename("rebase-merge/.git/rebase-merge/orig-head",
@@ -145,4 +153,5 @@ void test_rebase_abort__old_style_head_file(void)
git_reference_free(branch_ref);
git_reference_free(onto_ref);
+ git_rebase_free(rebase);
}
diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c
index a3bb711b2..9b96ecbce 100644
--- a/tests/rebase/merge.c
+++ b/tests/rebase/merge.c
@@ -24,6 +24,7 @@ void test_rebase_merge__cleanup(void)
void test_rebase_merge__next(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_rebase_operation rebase_operation;
@@ -40,9 +41,9 @@ void test_rebase_merge__next(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
git_oid_fromstr(&pick_id, "da9c51a23d02d931a486f45ad18cda05cf5d2b94");
@@ -65,10 +66,12 @@ void test_rebase_merge__next(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
void test_rebase_merge__next_with_conflicts(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_rebase_operation rebase_operation;
@@ -105,9 +108,9 @@ void test_rebase_merge__next_with_conflicts(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
git_oid_fromstr(&pick_id, "33f915f9e4dbd9f4b24430e48731a59b45b15500");
@@ -129,10 +132,12 @@ void test_rebase_merge__next_with_conflicts(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
void test_rebase_merge__next_stops_with_iterover(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_rebase_operation rebase_operation;
@@ -148,29 +153,29 @@ void test_rebase_merge__next_stops_with_iterover(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
- cl_git_fail(error = git_rebase_next(&rebase_operation, repo, &checkout_opts));
+ cl_git_fail(error = git_rebase_next(&rebase_operation, rebase, &checkout_opts));
cl_assert_equal_i(GIT_ITEROVER, error);
cl_assert_equal_file("5\n", 2, "rebase/.git/rebase-merge/end");
@@ -180,10 +185,12 @@ void test_rebase_merge__next_stops_with_iterover(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
void test_rebase_merge__commit(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_rebase_operation rebase_operation;
@@ -202,10 +209,10 @@ void test_rebase_merge__commit(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
@@ -240,10 +247,12 @@ void test_rebase_merge__commit(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
void test_rebase_merge__commit_updates_rewritten(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_rebase_operation rebase_operation;
@@ -258,14 +267,14 @@ void test_rebase_merge__commit_updates_rewritten(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
cl_assert_equal_file(
@@ -277,10 +286,12 @@ void test_rebase_merge__commit_updates_rewritten(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
void test_rebase_merge__commit_drops_already_applied(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_rebase_operation rebase_operation;
@@ -296,16 +307,16 @@ void test_rebase_merge__commit_drops_already_applied(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_fail(error = git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_fail(error = git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
cl_assert_equal_i(GIT_EAPPLIED, error);
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
cl_assert_equal_file(
@@ -316,10 +327,12 @@ void test_rebase_merge__commit_drops_already_applied(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
void test_rebase_merge__finish(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref, *head_ref;
git_merge_head *branch_head, *upstream_head;
git_rebase_operation rebase_operation;
@@ -337,16 +350,16 @@ void test_rebase_merge__finish(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
- cl_git_fail(error = git_rebase_next(&rebase_operation, repo, &checkout_opts));
+ cl_git_fail(error = git_rebase_next(&rebase_operation, rebase, &checkout_opts));
cl_assert_equal_i(GIT_ITEROVER, error);
- cl_git_pass(git_rebase_finish(repo, signature, NULL));
+ cl_git_pass(git_rebase_finish(rebase, signature, NULL));
cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
@@ -374,12 +387,14 @@ void test_rebase_merge__finish(void)
git_reference_free(head_ref);
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)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_commit *branch_commit;
@@ -406,13 +421,13 @@ static void test_copy_note(
"refs/notes/test", git_commit_id(branch_commit),
"This is a commit note.", 0));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, opts));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, opts));
- cl_git_pass(git_rebase_next(&rebase_operation, repo, &checkout_opts));
- cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
- cl_git_pass(git_rebase_finish(repo, signature, opts));
+ cl_git_pass(git_rebase_finish(rebase, signature, opts));
cl_assert_equal_i(GIT_REPOSITORY_STATE_NONE, git_repository_state(repo));
@@ -431,6 +446,7 @@ static void test_copy_note(
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
void test_rebase_merge__copy_notes_off_by_default(void)
diff --git a/tests/rebase/setup.c b/tests/rebase/setup.c
index 4828c4057..175641494 100644
--- a/tests/rebase/setup.c
+++ b/tests/rebase/setup.c
@@ -27,6 +27,7 @@ void test_rebase_setup__cleanup(void)
* git checkout beef ; git rebase --merge master */
void test_rebase_setup__blocked_when_in_progress(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
@@ -38,11 +39,11 @@ void test_rebase_setup__blocked_when_in_progress(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
- cl_git_fail(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_fail(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
git_merge_head_free(branch_head);
git_merge_head_free(upstream_head);
@@ -53,6 +54,7 @@ void test_rebase_setup__blocked_when_in_progress(void)
/* git checkout beef ; git rebase --merge master */
void test_rebase_setup__merge(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_reference *head;
@@ -67,7 +69,7 @@ void test_rebase_setup__merge(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
@@ -94,11 +96,13 @@ void test_rebase_setup__merge(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
/* git checkout beef && git rebase --merge --root --onto master */
void test_rebase_setup__merge_root(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *onto_ref;
git_merge_head *branch_head, *onto_head;
git_reference *head;
@@ -113,7 +117,7 @@ void test_rebase_setup__merge_root(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&onto_head, repo, onto_ref));
- cl_git_pass(git_rebase(repo, branch_head, NULL, onto_head, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL));
git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
cl_git_pass(git_repository_head(&head, repo));
@@ -140,11 +144,13 @@ void test_rebase_setup__merge_root(void)
git_merge_head_free(onto_head);
git_reference_free(branch_ref);
git_reference_free(onto_ref);
+ git_rebase_free(rebase);
}
/* git checkout gravy && git rebase --merge --onto master veal */
void test_rebase_setup__merge_onto_and_upstream(void)
{
+ git_rebase *rebase;
git_reference *branch1_ref, *branch2_ref, *onto_ref;
git_merge_head *branch1_head, *branch2_head, *onto_head;
git_reference *head;
@@ -161,7 +167,7 @@ void test_rebase_setup__merge_onto_and_upstream(void)
cl_git_pass(git_merge_head_from_ref(&branch2_head, repo, branch2_ref));
cl_git_pass(git_merge_head_from_ref(&onto_head, repo, onto_ref));
- cl_git_pass(git_rebase(repo, branch1_head, branch2_head, onto_head, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch1_head, branch2_head, onto_head, signature, NULL));
git_oid_fromstr(&head_id, "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00");
cl_git_pass(git_repository_head(&head, repo));
@@ -186,12 +192,14 @@ void test_rebase_setup__merge_onto_and_upstream(void)
git_reference_free(branch1_ref);
git_reference_free(branch2_ref);
git_reference_free(onto_ref);
+ git_rebase_free(rebase);
}
/* Ensure merge commits are dropped in a rebase */
/* git checkout veal && git rebase --merge master */
void test_rebase_setup__branch_with_merges(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_reference *head;
@@ -206,7 +214,7 @@ void test_rebase_setup__branch_with_merges(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
@@ -233,11 +241,13 @@ void test_rebase_setup__branch_with_merges(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
/* git checkout barley && git rebase --merge master */
void test_rebase_setup__orphan_branch(void)
{
+ git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_merge_head *branch_head, *upstream_head;
git_reference *head;
@@ -252,7 +262,7 @@ void test_rebase_setup__orphan_branch(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- cl_git_pass(git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL));
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL));
cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo));
@@ -279,10 +289,12 @@ void test_rebase_setup__orphan_branch(void)
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
}
static int rebase_is_blocked(void)
{
+ git_rebase *rebase = NULL;
int error;
git_reference *branch_ref, *upstream_ref;
@@ -296,13 +308,14 @@ static int rebase_is_blocked(void)
cl_git_pass(git_merge_head_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_merge_head_from_ref(&upstream_head, repo, upstream_ref));
- error = git_rebase(repo, branch_head, upstream_head, NULL, signature, NULL);
+ error = git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, NULL);
git_merge_head_free(branch_head);
git_merge_head_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
+ git_rebase_free(rebase);
return error;
}