diff options
author | Edward Thomson <ethomson@github.com> | 2016-12-20 15:32:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-20 15:32:49 +0000 |
commit | 8d7717c471aabb9e09ea0421f1dea487ad6af02c (patch) | |
tree | 413253fba8b89235a2bd29943ce431ae1faa296c /tests | |
parent | f91f170f0e334963473a0f1060d2b07fbe63abbf (diff) | |
parent | 9f09f290bbe49865f57cadb68883af0cd3b2cb71 (diff) | |
download | libgit2-8d7717c471aabb9e09ea0421f1dea487ad6af02c.tar.gz |
Merge pull request #4034 from libgit2/cmn/sysdir-no-reguess
sysdir: don't re-guess when using variable substitution
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/env.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/core/env.c b/tests/core/env.c index ee08258a6..1af0e6e5d 100644 --- a/tests/core/env.c +++ b/tests/core/env.c @@ -298,3 +298,24 @@ void test_core_env__2(void) git_buf_free(&path); git_buf_free(&found); } + +void test_core_env__substitution(void) +{ + git_buf buf = GIT_BUF_INIT, expected = GIT_BUF_INIT; + + /* Set it to something non-default so we have controllable values */ + cl_git_pass(git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, "/tmp/a")); + cl_git_pass(git_libgit2_opts(GIT_OPT_GET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, &buf)); + cl_assert_equal_s("/tmp/a", buf.ptr); + + git_buf_clear(&buf); + cl_git_pass(git_buf_join(&buf, GIT_PATH_LIST_SEPARATOR, "$PATH", "/tmp/b")); + cl_git_pass(git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, buf.ptr)); + cl_git_pass(git_libgit2_opts(GIT_OPT_GET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, &buf)); + + cl_git_pass(git_buf_join(&expected, GIT_PATH_LIST_SEPARATOR, "/tmp/a", "/tmp/b")); + cl_assert_equal_s(expected.ptr, buf.ptr); + + git_buf_free(&expected); + git_buf_free(&buf); +} |