| 570 | } |
| 571 | |
| 572 | static int git_unknown_cmd_config(const char *var, const char *value, |
| 573 | const struct config_context *ctx, |
| 574 | void *cb) |
| 575 | { |
| 576 | struct help_unknown_cmd_config *cfg = cb; |
| 577 | const char *subsection, *key; |
| 578 | size_t subsection_len; |
| 579 | |
| 580 | if (!strcmp(var, "help.autocorrect")) { |
| 581 | int v = parse_autocorrect(value); |
| 582 | |
| 583 | if (!v) { |
| 584 | v = git_config_int(var, value, ctx->kvi); |
| 585 | if (v < 0 || v == 1) |
| 586 | v = AUTOCORRECT_IMMEDIATELY; |
| 587 | } |
| 588 | |
| 589 | cfg->autocorrect = v; |
| 590 | } |
| 591 | |
| 592 | /* Also use aliases for command lookup */ |
| 593 | if (!parse_config_key(var, "alias", &subsection, &subsection_len, |
| 594 | &key)) { |
| 595 | size_t key_len = strlen(key); |
| 596 | |
| 597 | if (subsection) { |
| 598 | /* [alias "name"] command = value */ |
| 599 | if (!strcmp(key, "command")) |
| 600 | add_cmdname(&cfg->aliases, subsection, |
| 601 | subsection_len); |
| 602 | else { |
| 603 | key = var + strlen("alias."); |
| 604 | key_len = strlen(key); |
| 605 | add_cmdname(&cfg->aliases, key, key_len); |
| 606 | } |
| 607 | } else { |
| 608 | /* alias.name = value */ |
| 609 | add_cmdname(&cfg->aliases, key, key_len); |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | return 0; |
| 614 | } |
| 615 | |
| 616 | static int levenshtein_compare(const void *p1, const void *p2) |
| 617 | { |
nothing calls this directly
no test coverage detected