diff options
| author | Patrick Steinhardt <ps@pks.im> | 2017-05-31 16:41:44 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-07-15 14:14:50 +0200 |
| commit | 28c2cc3de33a382a5ca6858c418ecd541ab57aeb (patch) | |
| tree | dafcd4a1acc9ecefbfa5e34ca391fb96acc686e6 /tests | |
| parent | 83bcd3a1911c136b4ace33fecde889c347452718 (diff) | |
| download | libgit2-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.c | 13 |
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"); +} |
