Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury G. Kudryashov <urkud@urkud.name>2015-02-09 19:40:22 +0300
committerYury G. Kudryashov <urkud@urkud.name>2015-02-13 00:15:16 +0300
commit3ea78f241fb0c77822d75211752b4a1d4f299ed7 (patch)
tree2da2f8de95638aabf08d5489905b0dd99acf8dc9 /tests/config
parentb703049c6189fec223896999b9cf5d78efcb08d7 (diff)
Add test for include.path inside included config
It fails at least on my computer, though it may depend on some unpredictable factors (say, will realloc() extend the memory segment in place, or it will allocate new memory).
Diffstat (limited to 'tests/config')
-rw-r--r--tests/config/include.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/config/include.c b/tests/config/include.c
index 0a931342a..8232af489 100644
--- a/tests/config/include.c
+++ b/tests/config/include.c
@@ -102,3 +102,25 @@ void test_config_include__missing(void)
git_config_free(cfg);
}
+
+#define replicate10(s) s s s s s s s s s s
+void test_config_include__depth2(void)
+{
+ git_config *cfg;
+ const char *str;
+ const char *content = "[include]\n" replicate10(replicate10("path=bottom\n"));
+
+ cl_git_mkfile("top-level", "[include]\npath = middle\n[foo]\nbar = baz");
+ cl_git_mkfile("middle", content);
+ cl_git_mkfile("bottom", "[foo]\nbar2 = baz2");
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "top-level"));
+
+ cl_git_pass(git_config_get_string(&str, cfg, "foo.bar"));
+ cl_assert_equal_s(str, "baz");
+
+ cl_git_pass(git_config_get_string(&str, cfg, "foo.bar2"));
+ cl_assert_equal_s(str, "baz2");
+
+ git_config_free(cfg);
+}