repack: repack promisor objects if -a or -A is set
[gitweb.git] / t / t2024-checkout-dwim.sh
index d2fb4e2c0c7e9bdceaddb346198065e2fb30ce33..26dc3f1fc0c25df1b359b5d56aece9f171344f5a 100755 (executable)
@@ -76,6 +76,36 @@ test_expect_success 'checkout of branch from multiple remotes fails #1' '
        test_branch master
 '
 
+test_expect_success 'checkout of branch from multiple remotes fails with advice' '
+       git checkout -B master &&
+       test_might_fail git branch -D foo &&
+       test_must_fail git checkout foo 2>stderr &&
+       test_branch master &&
+       status_uno_is_clean &&
+       test_i18ngrep "^hint: " stderr &&
+       test_must_fail git -c advice.checkoutAmbiguousRemoteBranchName=false \
+               checkout foo 2>stderr &&
+       test_branch master &&
+       status_uno_is_clean &&
+       test_i18ngrep ! "^hint: " stderr &&
+       # Make sure the likes of checkout -p do not print this hint
+       git checkout -p foo 2>stderr &&
+       test_i18ngrep ! "^hint: " stderr &&
+       status_uno_is_clean
+'
+
+test_expect_success 'checkout of branch from multiple remotes succeeds with checkout.defaultRemote #1' '
+       git checkout -B master &&
+       status_uno_is_clean &&
+       test_might_fail git branch -D foo &&
+
+       git -c checkout.defaultRemote=repo_a checkout foo &&
+       status_uno_is_clean &&
+       test_branch foo &&
+       test_cmp_rev remotes/repo_a/foo HEAD &&
+       test_branch_upstream foo repo_a foo
+'
+
 test_expect_success 'checkout of branch from a single remote succeeds #1' '
        git checkout -B master &&
        test_might_fail git branch -D bar &&