Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8519623

Browse files
committed
Add test case
1 parent 1d0bed9 commit 8519623

File tree

8 files changed

+30
-0
lines changed

8 files changed

+30
-0
lines changed

tests/resources/redundant.git/HEAD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ref: refs/heads/master

tests/resources/redundant.git/config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[core]
2+
repositoryformatversion = 0
3+
filemode = true
4+
bare = true
5+
logallrefupdates = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
P pack-3d944c0c5bcb6b16209af847052c6ff1a521529d.pack
2+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# pack-refs with: peeled fully-peeled
2+
e18fa2788e9c4e12d83150808a31dfbfb1ae364f refs/heads/master
3+
91f4b95df4a59504a9813ba66912562931d990e3 refs/heads/ref2/ref28

tests/resources/redundant.git/refs/.gitkeep

Whitespace-only changes.

tests/revwalk/mergebase.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,3 +492,22 @@ void test_revwalk_mergebase__octopus_merge_branch(void)
492492
*
493493
* a
494494
*/
495+
496+
void test_revwalk_mergebase__remove_redundant(void)
497+
{
498+
git_repository *repo;
499+
git_oid one, two, base;
500+
git_oidarray result = {NULL, 0};
501+
502+
cl_git_pass(git_repository_open(&repo, cl_fixture("redundant.git")));
503+
504+
cl_git_pass(git_oid_fromstr(&one, "d89137c93ba1ee749214ff4ce52ae9137bc833f9"));
505+
cl_git_pass(git_oid_fromstr(&two, "91f4b95df4a59504a9813ba66912562931d990e3"));
506+
cl_git_pass(git_oid_fromstr(&base, "6cb1f2352d974e1c5a776093017e8772416ac97a"));
507+
508+
cl_git_pass(git_merge_bases(&result, repo, &one, &two));
509+
cl_assert_equal_i(1, result.count);
510+
cl_assert_equal_oid(&base, &result.ids[0]);
511+
512+
git_repository_free(repo);
513+
}

0 commit comments

Comments
 (0)