On 23/04/2023 00:19, Rubén Justo wrote:
diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh
index 2eab6474f8..6762a9a572 100755
--- a/t/t2020-checkout-detach.sh
+++ b/t/t2020-checkout-detach.sh
@@ -124,6 +124,15 @@ test_expect_success 'checkout warns on orphan commits: output' '
check_orphan_warning stderr "2 commits"
'
+test_expect_success 'checkout --orphan warns on orphan commits' '
+ git checkout "$orphan2" &&
+ git checkout --orphan orphan 2>stderr
+'
+
+test_expect_success 'checkout --orphan warns on orphan commits: output' '
+ check_orphan_warning stderr "2 commits"
+'
These two tests could be a single test.
test_expect_success 'checkout --orphan warns on orphan commits' '
git checkout "$orphan2" &&
git checkout --orphan orphan 2>stderr &&
check_orphan_warning stderr "2 commits"
'
Validating output like this in a separate step is an artifact of
the old way of checking localized strings. Tests were split into
two in f06f08b78c ("i18n: mark checkout plural warning for
translation", 2011-04-10) and then prerequisite C_LOCALE_OUTPUT
was removed in f2c8c8007c ("i18n: use test_i18ngrep in t2020,
t2204, t3030, and t3200", 2011-04-12). Usage of test_i18ngrep
was then removed in 1108cea7f8 ("tests: remove most uses of
test_i18ncmp", 2021-02-11).
+
test_expect_success 'checkout warns orphaning 1 of 2 commits' '
git checkout "$orphan2" &&
git checkout HEAD^ 2>stderr