Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2020-10-08 08:48:15 +0300
committerJunio C Hamano <gitster@pobox.com>2020-10-08 19:25:29 +0300
commit64f1f58fe7c0837bd0ae56ba83add5e1b84c54d3 (patch)
tree9ec6d813813db2e42f52855b96b0fb5abbe72a40 /t/t2024-checkout-dwim.sh
parentef09e7ddf3e77960ea24ea1580439fb725b4063a (diff)
checkout: learn to respect checkout.guess
The current behavior of git checkout/switch is that --guess is currently enabled by default. However, some users may not wish for this to happen automatically. Instead of forcing users to specify --no-guess manually each time, teach these commands the checkout.guess configuration variable that gives users the option to set a default behavior. Teach the completion script to recognize the new config variable and disable DWIM logic if it is set to false. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2024-checkout-dwim.sh')
-rwxr-xr-xt/t2024-checkout-dwim.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh
index accfa9aa4b..a4f8d3a67e 100755
--- a/t/t2024-checkout-dwim.sh
+++ b/t/t2024-checkout-dwim.sh
@@ -166,6 +166,17 @@ test_expect_success '--no-guess suppresses branch auto-vivification' '
test_branch master
'
+test_expect_success 'checkout.guess = false suppresses branch auto-vivification' '
+ git checkout -B master &&
+ status_uno_is_clean &&
+ test_might_fail git branch -D bar &&
+
+ test_config checkout.guess false &&
+ test_must_fail git checkout bar &&
+ test_must_fail git rev-parse --verify refs/heads/bar &&
+ test_branch master
+'
+
test_expect_success 'setup more remotes with unconventional refspecs' '
git checkout -B master &&
status_uno_is_clean &&