diff options
Diffstat (limited to 'tests/t15-config.c')
| -rw-r--r-- | tests/t15-config.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/t15-config.c b/tests/t15-config.c index 04b2fdea3..23a1792d5 100644 --- a/tests/t15-config.c +++ b/tests/t15-config.c @@ -230,6 +230,26 @@ BEGIN_TEST(config10, "a repo's config overrides the global config") git_repository_free(repo); END_TEST +BEGIN_TEST(config11, "fall back to the global config") + git_repository *repo; + char home_orig[GIT_PATH_MAX]; + char *home; + git_config *cfg; + int num; + + home = getenv("HOME"); + strcpy(home_orig, home); + setenv("HOME", CONFIG_BASE, 1); + + must_pass(git_repository_open(&repo, REPOSITORY_FOLDER)); + must_pass(git_repository_config(&cfg, repo)); + setenv("HOME", home_orig, 1); + must_pass(git_config_get_int(cfg, "core.something", &num)); + must_be_true(num == 2); + git_config_free(cfg); + git_repository_free(repo); +END_TEST + BEGIN_SUITE(config) ADD_TEST(config0); ADD_TEST(config1); @@ -242,4 +262,5 @@ BEGIN_SUITE(config) ADD_TEST(config8); ADD_TEST(config9); ADD_TEST(config10); + ADD_TEST(config11); END_SUITE |
