From 776009d1b2bcfbd001767758fea0c2ff0e74383d Mon Sep 17 00:00:00 2001 From: John Keeping Date: Sat, 22 Jun 2013 12:25:17 +0100 Subject: [PATCH 1/2] completion: handle unstuck form of base git options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 From 66fb37d0c62ef49c9d3506b10d2d7f5b33008484 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Sat, 22 Jun 2013 12:25:18 +0100 Subject: [PATCH 2/2] completion: learn about --man-path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Keeping Acked-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 1 + t/t9902-completion.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8fbf94103..b13c880e9 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2513,6 +2513,7 @@ __git_main () --exec-path --exec-path= --html-path + --man-path --info-path --work-tree= --namespace= diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 81a1657ef..14d605af1 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -231,6 +231,7 @@ test_expect_success 'double dash "git" itself' ' --exec-path Z --exec-path= --html-path Z + --man-path Z --info-path Z --work-tree= --namespace=