t4202: split testcase for invalid HEAD symref and HEAD hash

Reftable will prohibit invalid hashes at the storage level, but git-symbolic-ref can still create branches ending in ".lock". Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Han-Wen Nienhuys committed May 31, 2021 at 16:56 UTC 230356ba704fc36e848e94b13c5b92acfa4c6fc6
1 file changed +7 -3
t/t4202-log.sh
+7 -3
@@ -1834,14 +1834,18 @@ test_expect_success 'log --graph --no-walk is forbidden' '
1834 test_must_fail git log --graph --no-walk
1835 '
1836
1837 -test_expect_success 'log diagnoses bogus HEAD' '
1837 +test_expect_success 'log diagnoses bogus HEAD hash' '
1838 git init empty &&
1839 + test_when_finished "rm -rf empty" &&
1840 test_must_fail git -C empty log 2>stderr &&
1841 test_i18ngrep does.not.have.any.commits stderr &&
1842 echo 1234abcd >empty/.git/refs/heads/main &&
1843 test_must_fail git -C empty log 2>stderr &&
1843 - test_i18ngrep broken stderr &&
1844 - echo "ref: refs/heads/invalid.lock" >empty/.git/HEAD &&
1844 + test_i18ngrep broken stderr'
1845 +
1846 +test_expect_success 'log diagnoses bogus HEAD symref' '
1847 + git init empty &&
1848 + git --git-dir empty/.git symbolic-ref HEAD refs/heads/invalid.lock &&
1849 test_must_fail git -C empty log 2>stderr &&
1850 test_i18ngrep broken stderr &&
1851 test_must_fail git -C empty log --default totally-bogus 2>stderr &&