Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
0b2ee7c0
Commit
0b2ee7c0
authored
Feb 13, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2883 from urkud/reget-reader-pointer
Reinit `reader` pointer after reading included config file
parents
3ca91107
17136538
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
src/config_file.c
+1
-0
tests/config/include.c
+22
-0
No files found.
src/config_file.c
View file @
0b2ee7c0
...
@@ -1284,6 +1284,7 @@ static int config_parse(git_strmap *values, diskfile_backend *cfg_file, struct r
...
@@ -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
();
...
...
tests/config/include.c
View file @
0b2ee7c0
...
@@ -102,3 +102,25 @@ void test_config_include__missing(void)
...
@@ -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]
\n
path = middle
\n
[foo]
\n
bar = baz"
);
cl_git_mkfile
(
"middle"
,
content
);
cl_git_mkfile
(
"bottom"
,
"[foo]
\n
bar2 = 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
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment