summaryrefslogtreecommitdiff
path: root/tests-clar/checkout/index.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-22 14:27:56 -0700
committerRussell Belfer <rb@github.com>2013-03-22 14:27:56 -0700
commit1323c6d18049163fc81e5e246e7d4e120c8de03a (patch)
treea75d2a576d38890a8c009b299ec2cb744d571282 /tests-clar/checkout/index.c
parent3ba01362437102501a173b9fe072a5690358baa0 (diff)
downloadlibgit2-1323c6d18049163fc81e5e246e7d4e120c8de03a.tar.gz
Add cl_repo_set_bool and cleanup tests
This adds a helper function for the cases where you want to quickly set a single boolean config value for a repository. This allowed me to remove a lot of code.
Diffstat (limited to 'tests-clar/checkout/index.c')
-rw-r--r--tests-clar/checkout/index.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/tests-clar/checkout/index.c b/tests-clar/checkout/index.c
index e8a61ca3f..3976dd20e 100644
--- a/tests-clar/checkout/index.c
+++ b/tests-clar/checkout/index.c
@@ -92,21 +92,6 @@ void test_checkout_index__honor_the_specified_pathspecs(void)
test_file_contents("./testrepo/new.txt", "my new file\n");
}
-static void set_config_entry_to(const char *entry_name, bool value)
-{
- git_config *cfg;
-
- cl_git_pass(git_repository_config(&cfg, g_repo));
- cl_git_pass(git_config_set_bool(cfg, entry_name, value));
-
- git_config_free(cfg);
-}
-
-static void set_core_autocrlf_to(bool value)
-{
- set_config_entry_to("core.autocrlf", value);
-}
-
void test_checkout_index__honor_the_gitattributes_directives(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
@@ -115,7 +100,7 @@ void test_checkout_index__honor_the_gitattributes_directives(void)
"new.txt text eol=lf\n";
cl_git_mkfile("./testrepo/.gitattributes", attributes);
- set_core_autocrlf_to(false);
+ cl_repo_set_bool(g_repo, "core.autocrlf", false);
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
@@ -133,7 +118,7 @@ void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
const char *expected_readme_text = "hey there\r\n";
cl_git_pass(p_unlink("./testrepo/.gitattributes"));
- set_core_autocrlf_to(true);
+ cl_repo_set_bool(g_repo, "core.autocrlf", true);
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
@@ -143,16 +128,11 @@ void test_checkout_index__honor_coreautocrlf_setting_set_to_true(void)
#endif
}
-static void set_repo_symlink_handling_cap_to(bool value)
-{
- set_config_entry_to("core.symlinks", value);
-}
-
void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
- set_repo_symlink_handling_cap_to(true);
+ cl_repo_set_bool(g_repo, "core.symlinks", true);
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
@@ -178,7 +158,7 @@ void test_checkout_index__honor_coresymlinks_setting_set_to_false(void)
{
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
- set_repo_symlink_handling_cap_to(false);
+ cl_repo_set_bool(g_repo, "core.symlinks", false);
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
@@ -372,7 +352,7 @@ void test_checkout_index__wont_notify_of_expected_line_ending_changes(void)
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
cl_git_pass(p_unlink("./testrepo/.gitattributes"));
- set_core_autocrlf_to(true);
+ cl_repo_set_bool(g_repo, "core.autocrlf", true);
cl_git_mkfile("./testrepo/new.txt", "my new file\r\n");