summaryrefslogtreecommitdiff
path: root/t/t9902-completion.sh
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2020-05-28 11:10:45 -0700
committerJunio C Hamano <gitster@pobox.com>2020-05-28 12:57:07 -0700
commit6d76a5cc7fd19989b32a3b6d4a6132a7dd6aee4e (patch)
tree7dd51045c0d0911debfcebf11fe68969c940373d /t/t9902-completion.sh
parent68d97c7fdd5bbfd87b2e0b14ddfcd2b1825b2059 (diff)
downloadgit-6d76a5cc7fd19989b32a3b6d4a6132a7dd6aee4e.tar.gz
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>
Diffstat (limited to 't/t9902-completion.sh')
-rwxr-xr-xt/t9902-completion.sh6
1 files changed, 2 insertions, 4 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 0872f8b9d7..25d530a8b9 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1371,8 +1371,7 @@ test_expect_success 'git switch - with --detach, complete all references' '
EOF
'
-#TODO: checkout --detach incorrectly includes DWIM remote branch names
-test_expect_failure 'git checkout - with --detach, complete only references' '
+test_expect_success 'git checkout - with --detach, complete only references' '
test_completion "git checkout --detach " <<-\EOF
HEAD Z
master Z
@@ -1394,8 +1393,7 @@ test_expect_success 'git switch - with -d, complete all references' '
EOF
'
-#TODO: checkout -d incorrectly includes DWIM remote branch names
-test_expect_failure 'git checkout - with -d, complete only references' '
+test_expect_success 'git checkout - with -d, complete only references' '
test_completion "git checkout -d " <<-\EOF
HEAD Z
master Z