Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2012-11-14 02:43:23 +0400
committerCarlos Martín Nieto <cmn@elego.de>2012-11-14 02:49:16 +0400
commit0da81d2b39290fe4d444953acb6d68795ed1ef42 (patch)
tree70f00cde763374e35bf214bcd50e5a39b3b098c7 /tests-clar/config
parent47db054df053fb09c8c92edaa0238af2a2605e65 (diff)
config: return an emtpy string when there is no value
Returning NULL for the string when we haven't signaled an error condition is counter-intuitive and causes unnecessary edge cases. Return an empty string when asking for a string value for a configuration variable such as '[section] var' to avoid these edge cases. If the distinction between no value and an empty value is needed, this can be retrieved from the entry directly. As a side-effect, this change stops the int parsing functions from segfaulting on such a variable.
Diffstat (limited to 'tests-clar/config')
-rw-r--r--tests-clar/config/read.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests-clar/config/read.c b/tests-clar/config/read.c
index a468a4d92..7b30b6e12 100644
--- a/tests-clar/config/read.c
+++ b/tests-clar/config/read.c
@@ -87,8 +87,10 @@ void test_config_read__lone_variable(void)
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config4")));
+ cl_git_fail(git_config_get_int32(&i, cfg, "some.section.variable"));
+
cl_git_pass(git_config_get_string(&str, cfg, "some.section.variable"));
- cl_assert(str == NULL);
+ cl_assert_equal_s(str, "");
cl_git_pass(git_config_get_bool(&i, cfg, "some.section.variable"));
cl_assert(i == 1);