Skip to content

Commit 8d453f1

Browse files
committed
Swap the order of the git_graph_reachable_from_any params
len, array -> array, len
1 parent ce5400c commit 8d453f1

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

include/git2/graph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ GIT_EXTERN(int) git_graph_descendant_of(
6868
GIT_EXTERN(int) git_graph_reachable_from_any(
6969
git_repository *repo,
7070
const git_oid *commit,
71-
size_t length,
72-
const git_oid descendant_array[]);
71+
const git_oid descendant_array[],
72+
size_t length);
7373

7474
/** @} */
7575
GIT_END_DECL

src/graph.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ int git_graph_descendant_of(git_repository *repo, const git_oid *commit, const g
179179
if (git_oid_equal(commit, ancestor))
180180
return 0;
181181

182-
return git_graph_reachable_from_any(repo, ancestor, 1, commit);
182+
return git_graph_reachable_from_any(repo, ancestor, commit, 1);
183183
}
184184

185185
int git_graph_reachable_from_any(
186186
git_repository *repo,
187187
const git_oid *commit_id,
188-
size_t length,
189-
const git_oid descendant_array[])
188+
const git_oid descendant_array[],
189+
size_t length)
190190
{
191191
git_revwalk *walk = NULL;
192192
git_vector list;

tests/graph/reachable_from_any.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ void test_graph_reachable_from_any__returns_correct_result(void)
4545

4646
cl_assert_equal_i(
4747
git_graph_reachable_from_any(
48-
repo, git_object_id(branchH1), 1, git_object_id(branchA1)),
48+
repo, git_object_id(branchH1), git_object_id(branchA1), 1),
4949
0);
5050
cl_assert_equal_i(
5151
git_graph_reachable_from_any(
52-
repo, git_object_id(branchH1), 1, git_object_id(branchA2)),
52+
repo, git_object_id(branchH1), git_object_id(branchA2), 1),
5353
0);
5454

5555
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)
6060
cl_git_pass(git_oid_cpy(&descendants[5], git_object_id(branchC2)));
6161
cl_git_pass(git_oid_cpy(&descendants[6], git_object_id(branchH2)));
6262
cl_assert_equal_i(
63-
git_graph_reachable_from_any(repo, git_object_id(branchH2), 6, descendants),
63+
git_graph_reachable_from_any(repo, git_object_id(branchH2), descendants, 6),
6464
0);
6565
cl_assert_equal_i(
66-
git_graph_reachable_from_any(repo, git_object_id(branchH2), 7, descendants),
66+
git_graph_reachable_from_any(repo, git_object_id(branchH2), descendants, 7),
6767
1);
6868

6969
git_object_free(branchA1);
@@ -197,8 +197,8 @@ void test_graph_reachable_from_any__exhaustive(void)
197197
actual_reachable = git_graph_reachable_from_any(
198198
repo,
199199
git_commit_id(parent_commit),
200-
n_descendants,
201-
descendants);
200+
descendants,
201+
n_descendants);
202202
if (actual_reachable != expected_reachable) {
203203
git_buf error_message_buf = GIT_BUF_INIT;
204204
char parent_oidbuf[9] = {0}, child_oidbuf[9] = {0};

0 commit comments

Comments
 (0)