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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Florian Gamböck <mail@xxxxxxxx> writes:

> 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.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux