230
231
free(argv);
232
free(envw);
233
- return nr > 0;
233
+ return 0;
234
}
235
236
static int get_next_char(void)
1197
1198
static int do_git_config_sequence(config_fn_t fn, void *data)
1199
{
1200
- int ret = 0, found = 0;
1200
+ int ret = 0;
1201
char *xdg_config = xdg_config_home("config");
1202
char *user_config = expand_user_path("~/.gitconfig");
1203
char *repo_config = git_pathdup("config");
1204
1205
- if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0)) {
1205
+ if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0))
1206
ret += git_config_from_file(fn, git_etc_gitconfig(),
1207
data);
1208
- found += 1;
1209
- }
1208
1211
- if (xdg_config && !access_or_die(xdg_config, R_OK, ACCESS_EACCES_OK)) {
1209
+ if (xdg_config && !access_or_die(xdg_config, R_OK, ACCESS_EACCES_OK))
1210
ret += git_config_from_file(fn, xdg_config, data);
1213
- found += 1;
1214
- }
1211
1216
- if (user_config && !access_or_die(user_config, R_OK, ACCESS_EACCES_OK)) {
1212
+ if (user_config && !access_or_die(user_config, R_OK, ACCESS_EACCES_OK))
1213
ret += git_config_from_file(fn, user_config, data);
1218
- found += 1;
1219
- }
1214
1221
- if (repo_config && !access_or_die(repo_config, R_OK, 0)) {
1215
+ if (repo_config && !access_or_die(repo_config, R_OK, 0))
1216
ret += git_config_from_file(fn, repo_config, data);
1223
- found += 1;
1224
- }
1217
1226
- switch (git_config_from_parameters(fn, data)) {
1227
- case -1: /* error */
1218
+ if (git_config_from_parameters(fn, data) < 0)
1219
die(_("unable to parse command-line config"));
1229
- break;
1230
- case 0: /* found nothing */
1231
- break;
1232
- default: /* found at least one item */
1233
- found++;
1234
- break;
1235
- }
1220
1221
free(xdg_config);
1222
free(user_config);
1223
free(repo_config);
1240
- return ret == 0 ? found : ret;
1224
+ return ret;
1225
}
1226
1227
int git_config_with_options(config_fn_t fn, void *data,
1256
if (git_config_with_options(fn, data, NULL, 1) < 0)
1257
/*
1258
* git_config_with_options() normally returns only
1275
- * positive values, as most errors are fatal, and
1259
+ * zero, as most errors are fatal, and
1260
* non-fatal potential errors are guarded by "if"
1261
* statements that are entered only when no error is
1262
* possible.