summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar John Keeping <john@keeping.me.uk>2013-06-22 12:25:17 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-06-30 15:58:25 -0700
commit776009d1b2bcfbd001767758fea0c2ff0e74383d (patch)
tree7c222a0b3f6431b1d11a48810f87fb42562425a8
parentMerge branch 'maint' (diff)
downloadtgif-776009d1b2bcfbd001767758fea0c2ff0e74383d.tar.xz
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>
-rw-r--r--contrib/completion/git-completion.bash3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6c3bafeea5..8fbf94103c 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