Re: [PATCH 02/12] completion: simplify __gitcomp

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

 



Hi,


On Sun, Apr 08, 2012 at 06:07:49AM +0300, Felipe Contreras wrote:
> The suffix is never used.

The suffix was used to offer completion after 'git config
branch.<TAB>' ending with a period.  It is not used by git's
completion script anymore, because nowadays this case is handled by
the __gitcomp_nl helper() function.

However, users can provide custom completion functions to their
aliases or additional git commands, and there might be a custom
completion function out there that passes a suffix to __gitcomp().

We don't want to break those custom completion functions, so I think
the suffix should stay.


Best,
Gábor



> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---
>  contrib/completion/git-completion.bash |   12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 31f714d..39f5435 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -304,15 +304,14 @@ __git_ps1 ()
>  	fi
>  }
>  
> -# __gitcomp_1 requires 2 arguments
>  __gitcomp_1 ()
>  {
>  	local c IFS=' '$'\t'$'\n'
>  	for c in $1; do
> -		case "$c$2" in
> -		--*=*) printf %s$'\n' "$c$2" ;;
> -		*.)    printf %s$'\n' "$c$2" ;;
> -		*)     printf %s$'\n' "$c$2 " ;;
> +		case "$c" in
> +		--*=*) printf %s$'\n' "$c" ;;
> +		*.)    printf %s$'\n' "$c" ;;
> +		*)     printf %s$'\n' "$c " ;;
>  		esac
>  	done
>  }
> @@ -479,7 +478,6 @@ fi
>  # 1: List of possible completion words.
>  # 2: A prefix to be added to each possible completion word (optional).
>  # 3: Generate possible completion matches for this word (optional).
> -# 4: A suffix to be appended to each possible completion word (optional).
>  __gitcomp ()
>  {
>  	local cur_="${3-$cur}"
> @@ -491,7 +489,7 @@ __gitcomp ()
>  	*)
>  		local IFS=$'\n'
>  		COMPREPLY=($(compgen -P "${2-}" \
> -			-W "$(__gitcomp_1 "${1-}" "${4-}")" \
> +			-W "$(__gitcomp_1 "${1-}")" \
>  			-- "$cur_"))
>  		;;
>  	esac
> -- 
> 1.7.10.3.g5a738d
> 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]