Web lists-archives.com

Re: [RFC PATCH 1/1] completion: load completion file for external subcommand

On 2018-04-09 07:59, Junio C Hamano wrote:
>  	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
		__load_completion "git-$command"

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

Good point. I could go even further and ditch the if-construct:

   ! declare -f $completion_func && declare -f __load_completion &&
       __load_completion "git-$command"

I originally intended to do a if-else-construct, which I re-thought
halfway through. I will change that in the next iteration.

Thank you!