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@edwardthomson.com>2014-07-18 22:50:06 +0400
committerEdward Thomson <ethomson@microsoft.com>2014-10-27 05:59:21 +0300
commit93a7004cc234da31d912bb0f266c39b99ab8c8db (patch)
tree06fc49a4dda32a64a77e221f6ebe7109d1754d1b /tests/rebase
parenta35a9890b00b538cd0f3ef94a526c0dd2ec461bf (diff)
git_rebase_commit: drop already-picked commits
Already cherry-picked commits should not be re-included. If all changes included in a commit exist in the upstream, then we should error with GIT_EAPPLIED.
Diffstat (limited to 'tests/rebase')
-rw-r--r--tests/rebase/merge.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c
index e578bef9b..04d06d2e8 100644
--- a/tests/rebase/merge.c
+++ b/tests/rebase/merge.c
@@ -207,3 +207,41 @@ void test_rebase_merge__commit_updates_rewritten(void)
git_reference_free(upstream_ref);
}
+void test_rebase_merge__commit_drops_already_applied(void)
+{
+ git_reference *branch_ref, *upstream_ref;
+ git_merge_head *branch_head, *upstream_head;
+ git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
+ git_oid commit_id;
+ int error;
+
+ checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
+
+ cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef"));
+ cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/green_pea"));
+
+ 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_next(repo, &checkout_opts));
+ cl_git_fail(error = git_rebase_commit(&commit_id, repo, NULL, signature,
+ NULL, NULL));
+
+ cl_assert_equal_i(GIT_EAPPLIED, error);
+
+ cl_git_pass(git_rebase_next(repo, &checkout_opts));
+ cl_git_pass(git_rebase_commit(&commit_id, repo, NULL, signature,
+ NULL, NULL));
+
+ cl_assert_equal_file(
+ "8d1f13f93c4995760ac07d129246ac1ff64c0be9 2ac4fb7b74c1287f6c792acad759e1ec01e18dae\n",
+ 82, "rebase/.git/rebase-merge/rewritten");
+
+ git_merge_head_free(branch_head);
+ git_merge_head_free(upstream_head);
+ git_reference_free(branch_ref);
+ git_reference_free(upstream_ref);
+}
+