From 776009d1b2bcfbd001767758fea0c2ff0e74383d Mon Sep 17 00:00:00 2001 From: John Keeping Date: Sat, 22 Jun 2013 12:25:17 +0100 Subject: [PATCH] completion: handle unstuck form of base git options MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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=" and "--namespace=" but not the unstuck forms "--work-tree " and "--namespace ". Fix this. Similarly, the completion only handles the stuck form "--git-dir=" and not "--git-dir ", so fix this as well. Signed-off-by: John Keeping Acked-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- 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 6c3bafeea..8fbf94103 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 -- 2.11.0