reflog tests: test for the "points nowhere" warning
The "git reflog expire" command when given an unknown reference has since 4264dc15e1 ("git reflog expire", 2006-12-19) when this command was implemented emit an error, but this has never been tested for. Let's test for it, also under gc.reflogExpire{Unreachable,}=never in case a future change is tempted to take shortcuts in the presence of such config. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Mar 15, 2019 at 16:59 UTC
fe66776db0b841d4d4cf64f078e1ffd82193442a
1 file changed
+10
t/t1410-reflog.sh
+10
@@ -250,6 +250,16 @@ test_expect_success 'gc.reflogexpire=false' '
250
251
'
252
253
+test_expect_success 'git reflog expire unknown reference' '
254
+ test_config gc.reflogexpire never &&
255
+ test_config gc.reflogexpireunreachable never &&
256
+
257
+ test_must_fail git reflog expire master@{123} 2>stderr &&
258
+ test_i18ngrep "points nowhere" stderr &&
259
+ test_must_fail git reflog expire does-not-exist 2>stderr &&
260
+ test_i18ngrep "points nowhere" stderr
261
+'
262
+
263
test_expect_success 'checkout should not delete log for packed ref' '
264
test $(git reflog master | wc -l) = 4 &&
265
git branch foo &&