Commit b337814e70a836fe6611df4a10032fd01ed713a3

Scott J. Goldman 2012-12-09T21:04:32

Fix no_common_ancestor test for ahead_behind count Ahead-behind count is still a valid operation, even if the two commits don't have a common merge-base. The old implementation was buggy, so it returned ENOTFOUND. Fixed now.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/tests-clar/revwalk/mergebase.c b/tests-clar/revwalk/mergebase.c
index 9707d42..8adf5fb 100644
--- a/tests-clar/revwalk/mergebase.c
+++ b/tests-clar/revwalk/mergebase.c
@@ -115,10 +115,9 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
 
 	cl_assert_equal_i(GIT_ENOTFOUND, error);
 
-	cl_git_fail(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
-	cl_git_fail(error);
-
-	cl_assert_equal_i(GIT_ENOTFOUND, error);
+	cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
+	cl_assert_equal_i(2, ahead);
+	cl_assert_equal_i(4, behind);
 }
 
 void test_revwalk_mergebase__no_off_by_one_missing(void)