diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-02-27 15:11:51 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-02-27 15:11:51 -0800 |
| commit | c33b464dfdc5b3d2ebfefbc497efb4f30e369e18 (patch) | |
| tree | fb7c86bc62c3747970dcee7f92ac1f3cd0ca1281 /t | |
| parent | ce4530ac10eecfcd80bd54c6993f2279a377e193 (diff) | |
| parent | 12fee11f21e9b63626da5058fa055f95d55a5515 (diff) | |
| download | git-c33b464dfdc5b3d2ebfefbc497efb4f30e369e18.tar.xz | |
Merge branch 'jc/checkout-switch-restore'
"git switch <name>", in an attempt to create a local branch <name>
after a remote tracking branch of the same name gave an advise
message to disambiguate using "git checkout", which has been
updated to use "git switch".
* jc/checkout-switch-restore:
checkout: tell "parse_remote_branch" which command is calling it
checkout: pass program-readable token to unified "main"
Diffstat (limited to 't')
| -rwxr-xr-x | t/t2027-checkout-track.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t2027-checkout-track.sh b/t/t2027-checkout-track.sh index a397790df5..c01f1cd617 100755 --- a/t/t2027-checkout-track.sh +++ b/t/t2027-checkout-track.sh @@ -47,4 +47,22 @@ test_expect_success 'checkout --track -b overrides autoSetupMerge=inherit' ' test_cmp_config refs/heads/main branch.b4.merge ' +test_expect_success 'ambiguous tracking info' ' + # Set up a few remote repositories + git init --bare --initial-branch=trunk src1 && + git init --bare --initial-branch=trunk src2 && + git push src1 one:refs/heads/trunk && + git push src2 two:refs/heads/trunk && + + git remote add -f src1 "file://$PWD/src1" && + git remote add -f src2 "file://$PWD/src2" && + + # DWIM + test_must_fail git checkout trunk 2>hint.checkout && + test_grep "hint: *git checkout --track" hint.checkout && + + test_must_fail git switch trunk 2>hint.switch && + test_grep "hint: *git switch --track" hint.switch +' + test_done |
