Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'cn/config-missing-path'

"git config --path $key" segfaulted on "[section] key" (a boolean
"true" spelled without "=", not "[section] key = true").

* cn/config-missing-path:
  config: don't segfault when given --path with a missing value
  • Loading branch information...
commit 0f76f976762d6a15a4af75db56208c8065492020 2 parents b4f3551 + 962c38e
@gitster gitster authored
Showing with 7 additions and 1 deletion.
  1. +2 −1  builtin/config.c
  2. +5 −0 t/t1300-repo-config.sh
View
3  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_;
View
5 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"

0 comments on commit 0f76f97

Please sign in to comment.
Something went wrong with that request. Please try again.