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
36cf1db2
Commit
36cf1db2
authored
Sep 09, 2020
by
Sven Strickroth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support empty values for git_config_get_mapped and git_config_lookup_map_value
Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent
86d04918
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
src/config.c
+1
-5
tests/config/read.c
+3
-1
No files found.
src/config.c
View file @
36cf1db2
...
...
@@ -1227,9 +1227,6 @@ int git_config_lookup_map_value(
{
size_t
i
;
if
(
!
value
)
goto
fail_parse
;
for
(
i
=
0
;
i
<
map_n
;
++
i
)
{
const
git_configmap
*
m
=
maps
+
i
;
...
...
@@ -1252,7 +1249,7 @@ int git_config_lookup_map_value(
break
;
case
GIT_CONFIGMAP_STRING
:
if
(
strcasecmp
(
value
,
m
->
str_match
)
==
0
)
{
if
(
value
&&
strcasecmp
(
value
,
m
->
str_match
)
==
0
)
{
*
out
=
m
->
map_value
;
return
0
;
}
...
...
@@ -1260,7 +1257,6 @@ int git_config_lookup_map_value(
}
}
fail_parse:
git_error_set
(
GIT_ERROR_CONFIG
,
"failed to map '%s'"
,
value
);
return
-
1
;
}
...
...
tests/config/read.c
View file @
36cf1db2
...
...
@@ -955,11 +955,13 @@ void test_config_read__get_mapped(void)
cl_git_mkfile
(
"./testconfig"
,
"[header]
\n
key1 = 1
\n
key2 = true
\n
key3
\n
key4 = always
\n
key5 = false
\n
key6 = 0
\n
key7 = never
\n
"
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"./testconfig"
));
// check
ap
rsing bool and string
// check
pa
rsing bool and string
cl_git_pass
(
git_config_get_mapped
(
&
val
,
cfg
,
"header.key1"
,
_test_map1
,
ARRAY_SIZE
(
_test_map1
)));
cl_assert_equal_i
(
val
,
MAP_TRUE
);
cl_git_pass
(
git_config_get_mapped
(
&
val
,
cfg
,
"header.key2"
,
_test_map1
,
ARRAY_SIZE
(
_test_map1
)));
cl_assert_equal_i
(
val
,
MAP_TRUE
);
cl_git_pass
(
git_config_get_mapped
(
&
val
,
cfg
,
"header.key3"
,
_test_map1
,
ARRAY_SIZE
(
_test_map1
)));
cl_assert_equal_i
(
val
,
MAP_TRUE
);
cl_git_pass
(
git_config_get_mapped
(
&
val
,
cfg
,
"header.key4"
,
_test_map1
,
ARRAY_SIZE
(
_test_map1
)));
cl_assert_equal_i
(
val
,
MAP_ALWAYS
);
...
...
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