Subject: Re: [PATCH 3/4] completion: fix branch.autosetup(merge|rebase)

From: Junio C Hamano <[email-masked]>
Date: Thu, 02 Jan 2014 15:56:48 -0800

Ramkumar Ramachandra <[email-masked]> writes:

>  	branch.*.*)
>  		local pfx="${cur%.*}." cur_="${cur##*.}"
> +		if [ "$pfx" == "branch.autosetupmerge." ] ||
> +			[ "$pfx" == "branch.autosetuprebase." ]; then
> +			return
> +		fi
>  		__gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_"
>  		return
>  		;;

I do not quite understand this change.

If we are looking at "branch.autosetupmerge." followed by something,
who typed that final dot?  If you are working on a topic about
auto-setup-merge and named your branch "autosetupmerge", don't you
want to be able to configure various aspect of that branch via
branch.autosetupmerge.{remote,merge} etc., just like you can do so
for your "topic" branch via branch.topic.{remote,merge} etc.,
regardless of your use of "autosetupmerge" option across branches?

Besides, it smells fishy to me that you need to enumerate and
special case these two here, and then you have to repeat them below
in a separate case arm.

>  	branch.*)
>  		local pfx="${cur%.*}." cur_="${cur#*.}"
> -		__gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "."
> +		__gitcomp_2 "$(__git_heads)" "
> +			autosetupmerge autosetuprebase
> +			" "$pfx" "$cur_" "."
>  		return
>  		;;
>  	guitool.*.*)