diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-11-25 18:35:46 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-11-25 18:35:46 -0800 |
commit | ccf1bb3ab65f968b412b17cfdd9613b1d7bc61b4 (patch) | |
tree | bfe4e20347194a060814e723b9c85fc4f8fb6c2f | |
parent | 326922fd20edd1ad4651052f7e22abed89c5dc4e (diff) | |
parent | 962c38eedd931a608b5e675f12a21569d9f4d39f (diff) | |
download | git-ccf1bb3ab65f968b412b17cfdd9613b1d7bc61b4.tar.gz |
Merge branch 'cn/config-missing-path' into maint
* cn/config-missing-path:
config: don't segfault when given --path with a missing value
-rw-r--r-- | builtin/config.c | 3 | ||||
-rwxr-xr-x | t/t1300-repo-config.sh | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/builtin/config.c b/builtin/config.c index e1c33e0691..505bbc7ddd 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -129,7 +129,8 @@ static int show_config(const char *key_, const char *value_, void *cb) else sprintf(value, "%d", v); } else if (types == TYPE_PATH) { - git_config_pathname(&vptr, key_, value_); + if (git_config_pathname(&vptr, key_, value_) < 0) + return -1; must_free_vptr = 1; } else if (value_) { vptr = value_; diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index e127f35db9..7c4c372e37 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -803,6 +803,11 @@ test_expect_success NOT_MINGW 'get --path copes with unset $HOME' ' test_cmp expect result ' +test_expect_success 'get --path barfs on boolean variable' ' + echo "[path]bool" >.git/config && + test_must_fail git config --get --path path.bool +' + cat > expect << EOF [quote] leading = " test" |