Exemple #1
0
int git_reference_list(
	git_strarray *array,
	git_repository *repo)
{
	git_vector ref_list;

	assert(array && repo);

	array->strings = NULL;
	array->count = 0;

	if (git_vector_init(&ref_list, 8, NULL) < 0)
		return -1;

	if (git_reference_foreach_name(
			repo, &cb__reflist_add, (void *)&ref_list) < 0) {
		git_vector_free(&ref_list);
		return -1;
	}

	array->strings = (char **)git_vector_detach(&array->count, NULL, &ref_list);

	return 0;
}
Exemple #2
0
int git_tag_list_match(git_strarray *tag_names, const char *pattern, git_repository *repo)
{
    int error;
    tag_filter_data filter;
    git_vector taglist;

    assert(tag_names && repo && pattern);

    if ((error = git_vector_init(&taglist, 8, NULL)) < 0)
        return error;

    filter.taglist = &taglist;
    filter.pattern = pattern;

    error = git_tag_foreach(repo, &tag_list_cb, (void *)&filter);

    if (error < 0)
        git_vector_free(&taglist);

    tag_names->strings =
        (char **)git_vector_detach(&tag_names->count, NULL, &taglist);

    return 0;
}