]>
git.proxmox.com Git - libgit2.git/blob - tests/config/config_helpers.c
1 #include "clar_libgit2.h"
2 #include "config_helpers.h"
3 #include "repository.h"
5 void assert_config_entry_existence(
8 bool is_supposed_to_exist
)
14 cl_git_pass(git_repository_config__weakptr(&config
, repo
));
16 result
= git_config_get_string(&out
, config
, name
);
18 if (is_supposed_to_exist
)
21 cl_assert_equal_i(GIT_ENOTFOUND
, result
);
24 void assert_config_entry_value(
27 const char *expected_value
)
32 cl_git_pass(git_repository_config__weakptr(&config
, repo
));
34 cl_git_pass(git_config_get_string(&out
, config
, name
));
36 cl_assert_equal_s(expected_value
, out
);
39 static int count_config_entries_cb(
40 const git_config_entry
*entry
,
43 int *how_many
= (int *)payload
;
52 int count_config_entries_match(git_repository
*repo
, const char *pattern
)
57 cl_git_pass(git_repository_config(&config
, repo
));
59 cl_assert_equal_i(0, git_config_foreach_match(
60 config
, pattern
, count_config_entries_cb
, &how_many
));
62 git_config_free(config
);