Skip to content

Commit 776009d

Browse files
johnkeepinggitster
authored andcommitted
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 <[email protected]> Acked-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7a3187e commit 776009d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2492,9 +2492,10 @@ __git_main ()
24922492
i="${words[c]}"
24932493
case "$i" in
24942494
--git-dir=*) __git_dir="${i#--git-dir=}" ;;
2495+
--git-dir) ((c++)) ; __git_dir="${words[c]}" ;;
24952496
--bare) __git_dir="." ;;
24962497
--help) command="help"; break ;;
2497-
-c) c=$((++c)) ;;
2498+
-c|--work-tree|--namespace) ((c++)) ;;
24982499
-*) ;;
24992500
*) command="$i"; break ;;
25002501
esac

0 commit comments

Comments
 (0)