]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t9902-completion.sh
Merge branch 'fc/zsh-completion'
[thirdparty/git.git] / t / t9902-completion.sh
index caf4e9101f99c5567caef5c02689a105a6f0d86f..2be9190425bb1dc6f9ab0eb1b8e030c99e0d2920 100755 (executable)
@@ -1055,13 +1055,13 @@ test_expect_success 'teardown after filtering matching refs' '
        git -C otherrepo branch -D matching/branch-in-other
 '
 
-test_expect_success '__git_refs - for-each-ref format specifiers in prefix' '
+test_expect_success PREPARE_FOR_MAIN_BRANCH '__git_refs - for-each-ref format specifiers in prefix' '
        cat >expected <<-EOF &&
        evil-%%-%42-%(refname)..master
        EOF
        (
-               cur="evil-%%-%42-%(refname)..mas" &&
-               __git_refs "" "" "evil-%%-%42-%(refname).." mas >"$actual"
+               cur="evil-%%-%42-%(refname)..mai" &&
+               __git_refs "" "" "evil-%%-%42-%(refname).." mai >"$actual"
        ) &&
        test_cmp expected "$actual"
 '
@@ -1360,6 +1360,58 @@ test_expect_success 'git checkout - a later --no-guess overrides previous --gues
        EOF
 '
 
+test_expect_success 'git checkout - with checkout.guess = false, only completes refs' '
+       test_config checkout.guess false &&
+       test_completion "git checkout " <<-\EOF
+       HEAD Z
+       master Z
+       matching-branch Z
+       matching-tag Z
+       other/branch-in-other Z
+       other/master-in-other Z
+       EOF
+'
+
+test_expect_success 'git checkout - with checkout.guess = true, completes refs and unique remote branches for DWIM' '
+       test_config checkout.guess true &&
+       test_completion "git checkout " <<-\EOF
+       HEAD Z
+       branch-in-other Z
+       master Z
+       master-in-other Z
+       matching-branch Z
+       matching-tag Z
+       other/branch-in-other Z
+       other/master-in-other Z
+       EOF
+'
+
+test_expect_success 'git checkout - a later --guess overrides previous checkout.guess = false, complete refs and unique remote branches for DWIM' '
+       test_config checkout.guess false &&
+       test_completion "git checkout --guess " <<-\EOF
+       HEAD Z
+       branch-in-other Z
+       master Z
+       master-in-other Z
+       matching-branch Z
+       matching-tag Z
+       other/branch-in-other Z
+       other/master-in-other Z
+       EOF
+'
+
+test_expect_success 'git checkout - a later --no-guess overrides previous checkout.guess = true, complete only refs' '
+       test_config checkout.guess true &&
+       test_completion "git checkout --no-guess " <<-\EOF
+       HEAD Z
+       master Z
+       matching-branch Z
+       matching-tag Z
+       other/branch-in-other Z
+       other/master-in-other Z
+       EOF
+'
+
 test_expect_success 'git switch - with --detach, complete all references' '
        test_completion "git switch --detach " <<-\EOF
        HEAD Z