mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 06:20:56 +00:00
Merge pull request #2883 from urkud/reget-reader-pointer
Reinit `reader` pointer after reading included config file
This commit is contained in:
commit
0b2ee7c07c
@ -1284,6 +1284,7 @@ static int config_parse(git_strmap *values, diskfile_backend *cfg_file, struct r
|
|||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = config_parse(values, cfg_file, r, level, depth+1);
|
result = config_parse(values, cfg_file, r, level, depth+1);
|
||||||
r = git_array_get(cfg_file->readers, index);
|
r = git_array_get(cfg_file->readers, index);
|
||||||
|
reader = git_array_get(cfg_file->readers, reader_idx);
|
||||||
}
|
}
|
||||||
else if (result == GIT_ENOTFOUND) {
|
else if (result == GIT_ENOTFOUND) {
|
||||||
giterr_clear();
|
giterr_clear();
|
||||||
|
@ -102,3 +102,25 @@ void test_config_include__missing(void)
|
|||||||
|
|
||||||
git_config_free(cfg);
|
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);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user