completion: improve handling of --detach in checkout
commit6d76a5cc7fd19989b32a3b6d4a6132a7dd6aee4e
authorJacob Keller <jacob.keller@gmail.com>
Thu, 28 May 2020 18:10:45 +0000 (28 11:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 May 2020 19:57:07 +0000 (28 12:57 -0700)
tree7dd51045c0d0911debfcebf11fe68969c940373d
parent68d97c7fdd5bbfd87b2e0b14ddfcd2b1825b2059
completion: improve handling of --detach in checkout

Just like git switch, we should not complete DWIM remote branch names
if --detach has been specified. To avoid this, refactor _git_checkout in
a similar way to _git_switch.

Note that we don't simply clear dwim_opt when we find -d or --detach, as
we will be adding other modes and checks, making this flow easier to
follow.

Update the previously failing tests to show that the breakage has been
resolved.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash
t/t9902-completion.sh