summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-06-24 12:19:30 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-06-24 12:19:30 (GMT)
commitacb70149bc5e9b9d99631a0cb59e7c2f80e92ddd (patch)
treecc94c697b8150307ae0510743c3ddb8418e1bf01
parent0ec2f6b7392f8f041fd48f824bbf22c4dd13ac40 (diff)
downloadgit-acb70149bc5e9b9d99631a0cb59e7c2f80e92ddd.zip
git-acb70149bc5e9b9d99631a0cb59e7c2f80e92ddd.tar.gz
git-acb70149bc5e9b9d99631a0cb59e7c2f80e92ddd.tar.bz2
repo-config: fix printing of bool
When a bool variable appears without any value, it means true. However, replacing the NULL value with an empty string, an earlier commit f067a13745fbeae1aa357876348a00e5edd0a629 broke show-config. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--repo-config.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/repo-config.c b/repo-config.c
index ab8f1af..743f02b 100644
--- a/repo-config.c
+++ b/repo-config.c
@@ -29,16 +29,13 @@ static int show_config(const char* key_, const char* value_)
const char *vptr = value;
int dup_error = 0;
- if (value_ == NULL)
- value_ = "";
-
if (!use_key_regexp && strcmp(key_, key))
return 0;
if (use_key_regexp && regexec(key_regexp, key_, 0, NULL, 0))
return 0;
if (regexp != NULL &&
(do_not_match ^
- regexec(regexp, value_, 0, NULL, 0)))
+ regexec(regexp, (value_?value_:""), 0, NULL, 0)))
return 0;
if (show_keys)
@@ -46,11 +43,11 @@ static int show_config(const char* key_, const char* value_)
if (seen && !do_all)
dup_error = 1;
if (type == T_INT)
- sprintf(value, "%d", git_config_int(key_, value_));
+ sprintf(value, "%d", git_config_int(key_, value_?value_:""));
else if (type == T_BOOL)
vptr = git_config_bool(key_, value_) ? "true" : "false";
else
- vptr = value_;
+ vptr = value_?value_:"";
seen++;
if (dup_error) {
error("More than one value for the key %s: %s",