summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-03-29 11:23:29 +0100
committerPatrick Steinhardt <ps@pks.im>2019-03-29 12:55:17 +0100
commit8cf3fd93a17fe8e69bc541e3696a946be409291c (patch)
tree39a38e81605e4f8040512b9d4112d5c93d02c4c2
parentb3ba2e716b3edbf1453b228bae21c0bd3389e72a (diff)
downloadlibgit2-8cf3fd93a17fe8e69bc541e3696a946be409291c.tar.gz
tests: config: assure that we can read symlinked global configuration
According to reports, libgit2 is unable to read a global configuration file that is simply a symlink to the real configuration. Write a (succeeding) test that shows that libgit2 _is_ correctly able to do so.
-rw-r--r--tests/config/global.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/config/global.c b/tests/config/global.c
index 21879199e..647a110e3 100644
--- a/tests/config/global.c
+++ b/tests/config/global.c
@@ -58,6 +58,23 @@ void test_config_global__open_global(void)
git_config_free(cfg);
}
+void test_config_global__open_symlinked_global(void)
+{
+#ifndef GIT_WIN32
+ git_config *cfg;
+ int32_t value;
+
+ cl_git_mkfile("home/.gitconfig.linked", "[global]\n test = 4567\n");
+ cl_must_pass(symlink(".gitconfig.linked", "home/.gitconfig"));
+
+ cl_git_pass(git_config_open_default(&cfg));
+ cl_git_pass(git_config_get_int32(&value, cfg, "global.test"));
+ cl_assert_equal_i(4567, value);
+
+ git_config_free(cfg);
+#endif
+}
+
void test_config_global__open_xdg(void)
{
git_config *cfg, *xdg, *selected;