diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2013-03-08 02:11:34 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-03-09 15:45:18 +0100 |
| commit | 48bde2f1b62d24f3982382d520bfac887537641d (patch) | |
| tree | da7dde9bafe3725298d7de04e6b52f351cc6c054 /tests-clar/config/write.c | |
| parent | 92ebbe99c9b557aee3382f51ddf6dd6637ee2fe4 (diff) | |
| download | libgit2-48bde2f1b62d24f3982382d520bfac887537641d.tar.gz | |
config: don't allow passing NULL as a value to set
Passing NULL is non-sensical. The error message leaves to be desired,
though, as it leaks internal implementation details. Catch it at the
`git_config_set_string` level and set an appropriate error message.
Diffstat (limited to 'tests-clar/config/write.c')
| -rw-r--r-- | tests-clar/config/write.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests-clar/config/write.c b/tests-clar/config/write.c index 1b665cd19..d70612a97 100644 --- a/tests-clar/config/write.c +++ b/tests-clar/config/write.c @@ -228,3 +228,17 @@ void test_config_write__add_value_at_file_with_no_clrf_at_the_end(void) git_config_free(cfg); } + +void test_config_write__can_set_a_value_to_NULL(void) +{ + git_repository *repository; + git_config *config; + + repository = cl_git_sandbox_init("testrepo.git"); + + cl_git_pass(git_repository_config(&config, repository)); + cl_git_fail(git_config_set_string(config, "a.b.c", NULL)); + git_config_free(config); + + cl_git_sandbox_cleanup(); +} |
