Commit f6dbf9c5 by Edward Thomson

tests: helpers for getting ints from configuration

parent 366973f3
......@@ -476,6 +476,25 @@ int cl_repo_get_bool(git_repository *repo, const char *cfg)
return val;
}
void cl_repo_set_int(git_repository *repo, const char *cfg, int value)
{
git_config *config;
cl_git_pass(git_repository_config(&config, repo));
cl_git_pass(git_config_set_int32(config, cfg, value));
git_config_free(config);
}
int cl_repo_get_int(git_repository *repo, const char *cfg)
{
int val = 0;
git_config *config;
cl_git_pass(git_repository_config(&config, repo));
if (git_config_get_int32(&val, config, cfg) < 0)
git_error_clear();
git_config_free(config);
return val;
}
void cl_repo_set_string(git_repository *repo, const char *cfg, const char *value)
{
git_config *config;
......
......@@ -231,6 +231,9 @@ void cl_repo_commit_from_index(
void cl_repo_set_bool(git_repository *repo, const char *cfg, int value);
int cl_repo_get_bool(git_repository *repo, const char *cfg);
void cl_repo_set_int(git_repository *repo, const char *cfg, int value);
int cl_repo_get_int(git_repository *repo, const char *cfg);
void cl_repo_set_string(git_repository *repo, const char *cfg, const char *value);
/* set up a fake "home" directory and set libgit2 GLOBAL search path.
......
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