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>2015-03-18 00:53:07 +0300
committerEdward Thomson <ethomson@microsoft.com>2015-04-20 23:22:39 +0300
commiteaf0d68830cc8fc56c92733a550ea5f6bc15101d (patch)
tree43cb07a2686a3dcc346c49a8dac03ad1aa52b9b5 /tests/rebase
parent49b3ddf2167156352eabce9a169fa6649b900631 (diff)
rebase: block rebase_commit with unstaged changes
Diffstat (limited to 'tests/rebase')
-rw-r--r--tests/rebase/merge.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c
index e9390567e..02c39609e 100644
--- a/tests/rebase/merge.c
+++ b/tests/rebase/merge.c
@@ -264,6 +264,41 @@ void test_rebase_merge__commit(void)
git_rebase_free(rebase);
}
+void test_rebase_merge__blocked_when_dirty(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;
+
+ 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));
+
+ cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL));
+
+ /* Allow untracked files */
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase));
+ cl_git_mkfile("rebase/untracked_file.txt", "This is untracked\n");
+ cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
+ NULL, NULL));
+
+ /* Do not allow unstaged */
+ cl_git_pass(git_rebase_next(&rebase_operation, rebase));
+ cl_git_mkfile("rebase/veal.txt", "This is an unstaged change\n");
+ cl_git_fail_with(GIT_EUNMERGED, git_rebase_commit(&commit_id, rebase, NULL, signature,
+ NULL, NULL));
+
+ 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);
+}
+
void test_rebase_merge__commit_updates_rewritten(void)
{
git_rebase *rebase;