merge(3p/git): Merge git upstream at v2.26.2
This commit is contained in:
commit
5229c9b232
1006 changed files with 149006 additions and 60819 deletions
32
third_party/git/parse-options.c
vendored
32
third_party/git/parse-options.c
vendored
|
|
@ -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->type != OPTION_CMDMODE ||
|
||||
!(that->flags & PARSE_OPT_CMDMODE) ||
|
||||
that->value != opt->value ||
|
||||
that->defval != *(int *)opt->value)
|
||||
continue;
|
||||
|
|
@ -95,6 +95,14 @@ 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);
|
||||
|
|
@ -130,16 +138,6 @@ 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;
|
||||
|
|
@ -357,8 +355,7 @@ is_abbreviated:
|
|||
}
|
||||
/* negated? */
|
||||
if (!starts_with(arg, "no-")) {
|
||||
if (starts_with(long_name, "no-")) {
|
||||
long_name += 3;
|
||||
if (skip_prefix(long_name, "no-", &long_name)) {
|
||||
opt_flags |= OPT_UNSET;
|
||||
goto again;
|
||||
}
|
||||
|
|
@ -420,7 +417,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);
|
||||
}
|
||||
|
||||
|
|
@ -428,7 +425,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);
|
||||
}
|
||||
}
|
||||
|
|
@ -623,7 +620,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 substitue
|
||||
* Right now this is only used to preprocess and substitute
|
||||
* OPTION_ALIAS.
|
||||
*/
|
||||
static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
|
||||
|
|
@ -780,7 +777,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!arg[2]) { /* "--" */
|
||||
if (!arg[2] /* "--" */ ||
|
||||
!strcmp(arg + 2, "end-of-options")) {
|
||||
if (!(ctx->flags & PARSE_OPT_KEEP_DASHDASH)) {
|
||||
ctx->argc--;
|
||||
ctx->argv++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue