From b3ffd8f63840b2401fa2e636163512a8f0f17b47 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Tue, 26 Apr 2016 11:48:11 -0400 Subject: [PATCH] rebase::abort: test we can abort rebase by revspec Test that we can properly abort a rebase when it is initialized by a revspec. This ensures that we do not conflate revspecs and refnames. --- tests/rebase/abort.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/rebase/abort.c b/tests/rebase/abort.c index 70529521f..d8891fb1d 100644 --- a/tests/rebase/abort.c +++ b/tests/rebase/abort.c @@ -145,6 +145,25 @@ void test_rebase_abort__merge_by_id(void) git_rebase_free(rebase); } +void test_rebase_abort__merge_by_revspec(void) +{ + git_rebase *rebase; + git_annotated_commit *branch_head, *onto_head; + + cl_git_pass(git_annotated_commit_from_revspec(&branch_head, repo, "b146bd7")); + cl_git_pass(git_annotated_commit_from_revspec(&onto_head, repo, "efad0b1")); + + cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, NULL)); + cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); + + test_abort(branch_head, onto_head); + + git_annotated_commit_free(branch_head); + git_annotated_commit_free(onto_head); + + git_rebase_free(rebase); +} + void test_rebase_abort__merge_by_id_immediately_after_init(void) { git_rebase *rebase;