diff options
author | lhchavez <lhchavez@lhchavez.com> | 2021-07-27 13:00:31 -0700 |
---|---|---|
committer | lhchavez <lhchavez@lhchavez.com> | 2021-07-27 13:00:31 -0700 |
commit | 8d453f16385c04abfba0211f1e7fb1621f26d609 (patch) | |
tree | 8198be68b85ccf4d2e79a6a48d530e13c4fd46e1 | |
parent | ce5400cdc7cc52ace295a9fbd3cd7a6e7c63be34 (diff) | |
download | libgit2-8d453f16385c04abfba0211f1e7fb1621f26d609.tar.gz |
Swap the order of the `git_graph_reachable_from_any` params
len, array -> array, len
-rw-r--r-- | include/git2/graph.h | 4 | ||||
-rw-r--r-- | src/graph.c | 6 | ||||
-rw-r--r-- | tests/graph/reachable_from_any.c | 12 |
3 files changed, 11 insertions, 11 deletions
diff --git a/include/git2/graph.h b/include/git2/graph.h index cd4897fef..712ae474a 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 6efeb4a53..35e914f74 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 7dfd9ddd2..5c8416499 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}; |