git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"SZEDER Gábor" <szeder@ira.uka.de>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Thomas Rast" <trast@student.ethz.ch>,
	"Felipe Contreras" <felipe.contreras@gmail.com>
Subject: [PATCH 05/12] completion: add missing global options
Date: Sun,  8 Apr 2012 06:07:52 +0300	[thread overview]
Message-ID: <1333854479-23260-6-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1333854479-23260-1-git-send-email-felipe.contreras@gmail.com>

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 ;;
 		esac
@@ -2636,10 +2639,12 @@ _git ()
 			--git-dir=
 			--bare
 			--version
-			--exec-path
+			--exec-path=
 			--html-path
+			--info-path
 			--work-tree=
 			--namespace=
+			--no-replace-objects
 			--help
 			"
 			;;
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 7eb80dd..ee5654d 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -198,4 +198,35 @@ test_expect_success 'double dash' '
 	test_completion "git checkout --"
 '
 
+test_expect_success 'general options' '
+	test_completion "git --ver" "--version " &&
+	test_completion "git --hel" "--help " &&
+	test_completion "git --exe" "--exec-path=" &&
+	test_completion "git --htm" "--html-path " &&
+	test_completion "git --pag" "--paginate " &&
+	test_completion "git --no-p" "--no-pager " &&
+	test_completion "git --git" "--git-dir=" &&
+	test_completion "git --wor" "--work-tree=" &&
+	test_completion "git --nam" "--namespace=" &&
+	test_completion "git --bar" "--bare " &&
+	test_completion "git --inf" "--info-path " &&
+	test_completion "git --no-r" "--no-replace-objects "
+'
+
+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 "
+'
+
 test_done
-- 
1.7.10.3.g5a738d

  parent reply	other threads:[~2012-04-08  3:09 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-08  3:07 [PATCH 00/12] Bash completion rework Felipe Contreras
2012-04-08  3:07 ` [PATCH 01/12] tests: add initial bash completion tests Felipe Contreras
2012-04-08  4:25   ` Junio C Hamano
2012-04-08  4:48     ` Jeff King
2012-04-08  5:41       ` Junio C Hamano
2012-04-08  5:42         ` Jeff King
2012-04-08  8:12           ` Jeff King
2012-04-08  9:07             ` Andreas Schwab
2012-04-08 11:04               ` Jeff King
2012-04-11 21:59     ` Felipe Contreras
2012-04-11 23:49       ` Junio C Hamano
2012-04-08  5:01   ` Jeff King
2012-04-08 10:30     ` Jonathan Nieder
2012-04-08 11:06       ` Jeff King
2012-04-09 19:58         ` Junio C Hamano
2012-04-08 10:28   ` John Keeping
2012-04-08  3:07 ` [PATCH 02/12] completion: simplify __gitcomp Felipe Contreras
2012-04-08 12:46   ` SZEDER Gábor
2012-04-08 13:07     ` Felipe Contreras
2012-04-08 13:27       ` Jonathan Nieder
2012-04-08 13:47         ` Felipe Contreras
2012-04-08 14:36           ` Jonathan Nieder
2012-04-08 14:58             ` Felipe Contreras
2012-04-09 18:57               ` Johannes Sixt
2012-04-09 19:12                 ` Felipe Contreras
2012-04-08 14:11         ` Felipe Contreras
2012-04-08 14:39           ` Jonathan Nieder
2012-04-09 18:22             ` Junio C Hamano
2012-04-08  3:07 ` [PATCH 03/12] completion: simplify __gitcomp_1 Felipe Contreras
2012-04-08  3:07 ` [PATCH 04/12] completion: trivial simplification Felipe Contreras
2012-04-08  3:07 ` Felipe Contreras [this message]
2012-04-08 10:22   ` [PATCH 05/12] completion: add missing global options John Keeping
2012-04-08 12:36   ` SZEDER Gábor
2012-04-08  3:07 ` [PATCH 06/12] tests: add more bash completion tests Felipe Contreras
2012-04-08  3:07 ` [PATCH 07/12] completion: simplify command stuff Felipe Contreras
2012-04-11 22:14   ` SZEDER Gábor
2012-04-11 22:21     ` Felipe Contreras
2012-04-11 23:01       ` SZEDER Gábor
2012-04-11 23:45         ` Felipe Contreras
2012-04-12 23:08           ` Felipe Contreras
2012-04-08  3:07 ` [PATCH 08/12] completion: simplify _git_bundle Felipe Contreras
2012-04-08  3:07 ` [PATCH 09/12] completion: calculate argument position properly Felipe Contreras
2012-04-08  3:07 ` [PATCH 10/12] completion: add new git_complete helper Felipe Contreras
2012-04-11 22:50   ` SZEDER Gábor
2012-04-11 23:44     ` Felipe Contreras
2012-04-08  3:07 ` [PATCH 11/12] test: add tests for aliases in bash completion Felipe Contreras
2012-04-08  3:20   ` Felipe Contreras
2012-04-08  3:07 ` [PATCH 12/12] completion: rename _git and _gitk Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1333854479-23260-6-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=spearce@spearce.org \
    --cc=szeder@ira.uka.de \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).