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
7f7ebe13
Commit
7f7ebe13
authored
Aug 08, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1771 from nvloff/write_empty_config_value
config: allow setting empty string as value
parents
5e96f316
c57f6682
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
src/config_file.c
+3
-0
tests-clar/config/write.c
+17
-0
No files found.
src/config_file.c
View file @
7f7ebe13
...
...
@@ -1304,6 +1304,9 @@ static char *escape_value(const char *ptr)
assert
(
ptr
);
len
=
strlen
(
ptr
);
if
(
!
len
)
return
git__calloc
(
1
,
sizeof
(
char
));
git_buf_grow
(
&
buf
,
len
);
while
(
*
ptr
!=
'\0'
)
{
...
...
tests-clar/config/write.c
View file @
7f7ebe13
...
...
@@ -242,3 +242,20 @@ void test_config_write__can_set_a_value_to_NULL(void)
cl_git_sandbox_cleanup
();
}
void
test_config_write__can_set_an_empty_value
(
void
)
{
git_repository
*
repository
;
git_config
*
config
;
const
char
*
str
;
repository
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_git_pass
(
git_repository_config
(
&
config
,
repository
));
cl_git_pass
(
git_config_set_string
(
config
,
"core.somevar"
,
""
));
cl_git_pass
(
git_config_get_string
(
&
str
,
config
,
"core.somevar"
));
cl_assert_equal_s
(
str
,
""
);
git_config_free
(
config
);
cl_git_sandbox_cleanup
();
}
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