Re: [PATCH 05/12] completion: add missing global options

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

 



Hi,


On Sun, Apr 08, 2012 at 06:07:52AM +0300, Felipe Contreras wrote:
> Otherwise 'git --foo bar<tab>' fails, also, other options are completely
> missing.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---
>  contrib/completion/git-completion.bash |    9 +++++++--
>  t/t9902-completion.sh                  |   31 +++++++++++++++++++++++++++++++
>  2 files changed, 38 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 3bc8d85..c9672b2 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2621,7 +2621,10 @@ _git ()
>  		case "$i" in
>  		--git-dir=*) __git_dir="${i#--git-dir=}" ;;
>  		--bare)      __git_dir="." ;;
> -		--version|-p|--paginate) ;;
> +		--version) ;;
> +		-p|--paginate|--no-pager) ;;
> +		--exec-path=*|--html-path|--info-path) ;;
> +		--work-tree=*|--namespace=*|--no-replace-objects) ;;
>  		--help) command="help"; break ;;
>  		*) command="$i"; break ;;
>  		esac

This is not future proof, it will break again when we add yet another
global option.  This is also incomplete, because the '-c
<configvar=value>' option is missing.

I send a patch to fix this issue a couple of months ago but it got
dropped on the floor.

  http://thread.gmane.org/gmane.comp.version-control.git/180650

My patch handles the -c global option and it won't break when we add
a new global option, so I think it should replace the above hunk.

Please feel free to copy the commit message, too, for the benefit of
other developers who might read the log message a year later.


> +test_expect_success 'general options plus command' '
> +	test_completion "git --version check" "checkout " &&
> +	test_completion "git --paginate check" "checkout " &&
> +	test_completion "git --git-dir=foo check" "checkout " &&
> +	test_completion "git --bare check" "checkout " &&
> +	test_completion "git --help des" "describe " &&
> +	test_completion "git --exec-path=foo check" "checkout " &&
> +	test_completion "git --html-path check" "checkout " &&
> +	test_completion "git --no-pager check" "checkout " &&
> +	test_completion "git --work-tree=foo check" "checkout " &&
> +	test_completion "git --namespace=foo check" "checkout " &&
> +	test_completion "git --paginate check" "checkout " &&
> +	test_completion "git --info-path check" "checkout " &&
> +	test_completion "git --no-replace-objects check" "checkout "
> +'

Then you could add a 

	test_completion "git -c 'name=value' check" "checkout "

test, too.


Best,
Gábor

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