Commit 78382358 by Edward Thomson

rebase: test checkout options for rebase

parent f3a199dd
......@@ -510,3 +510,52 @@ void test_rebase_merge__copy_notes_disabled_in_config(void)
test_copy_note(NULL, 0);
}
void rebase_checkout_progress_cb(
const char *path,
size_t completed_steps,
size_t total_steps,
void *payload)
{
int *called = payload;
*called = 1;
}
void test_rebase_merge__custom_checkout_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_checkout_options checkout_options = GIT_CHECKOUT_OPTIONS_INIT;
git_rebase_operation *rebase_operation;
int called = 0;
checkout_options.progress_cb = rebase_checkout_progress_cb;
checkout_options.progress_payload = &called;
rebase_options.checkout_options = &checkout_options;
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef"));
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));
called = 0;
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, &rebase_options));
cl_assert_equal_i(1, called);
called = 0;
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_assert_equal_i(1, called);
called = 0;
cl_git_pass(git_rebase_abort(rebase));
cl_assert_equal_i(1, called);
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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment