summaryrefslogtreecommitdiff
path: root/contrib/completion/git-completion.bash
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-06-20 09:55:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-20 20:31:51 (GMT)
commit97ed685701a6df0273f7d29fd5bc0a0658a63cad (patch)
tree75b86aef84a29988f7311392a02124af3990908e /contrib/completion/git-completion.bash
parentd16dc428b47837cebd231de1fad76d9c307f34b0 (diff)
downloadgit-97ed685701a6df0273f7d29fd5bc0a0658a63cad.zip
git-97ed685701a6df0273f7d29fd5bc0a0658a63cad.tar.gz
git-97ed685701a6df0273f7d29fd5bc0a0658a63cad.tar.bz2
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>
Diffstat (limited to 'contrib/completion/git-completion.bash')
-rw-r--r--contrib/completion/git-completion.bash4
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 58d18d4..656e497 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2183,6 +2183,10 @@ _git_switch ()
fi
if [ -z "$(__git_find_on_cmdline "-d --detach")" ]; then
only_local_ref=y
+ else
+ # --guess --detach is invalid combination, no
+ # dwim will be done when --detach is specified
+ track_opt=
fi
if [ $only_local_ref = y -a -z "$track_opt" ]; then
__gitcomp_direct "$(__git_heads "" "$cur" " ")"