Commit 2932c882 by Greg Price

revwalk: refactor tests a bit

Signed-off-by: Greg Price <price@mit.edu>
parent 06e6eab0
...@@ -56,22 +56,17 @@ static int get_commit_index(git_oid *raw_oid) ...@@ -56,22 +56,17 @@ static int get_commit_index(git_oid *raw_oid)
return -1; return -1;
} }
static int test_walk(git_revwalk *walk, const git_oid *root, static int test_walk_only(git_revwalk *walk,
int flags, const int possible_results[][6], int results_count) const int possible_results[][commit_count], int results_count)
{ {
git_oid oid; git_oid oid;
int i; int i;
int result_array[commit_count]; int result_array[commit_count];
git_revwalk_sorting(walk, flags);
git_revwalk_push(walk, root);
for (i = 0; i < commit_count; ++i) for (i = 0; i < commit_count; ++i)
result_array[i] = -1; result_array[i] = -1;
i = 0; i = 0;
while (git_revwalk_next(&oid, walk) == 0) { while (git_revwalk_next(&oid, walk) == 0) {
result_array[i++] = get_commit_index(&oid); result_array[i++] = get_commit_index(&oid);
/*{ /*{
...@@ -90,6 +85,15 @@ static int test_walk(git_revwalk *walk, const git_oid *root, ...@@ -90,6 +85,15 @@ static int test_walk(git_revwalk *walk, const git_oid *root,
return GIT_ERROR; return GIT_ERROR;
} }
static int test_walk(git_revwalk *walk, const git_oid *root,
int flags, const int possible_results[][6], int results_count)
{
git_revwalk_sorting(walk, flags);
git_revwalk_push(walk, root);
return test_walk_only(walk, possible_results, results_count);
}
static git_repository *_repo; static git_repository *_repo;
static git_revwalk *_walk; static git_revwalk *_walk;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment