Merge branch 'jh/partial-clone-doc'
[gitweb.git] / t / t2024-checkout-dwim.sh
index 082147a875c2999210fd1870b12167c6f6fda909..f79dfbbdd693b3fd7443d3c839e86e627663eb4b 100755 (executable)
@@ -24,9 +24,8 @@ test_branch_upstream () {
 }
 
 status_uno_is_clean () {
-       >status.expect &&
        git status -uno --porcelain >status.actual &&
-       test_cmp status.expect status.actual
+       test_must_be_empty status.actual
 }
 
 test_expect_success 'setup' '
@@ -87,7 +86,23 @@ test_expect_success 'checkout of branch from multiple remotes fails with advice'
                checkout foo 2>stderr &&
        test_branch master &&
        status_uno_is_clean &&
-       test_i18ngrep ! "^hint: " stderr
+       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' '