summaryrefslogtreecommitdiff
path: root/tests-clar/checkout/crlf.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/crlf.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/crlf.c')
-rw-r--r--tests-clar/checkout/crlf.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/tests-clar/checkout/crlf.c b/tests-clar/checkout/crlf.c
index 38c0080d3..74da27652 100644
--- a/tests-clar/checkout/crlf.c
+++ b/tests-clar/checkout/crlf.c
@@ -24,30 +24,13 @@ void test_checkout_crlf__cleanup(void)
cl_git_sandbox_cleanup();
}
-#ifdef GIT_WIN32
-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);
-}
-#endif
-
void test_checkout_crlf__detect_crlf_autocrlf_false(void)
{
#ifdef GIT_WIN32
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
- set_core_autocrlf_to(false);
+ cl_repo_set_bool(g_repo, "core.autocrlf", false);
git_checkout_head(g_repo, &opts);
@@ -63,7 +46,7 @@ void test_checkout_crlf__autocrlf_false_index_size_is_unfiltered_size(void)
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
- set_core_autocrlf_to(false);
+ cl_repo_set_bool(g_repo, "core.autocrlf", false);
git_checkout_head(g_repo, &opts);
@@ -82,7 +65,7 @@ void test_checkout_crlf__detect_crlf_autocrlf_true(void)
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
- set_core_autocrlf_to(true);
+ cl_repo_set_bool(g_repo, "core.autocrlf", true);
git_checkout_head(g_repo, &opts);
@@ -98,7 +81,7 @@ void test_checkout_crlf__autocrlf_true_index_size_is_filtered_size(void)
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;
- set_core_autocrlf_to(true);
+ cl_repo_set_bool(g_repo, "core.autocrlf", true);
git_checkout_head(g_repo, &opts);