Re: [RFC PATCH 1/1] completion: load completion file for external subcommand
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 8, 2018, 22:59 UTC
- Message-ID
- <xmqq37059uez.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180408182552.26289-3-mail@floga.de>
Florian Gamböck <mail@floga.de> writes:
Show 7 quoted lines
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > index b09c8a236..e6114822c 100644 > --- a/contrib/completion/git-completion.bash > +++ b/contrib/completion/git-completion.bash > @@ -3096,12 +3096,20 @@ __git_main () > fi >
Sorry if I am asking something obvious, as I am not fluent in bash-isms, but
> local completion_func="_git_${command//-/_}"
> + if ! declare -f $completion_func >/dev/null 2>/dev/null; then
> + declare -f __load_completion >/dev/null 2>/dev/null &&
> + __load_completion "git-$command"wouldn't the above be easier to read if it were
if ! declare ... $completion_func ... && declare -f __load_completion then __load_completion "git-$command" fi
or is there a reason why it is better to &&-chain the check for __load_completion with its use? Same comment applies to the other hunk.