Ejemplo n.º 1
0
static int test_walk_only(git_revwalk *walk,
		const int possible_results[][commit_count], int results_count)
{
	git_oid oid;
	int i;
	int result_array[commit_count];

	for (i = 0; i < commit_count; ++i)
		result_array[i] = -1;

	i = 0;
	while (git_revwalk_next(&oid, walk) == 0) {
		result_array[i++] = get_commit_index(&oid);
		/*{
			char str[GIT_OID_HEXSZ+1];
			git_oid_fmt(str, &oid);
			str[GIT_OID_HEXSZ] = 0;
			printf("  %d) %s\n", i, str);
		}*/
	}

	for (i = 0; i < results_count; ++i)
		if (memcmp(possible_results[i],
				result_array, result_bytes) == 0)
			return 0;

	return GIT_ERROR;
}
Ejemplo n.º 2
0
static int test_walk(git_revwalk *walk, const git_oid *root,
		int flags, const int possible_results[][6], int results_count)
{
	git_oid oid;

	int i;
	int result_array[commit_count];

	git_revwalk_sorting(walk, flags);
	git_revwalk_push(walk, root);

	for (i = 0; i < commit_count; ++i)
		result_array[i] = -1;

	i = 0;

	while (git_revwalk_next(&oid, walk) == GIT_SUCCESS) {
		result_array[i++] = get_commit_index(&oid);
		/*{
			char str[41];
			git_oid_fmt(str, &oid);
			str[40] = 0;
			printf("  %d) %s\n", i, str);
		}*/
	}

	for (i = 0; i < results_count; ++i) 
		if (memcmp(possible_results[i],
				result_array, result_bytes) == 0)
			return GIT_SUCCESS;

	return GIT_ERROR;
}