Re: [PATCH 3/9] help: use early config when autocorrecting aliases
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 9, 2017, 17:05 UTC
- Message-ID
- <xmqqink55bxs.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <d7b77cbd688b7536aebee49df652af594d2a1293.1496851544.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 5 quoted lines
> This is slightly less performant than the previous way, as the early > config is used *twice*: once to see whether the command refers to an > alias, and then to see what aliases are most similar. However, this is > hardly a performance-critical code path, so performance is less important > here.
Yeah, the list of unknown but similar-sounding commands is produced for interactive human consumption, and the above reasoning is perfectly sound.
Looks good.
Show 17 quoted lines
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> help.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/help.c b/help.c
> index db7f3d79a01..b44c55ec2da 100644
> --- a/help.c
> +++ b/help.c
> @@ -289,7 +289,7 @@ const char *help_unknown_cmd(const char *cmd)
> memset(&other_cmds, 0, sizeof(other_cmds));
> memset(&aliases, 0, sizeof(aliases));
>
> - git_config(git_unknown_cmd_config, NULL);
> + read_early_config(git_unknown_cmd_config, NULL);
>
> load_command_list("git-", &main_cmds, &other_cmds);