MCPcopy Create free account
hub / github.com/git/git / register_abbrev

Function register_abbrev

parse-options.c:497–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495};
496
497static void register_abbrev(struct parse_opt_ctx_t *p,
498 const struct option *option, enum opt_parsed flags,
499 struct parsed_option *abbrev,
500 struct parsed_option *ambiguous)
501{
502 if (p->flags & PARSE_OPT_KEEP_UNKNOWN_OPT)
503 return;
504 if (abbrev->option &&
505 !(abbrev->flags == flags && is_alias(p, abbrev->option, option))) {
506 /*
507 * If this is abbreviated, it is
508 * ambiguous. So when there is no
509 * exact match later, we need to
510 * error out.
511 */
512 ambiguous->option = abbrev->option;
513 ambiguous->flags = abbrev->flags;
514 }
515 abbrev->option = option;
516 abbrev->flags = flags;
517}
518
519static enum parse_opt_result parse_long_opt(
520 struct parse_opt_ctx_t *p, const char *arg,

Callers 1

parse_long_optFunction · 0.85

Calls 1

is_aliasFunction · 0.85

Tested by

no test coverage detected