Skip to content

Commit 8cf3fd9

Browse files
committed
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.
1 parent b3ba2e7 commit 8cf3fd9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/config/global.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ void test_config_global__open_global(void)
5858
git_config_free(cfg);
5959
}
6060

61+
void test_config_global__open_symlinked_global(void)
62+
{
63+
#ifndef GIT_WIN32
64+
git_config *cfg;
65+
int32_t value;
66+
67+
cl_git_mkfile("home/.gitconfig.linked", "[global]\n test = 4567\n");
68+
cl_must_pass(symlink(".gitconfig.linked", "home/.gitconfig"));
69+
70+
cl_git_pass(git_config_open_default(&cfg));
71+
cl_git_pass(git_config_get_int32(&value, cfg, "global.test"));
72+
cl_assert_equal_i(4567, value);
73+
74+
git_config_free(cfg);
75+
#endif
76+
}
77+
6178
void test_config_global__open_xdg(void)
6279
{
6380
git_config *cfg, *xdg, *selected;

0 commit comments

Comments
 (0)