revert(3p/git): Revert merge of git upstream at v2.26.2

This causes cgit to serve error pages, which is undesirable.

This reverts commit 5229c9b232, reversing
changes made to f2b211131f.
This commit is contained in:
Vincent Ambo 2020-05-26 00:06:52 +01:00
parent 6f8fbf4aa4
commit 93ba78d6f4
1006 changed files with 60537 additions and 148724 deletions

View file

@ -61,7 +61,7 @@ static enum parse_opt_result opt_command_mode_error(
*/
for (that = all_opts; that->type != OPTION_END; that++) {
if (that == opt ||
!(that->flags & PARSE_OPT_CMDMODE) ||
that->type != OPTION_CMDMODE ||
that->value != opt->value ||
that->defval != *(int *)opt->value)
continue;
@ -95,14 +95,6 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
if (!(flags & OPT_SHORT) && p->opt && (opt->flags & PARSE_OPT_NOARG))
return error(_("%s takes no value"), optname(opt, flags));
/*
* Giving the same mode option twice, although unnecessary,
* is not a grave error, so let it pass.
*/
if ((opt->flags & PARSE_OPT_CMDMODE) &&
*(int *)opt->value && *(int *)opt->value != opt->defval)
return opt_command_mode_error(opt, all_opts, flags);
switch (opt->type) {
case OPTION_LOWLEVEL_CALLBACK:
return opt->ll_callback(p, opt, NULL, unset);
@ -138,6 +130,16 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
*(int *)opt->value = unset ? 0 : opt->defval;
return 0;
case OPTION_CMDMODE:
/*
* Giving the same mode option twice, although is unnecessary,
* is not a grave error, so let it pass.
*/
if (*(int *)opt->value && *(int *)opt->value != opt->defval)
return opt_command_mode_error(opt, all_opts, flags);
*(int *)opt->value = opt->defval;
return 0;
case OPTION_STRING:
if (unset)
*(const char **)opt->value = NULL;
@ -355,7 +357,8 @@ is_abbreviated:
}
/* negated? */
if (!starts_with(arg, "no-")) {
if (skip_prefix(long_name, "no-", &long_name)) {
if (starts_with(long_name, "no-")) {
long_name += 3;
opt_flags |= OPT_UNSET;
goto again;
}
@ -417,7 +420,7 @@ static void check_typos(const char *arg, const struct option *options)
return;
if (starts_with(arg, "no-")) {
error(_("did you mean `--%s` (with two dashes)?"), arg);
error(_("did you mean `--%s` (with two dashes ?)"), arg);
exit(129);
}
@ -425,7 +428,7 @@ static void check_typos(const char *arg, const struct option *options)
if (!options->long_name)
continue;
if (starts_with(options->long_name, arg)) {
error(_("did you mean `--%s` (with two dashes)?"), arg);
error(_("did you mean `--%s` (with two dashes ?)"), arg);
exit(129);
}
}
@ -620,7 +623,7 @@ static int show_gitcomp(const struct option *opts)
* Scan and may produce a new option[] array, which should be used
* instead of the original 'options'.
*
* Right now this is only used to preprocess and substitute
* Right now this is only used to preprocess and substitue
* OPTION_ALIAS.
*/
static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
@ -777,8 +780,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
continue;
}
if (!arg[2] /* "--" */ ||
!strcmp(arg + 2, "end-of-options")) {
if (!arg[2]) { /* "--" */
if (!(ctx->flags & PARSE_OPT_KEEP_DASHDASH)) {
ctx->argc--;
ctx->argv++;