git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] completion: handle unstuck form of base git options
@ 2013-06-22 11:25 John Keeping
  2013-06-22 11:25 ` [PATCH 2/2] completion: learn about --man-path John Keeping
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: John Keeping @ 2013-06-22 11:25 UTC (permalink / raw)
  To: git; +Cc: SZEDER Gábor, John Keeping

git-completion.bash's parsing of the command name relies on everything
preceding it starting with '-' unless it is the "-c" option.  This
allows users to use the stuck form of "--work-tree=<path>" and
"--namespace=<path>" but not the unstuck forms "--work-tree <path>" and
"--namespace <path>".  Fix this.

Similarly, the completion only handles the stuck form "--git-dir=<path>"
and not "--git-dir <path>", so fix this as well.

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 contrib/completion/git-completion.bash | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6c3bafe..8fbf941 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2492,9 +2492,10 @@ __git_main ()
 		i="${words[c]}"
 		case "$i" in
 		--git-dir=*) __git_dir="${i#--git-dir=}" ;;
+		--git-dir)   ((c++)) ; __git_dir="${words[c]}" ;;
 		--bare)      __git_dir="." ;;
 		--help) command="help"; break ;;
-		-c) c=$((++c)) ;;
+		-c|--work-tree|--namespace) ((c++)) ;;
 		-*) ;;
 		*) command="$i"; break ;;
 		esac
-- 
1.8.3.1.676.gaae6535

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-30 22:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-22 11:25 [PATCH 1/2] completion: handle unstuck form of base git options John Keeping
2013-06-22 11:25 ` [PATCH 2/2] completion: learn about --man-path John Keeping
2013-06-30 11:41   ` SZEDER Gábor
2013-06-30 22:59     ` Junio C Hamano
2013-06-22 12:30 ` [PATCH 1/2] completion: handle unstuck form of base git options SZEDER Gábor
2013-06-22 12:35   ` SZEDER Gábor
2013-06-28  8:20 ` John Keeping

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).