summaryrefslogtreecommitdiff
path: root/tests/rebase/iterator.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-02-15 17:16:00 +0000
committerEdward Thomson <ethomson@github.com>2016-02-15 19:27:06 +0000
commitf28bae0c380467409515ffd25247f3204dcc4019 (patch)
tree437cafaa9d8afc0b59c6b63bd5d5cf068fc52fe7 /tests/rebase/iterator.c
parent5a296ad07ea5536a0ac2f17921f2839612d838d3 (diff)
downloadlibgit2-f28bae0c380467409515ffd25247f3204dcc4019.tar.gz
rebase: persist a single in-memory index
When performing an in-memory rebase, keep a single index for the duration, so that callers have the expected index lifecycle and do not hold on to an index that is free'd out from under them.
Diffstat (limited to 'tests/rebase/iterator.c')
-rw-r--r--tests/rebase/iterator.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/rebase/iterator.c b/tests/rebase/iterator.c
index e761d39d3..db57b0a83 100644
--- a/tests/rebase/iterator.c
+++ b/tests/rebase/iterator.c
@@ -13,7 +13,8 @@ void test_rebase_iterator__initialize(void)
{
repo = cl_git_sandbox_init("rebase");
cl_git_pass(git_repository_index(&_index, repo));
- cl_git_pass(git_signature_now(&signature, "Rebaser", "rebaser@rebaser.rb"));
+ cl_git_pass(git_signature_new(&signature, "Rebaser",
+ "rebaser@rebaser.rb", 1405694510, 0));
}
void test_rebase_iterator__cleanup(void)
@@ -53,7 +54,7 @@ void test_iterator(bool inmemory)
git_reference *branch_ref, *upstream_ref;
git_annotated_commit *branch_head, *upstream_head;
git_rebase_operation *rebase_operation;
- git_oid commit_id;
+ git_oid commit_id, expected_id;
int error;
opts.inmemory = inmemory;
@@ -77,16 +78,25 @@ void test_iterator(bool inmemory)
NULL, NULL));
test_operations(rebase, 0);
+ git_oid_fromstr(&expected_id, "776e4c48922799f903f03f5f6e51da8b01e4cce0");
+ cl_assert_equal_oid(&expected_id, &commit_id);
+
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
test_operations(rebase, 1);
+ git_oid_fromstr(&expected_id, "ba1f9b4fd5cf8151f7818be2111cc0869f1eb95a");
+ cl_assert_equal_oid(&expected_id, &commit_id);
+
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
test_operations(rebase, 2);
+ git_oid_fromstr(&expected_id, "948b12fe18b84f756223a61bece4c307787cd5d4");
+ cl_assert_equal_oid(&expected_id, &commit_id);
+
if (!inmemory) {
git_rebase_free(rebase);
cl_git_pass(git_rebase_open(&rebase, repo, NULL));
@@ -97,11 +107,17 @@ void test_iterator(bool inmemory)
NULL, NULL));
test_operations(rebase, 3);
+ git_oid_fromstr(&expected_id, "d9d5d59d72c9968687f9462578d79878cd80e781");
+ cl_assert_equal_oid(&expected_id, &commit_id);
+
cl_git_pass(git_rebase_next(&rebase_operation, rebase));
cl_git_pass(git_rebase_commit(&commit_id, rebase, NULL, signature,
NULL, NULL));
test_operations(rebase, 4);
+ git_oid_fromstr(&expected_id, "9cf383c0a125d89e742c5dec58ed277dd07588b3");
+ cl_assert_equal_oid(&expected_id, &commit_id);
+
cl_git_fail(error = git_rebase_next(&rebase_operation, rebase));
cl_assert_equal_i(GIT_ITEROVER, error);
test_operations(rebase, 4);