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
6ac18625
Commit
6ac18625
authored
Sep 09, 2020
by
Sven Strickroth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix config file parsing with multi line values containing quoted parts
Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent
1e987525
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletions
+16
-1
src/config_parse.c
+1
-1
tests/config/stress.c
+5
-0
tests/resources/config/config12
+10
-0
No files found.
src/config_parse.c
View file @
6ac18625
...
...
@@ -451,7 +451,7 @@ static int parse_variable(git_config_parser *reader, char **var_name, char **var
git_buf_attach
(
&
multi_value
,
value
,
0
);
value
=
NULL
;
if
(
parse_multiline_variable
(
reader
,
&
multi_value
,
quote_count
)
<
0
||
if
(
parse_multiline_variable
(
reader
,
&
multi_value
,
quote_count
%
2
)
<
0
||
git_buf_oom
(
&
multi_value
))
{
error
=
-
1
;
git_buf_dispose
(
&
multi_value
);
...
...
tests/config/stress.c
View file @
6ac18625
...
...
@@ -59,6 +59,11 @@ void test_config_stress__comments(void)
assert_config_value
(
config
,
"some.section.multi"
,
"hi, this is a ; multiline comment # with ;
\n
special chars and other stuff !@#"
);
assert_config_value
(
config
,
"some.section.multi2"
,
"good, this is a ; multiline comment # with ;
\n
special chars and other stuff !@#"
);
assert_config_value
(
config
,
"some.section.back"
,
"this is
\b
a phrase"
);
assert_config_value
(
config
,
"some.section.dollar"
,
"some $sign"
);
assert_config_value
(
config
,
"some.section.multiquotes"
,
"!ls x ls # comment2 $HOME"
);
assert_config_value
(
config
,
"some.section.multiquotes2"
,
"!ls x ls
\"
# comment2 $HOME
\"
"
);
assert_config_value
(
config
,
"some.section.multiquotes3"
,
"hi # ho there are # more quotes"
);
assert_config_value
(
config
,
"some.section.quotecomment"
,
"hi # ho there are # more"
);
git_config_free
(
config
);
}
...
...
tests/resources/config/config12
View file @
6ac18625
...
...
@@ -11,3 +11,13 @@ and other stuff !@#"
multiline comment # with ;\n special chars \
and other stuff !@#" #^^^
back = "this is \ba phrase"
dollar = some $sign
multiquotes = !ls "x" \
ls "# comment2" \
$HOME
multiquotes2 = !ls "x" \
ls "\"# comment2" \
$HOME\"
multiquotes3 = hi "# ho" there "are #" more \
quotes
quotecomment = hi "# ho" there "are #" more # and a real comment
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