Swap the order of the `git_graph_reachable_from_any` params len, array -> array, len
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
diff --git a/include/git2/graph.h b/include/git2/graph.h
index cd4897f..712ae47 100644
--- a/include/git2/graph.h
+++ b/include/git2/graph.h
@@ -68,8 +68,8 @@ GIT_EXTERN(int) git_graph_descendant_of(
GIT_EXTERN(int) git_graph_reachable_from_any(
git_repository *repo,
const git_oid *commit,
- size_t length,
- const git_oid descendant_array[]);
+ const git_oid descendant_array[],
+ size_t length);
/** @} */
GIT_END_DECL
diff --git a/src/graph.c b/src/graph.c
index 6efeb4a..35e914f 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -179,14 +179,14 @@ int git_graph_descendant_of(git_repository *repo, const git_oid *commit, const g
if (git_oid_equal(commit, ancestor))
return 0;
- return git_graph_reachable_from_any(repo, ancestor, 1, commit);
+ return git_graph_reachable_from_any(repo, ancestor, commit, 1);
}
int git_graph_reachable_from_any(
git_repository *repo,
const git_oid *commit_id,
- size_t length,
- const git_oid descendant_array[])
+ const git_oid descendant_array[],
+ size_t length)
{
git_revwalk *walk = NULL;
git_vector list;
diff --git a/tests/graph/reachable_from_any.c b/tests/graph/reachable_from_any.c
index 7dfd9dd..5c84164 100644
--- a/tests/graph/reachable_from_any.c
+++ b/tests/graph/reachable_from_any.c
@@ -45,11 +45,11 @@ void test_graph_reachable_from_any__returns_correct_result(void)
cl_assert_equal_i(
git_graph_reachable_from_any(
- repo, git_object_id(branchH1), 1, git_object_id(branchA1)),
+ repo, git_object_id(branchH1), git_object_id(branchA1), 1),
0);
cl_assert_equal_i(
git_graph_reachable_from_any(
- repo, git_object_id(branchH1), 1, git_object_id(branchA2)),
+ repo, git_object_id(branchH1), git_object_id(branchA2), 1),
0);
cl_git_pass(git_oid_cpy(&descendants[0], git_object_id(branchA1)));
@@ -60,10 +60,10 @@ void test_graph_reachable_from_any__returns_correct_result(void)
cl_git_pass(git_oid_cpy(&descendants[5], git_object_id(branchC2)));
cl_git_pass(git_oid_cpy(&descendants[6], git_object_id(branchH2)));
cl_assert_equal_i(
- git_graph_reachable_from_any(repo, git_object_id(branchH2), 6, descendants),
+ git_graph_reachable_from_any(repo, git_object_id(branchH2), descendants, 6),
0);
cl_assert_equal_i(
- git_graph_reachable_from_any(repo, git_object_id(branchH2), 7, descendants),
+ git_graph_reachable_from_any(repo, git_object_id(branchH2), descendants, 7),
1);
git_object_free(branchA1);
@@ -197,8 +197,8 @@ void test_graph_reachable_from_any__exhaustive(void)
actual_reachable = git_graph_reachable_from_any(
repo,
git_commit_id(parent_commit),
- n_descendants,
- descendants);
+ descendants,
+ n_descendants);
if (actual_reachable != expected_reachable) {
git_buf error_message_buf = GIT_BUF_INIT;
char parent_oidbuf[9] = {0}, child_oidbuf[9] = {0};