summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-05-31 16:41:44 +0200
committerPatrick Steinhardt <ps@pks.im>2017-07-15 14:14:50 +0200
commit28c2cc3de33a382a5ca6858c418ecd541ab57aeb (patch)
treedafcd4a1acc9ecefbfa5e34ca391fb96acc686e6 /tests
parent83bcd3a1911c136b4ace33fecde889c347452718 (diff)
downloadlibgit2-28c2cc3de33a382a5ca6858c418ecd541ab57aeb.tar.gz
config_file: move reader into `config_read` only
Right now, we have multiple call sites which initialize a `reader` structure. As the structure is only actually used inside of `config_read`, we can instead just move the reader inside of the `config_read` function. Instead, we can just pass in the configuration file into `config_read`, which eases code readability.
Diffstat (limited to 'tests')
-rw-r--r--tests/config/include.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/config/include.c b/tests/config/include.c
index 2ce42bd8d..bcf8e19ee 100644
--- a/tests/config/include.c
+++ b/tests/config/include.c
@@ -133,3 +133,16 @@ void test_config_include__removing_include_removes_values(void)
cl_git_mkfile("top-level", "");
cl_git_fail(git_config_get_string_buf(&buf, cfg, "foo.bar"));
}
+
+void test_config_include__rewriting_include_refreshes_values(void)
+{
+ cl_git_mkfile("top-level", "[include]\npath = first\n[include]\npath = second");
+ cl_git_mkfile("first", "[first]\nfoo = bar");
+ cl_git_mkfile("second", "[second]\nfoo = bar");
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "top-level"));
+ cl_git_mkfile("first", "[first]\nother = value");
+ cl_git_fail(git_config_get_string_buf(&buf, cfg, "foo.bar"));
+ cl_git_pass(git_config_get_string_buf(&buf, cfg, "first.other"));
+ cl_assert_equal_s(buf.ptr, "value");
+}