Browse Source

completion: handle unstuck form of base git options

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>
Acked-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
John Keeping 12 years ago committed by Junio C Hamano
parent
commit
776009d1b2
  1. 3
      contrib/completion/git-completion.bash

3
contrib/completion/git-completion.bash

@ -2492,9 +2492,10 @@ __git_main () @@ -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

Loading…
Cancel
Save