Skip to content

Commit

Permalink
git_config: don't peek at global config_parameters
Browse files Browse the repository at this point in the history
The config_parameters list in config.c is an implementation
detail of git_config_from_parameters; instead, that function
should tell us whether it found anything.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 24, 2011
1 parent 3ddf096 commit 5a0c9ee
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
for (ct = config_parameters; ct; ct = ct->next)
if (fn(ct->name, ct->value, data) < 0)
return -1;
return 0;
return config_parameters != NULL;
}

int git_config_early(config_fn_t fn, void *data, const char *repo_config)
Expand Down Expand Up @@ -864,9 +864,16 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
found += 1;
}

ret += git_config_from_parameters(fn, data);
if (config_parameters)
found += 1;
switch (git_config_from_parameters(fn, data)) {
case -1: /* error */
ret--;
break;
case 0: /* found nothing */
break;
default: /* found at least one item */
found++;
break;
}

if (found == 0)
return -1;
Expand Down

0 comments on commit 5a0c9ee

Please sign in to comment.