Skip to content

Commit

Permalink
repo-config: fix printing of bool
Browse files Browse the repository at this point in the history
When a bool variable appears without any value, it means true.
However, replacing the NULL value with an empty string, an earlier
commit f067a13 broke show-config.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jun 24, 2006
1 parent 0ec2f6b commit acb7014
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions repo-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,25 @@ 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)
printf("%s ", key_);
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",
Expand Down

0 comments on commit acb7014

Please sign in to comment.