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>
Junio C Hamano committed
Jun 24, 2006 at 05:19 UTC
acb70149bc5e9b9d99631a0cb59e7c2f80e92ddd
1 file changed
+3
-6
repo-config.c
+3
-6
@@ -29,16 +29,13 @@ static int show_config(const char* key_, const char* value_)
29
const char *vptr = value;
30
int dup_error = 0;
31
32
- if (value_ == NULL)
33
- value_ = "";
34
-
32
if (!use_key_regexp && strcmp(key_, key))
33
return 0;
34
if (use_key_regexp && regexec(key_regexp, key_, 0, NULL, 0))
35
return 0;
36
if (regexp != NULL &&
37
(do_not_match ^
41
- regexec(regexp, value_, 0, NULL, 0)))
38
+ regexec(regexp, (value_?value_:""), 0, NULL, 0)))
39
return 0;
40
41
if (show_keys)
@@ -46,11 +43,11 @@ static int show_config(const char* key_, const char* value_)
43
if (seen && !do_all)
44
dup_error = 1;
45
if (type == T_INT)
49
- sprintf(value, "%d", git_config_int(key_, value_));
46
+ sprintf(value, "%d", git_config_int(key_, value_?value_:""));
47
else if (type == T_BOOL)
48
vptr = git_config_bool(key_, value_) ? "true" : "false";
49
else
53
- vptr = value_;
50
+ vptr = value_?value_:"";
51
seen++;
52
if (dup_error) {
53
error("More than one value for the key %s: %s",