diff options
author | Anurag Gupta <anugupta@microsoft.com> | 2014-04-01 02:15:32 +0400 |
---|---|---|
committer | Anurag Gupta <anugupta@microsoft.com> | 2014-04-01 02:15:32 +0400 |
commit | 3bc3d797611fccdf7a15cafafbb965b37fbb03f1 (patch) | |
tree | c3aa49509a5e99678a6d9f83e0b6221c7f2d4faf /tests/revwalk | |
parent | fad04120275925257a93312a3e05af64e9d17090 (diff) |
No need to find merge base.
Diffstat (limited to 'tests/revwalk')
-rw-r--r-- | tests/revwalk/basic.c | 79 |
1 files changed, 75 insertions, 4 deletions
diff --git a/tests/revwalk/basic.c b/tests/revwalk/basic.c index 7e08c1840..b015db18b 100644 --- a/tests/revwalk/basic.c +++ b/tests/revwalk/basic.c @@ -160,7 +160,7 @@ void test_revwalk_basic__glob_heads(void) } /* git log --branches --oneline | wc -l => 14 */ - cl_assert(i == 14); + cl_assert_equal_i(i, 14); } void test_revwalk_basic__glob_heads_with_invalid(void) @@ -194,7 +194,7 @@ void test_revwalk_basic__push_head(void) } /* git log HEAD --oneline | wc -l => 7 */ - cl_assert(i == 7); + cl_assert_equal_i(i, 7); } void test_revwalk_basic__push_head_hide_ref(void) @@ -212,7 +212,7 @@ void test_revwalk_basic__push_head_hide_ref(void) } /* git log HEAD --oneline --not refs/heads/packed-test | wc -l => 4 */ - cl_assert(i == 4); + cl_assert_equal_i(i, 4); } void test_revwalk_basic__push_head_hide_ref_nobase(void) @@ -230,7 +230,78 @@ void test_revwalk_basic__push_head_hide_ref_nobase(void) } /* git log HEAD --oneline --not refs/heads/packed | wc -l => 7 */ - cl_assert(i == 7); + cl_assert_equal_i(i, 7); +} + +/* +* $ git rev-list HEAD 5b5b02 ^refs/heads/packed-test +* a65fedf39aefe402d3bb6e24df4d4f5fe4547750 +* be3563ae3f795b2b4353bcce3a527ad0a4f7f644 +* c47800c7266a2be04c571c04d5a6614691ea99bd +* 9fd738e8f7967c078dceed8190330fc8648ee56a + +* $ git log HEAD 5b5b02 --oneline --not refs/heads/packed-test | wc -l => 4 +* a65fedf +* be3563a Merge branch 'br2' +* c47800c branch commit one +* 9fd738e a fourth commit +*/ +void test_revwalk_basic__multiple_push_1(void) +{ + int i = 0; + git_oid oid; + + revwalk_basic_setup_walk(NULL); + + cl_git_pass(git_revwalk_push_head(_walk)); + + cl_git_pass(git_revwalk_hide_ref(_walk, "refs/heads/packed-test")); + + cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644")); + cl_git_pass(git_revwalk_push(_walk, &oid)); + + while (git_revwalk_next(&oid, _walk) == 0) + i++; + + cl_assert_equal_i(i, 4); +} + +/* +* Difference between test_revwalk_basic__multiple_push_1 and +* test_revwalk_basic__multiple_push_2 is in the order reference +* refs/heads/packed-test and commit 5b5b02 are pushed. +* revwalk should return same commits in both the tests. + +* $ git rev-list 5b5b02 HEAD ^refs/heads/packed-test +* a65fedf39aefe402d3bb6e24df4d4f5fe4547750 +* be3563ae3f795b2b4353bcce3a527ad0a4f7f644 +* c47800c7266a2be04c571c04d5a6614691ea99bd +* 9fd738e8f7967c078dceed8190330fc8648ee56a + +* $ git log 5b5b02 HEAD --oneline --not refs/heads/packed-test | wc -l => 4 +* a65fedf +* be3563a Merge branch 'br2' +* c47800c branch commit one +* 9fd738e a fourth commit +*/ +void test_revwalk_basic__multiple_push_2(void) +{ + int i = 0; + git_oid oid; + + revwalk_basic_setup_walk(NULL); + + cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644")); + cl_git_pass(git_revwalk_push(_walk, &oid)); + + cl_git_pass(git_revwalk_hide_ref(_walk, "refs/heads/packed-test")); + + cl_git_pass(git_revwalk_push_head(_walk)); + + while (git_revwalk_next(&oid, _walk) == 0) + i++; + + cl_assert_equal_i(i, 4); } void test_revwalk_basic__disallow_non_commit(void) |