Re: [PATCH 05/12] completion: add missing global options
- From
SZEDER Gábor <szeder@ira.uka.de>
- Date
- Apr 8, 2012, 12:36 UTC
- Message-ID
- <20120408123646.GM2289@goldbirke>
- In-Reply-To
- <1333854479-23260-6-git-send-email-felipe.contreras@gmail.com>
Hi,
On Sun, Apr 08, 2012 at 06:07:52AM +0300, Felipe Contreras wrote:
Show 25 quoted lines
> Otherwise 'git --foo bar<tab>' fails, also, other options are completely
> missing.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
> 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 ;;
> esacThis 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.
Show 15 quoted lines
> +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