diff mbox series

[v2,01/26] completion: bash: fix prefix detection in branch.*

Message ID 20201110212136.870769-2-felipe.contreras@gmail.com (mailing list archive)
State New, archived
Headers show
Series completion: bash: a bunch of fixes, cleanups, and reorganization | expand

Commit Message

Felipe Contreras Nov. 10, 2020, 9:21 p.m. UTC
Otherwise we are completely ignoring the --cur argument.

The issue can be tested with:

  git clone --config=branch.<tab>

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

SZEDER Gábor Nov. 25, 2020, 8:48 a.m. UTC | #1
On Tue, Nov 10, 2020 at 03:21:11PM -0600, Felipe Contreras wrote:
> Otherwise we are completely ignoring the --cur argument.
> 
> The issue can be tested with:
> 
>   git clone --config=branch.<tab>
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  contrib/completion/git-completion.bash | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 7c81e4ba49..b866b68b3c 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2615,8 +2615,8 @@ __git_complete_config_variable_name ()
>  		return
>  		;;
>  	branch.*)
> -		local pfx="${cur%.*}."
> -		cur_="${cur#*.}"
> +		local pfx="${cur_%.*}."
> +		cur_="${cur_#*.}"

Indeed, somehow this case was only half-converted in 5af9d5f6c8
(completion: complete config variables and values for 'git clone
--config=', 2019-08-13), thanks.

>  		__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
>  		__gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx"
>  		return
> -- 
> 2.29.2
>
Junio C Hamano Nov. 25, 2020, 8:37 p.m. UTC | #2
SZEDER Gábor <szeder.dev@gmail.com> writes:

> On Tue, Nov 10, 2020 at 03:21:11PM -0600, Felipe Contreras wrote:
>> Otherwise we are completely ignoring the --cur argument.
>> 
>> The issue can be tested with:
>> 
>>   git clone --config=branch.<tab>
>> 
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>> ---
>>  contrib/completion/git-completion.bash | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index 7c81e4ba49..b866b68b3c 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -2615,8 +2615,8 @@ __git_complete_config_variable_name ()
>>  		return
>>  		;;
>>  	branch.*)
>> -		local pfx="${cur%.*}."
>> -		cur_="${cur#*.}"
>> +		local pfx="${cur_%.*}."
>> +		cur_="${cur_#*.}"
>
> Indeed, somehow this case was only half-converted in 5af9d5f6c8
> (completion: complete config variables and values for 'git clone
> --config=', 2019-08-13), thanks.

Very much appreciated a review on this step, and it would be even
more appreciated if the whole series gets some review, as we do not
want to merge a series that has not been looked at.

Thanks.
Felipe Contreras Nov. 25, 2020, 9:46 p.m. UTC | #3
On Wed, Nov 25, 2020 at 2:37 PM Junio C Hamano <gitster@pobox.com> wrote:

> Very much appreciated a review on this step, and it would be even
> more appreciated if the whole series gets some review, as we do not
> want to merge a series that has not been looked at.

Yes, but it would be better to review the important ones; the fixes, first.

https://lore.kernel.org/git/20201119015209.1155170-1-felipe.contreras@gmail.com/
diff mbox series

Patch

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7c81e4ba49..b866b68b3c 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2615,8 +2615,8 @@  __git_complete_config_variable_name ()
 		return
 		;;
 	branch.*)
-		local pfx="${cur%.*}."
-		cur_="${cur#*.}"
+		local pfx="${cur_%.*}."
+		cur_="${cur_#*.}"
 		__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
 		__gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx"
 		return