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
f4a7652a
Commit
f4a7652a
authored
Aug 14, 2018
by
Nelson Elhage
Committed by
Patrick Steinhardt
Oct 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the test and comment.
(cherry picked from commit
6698e056
)
parent
ef523712
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
tests/config/read.c
+20
-2
No files found.
tests/config/read.c
View file @
f4a7652a
...
...
@@ -749,16 +749,34 @@ void test_config_read__bom(void)
git_buf_free
(
&
buf
);
}
static
int
read_nosection_cb
(
const
git_config_entry
*
entry
,
void
*
payload
)
{
int
*
seen
=
(
int
*
)
payload
;
if
(
strcmp
(
entry
->
name
,
"key"
)
==
0
)
{
(
*
seen
)
++
;
}
return
0
;
}
/* This would ideally issue a warning, if we had a way to do so. */
void
test_config_read__nosection
(
void
)
{
git_config
*
cfg
;
git_buf
buf
=
GIT_BUF_INIT
;
int
seen
=
0
;
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config-nosection"
)));
cl_git_pass
(
git_config_get_string_buf
(
&
buf
,
cfg
,
"key"
));
cl_assert_equal_s
(
buf
.
ptr
,
"value"
);
/*
* Given a key with no section, we do not allow reading it,
* but we do include it in an iteration over the config
* store. This appears to match how git's own APIs (and
* git-config(1)) behave.
*/
cl_git_fail_with
(
git_config_get_string_buf
(
&
buf
,
cfg
,
"key"
),
GIT_EINVALIDSPEC
);
cl_git_pass
(
git_config_foreach
(
cfg
,
read_nosection_cb
,
&
seen
));
cl_assert_equal_i
(
seen
,
1
);
git_buf_free
(
&
buf
);
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