completion: disable dwim on "git switch -d"
Even though dwim is enabled by default, it will never be done when --detached is specified. If you force "-d --guess" you will get an error because --guess then implies -c which cannot be used with -d. So we can disable dwim in "switch -d". It makes the completion list in this case a bit shorter. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Jun 20, 2019 at 16:55 UTC
97ed685701a6df0273f7d29fd5bc0a0658a63cad
1 file changed
+4
contrib/completion/git-completion.bash
+4
@@ -2183,6 +2183,10 @@ _git_switch ()
2183
fi
2184
if [ -z "$(__git_find_on_cmdline "-d --detach")" ]; then
2185
only_local_ref=y
2186
+ else
2187
+ # --guess --detach is invalid combination, no
2188
+ # dwim will be done when --detach is specified
2189
+ track_opt=
2190
fi
2191
if [ $only_local_ref = y -a -z "$track_opt" ]; then
2192
__gitcomp_direct "$(__git_heads "" "$cur" " ")"