mailmap: test for silent exiting on missing file/blob

That we silently ignore missing mailmap.file or mailmap.blob values is intentional. See 938a60d64f (mailmap: clean up read_mailmap error handling, 2012-12-12). However, nothing tested for this. Let's do that by checking that stderr is empty in those cases. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jan 12, 2021 at 21:17 UTC 56ac194e1d3b3f3b46c2d48f47bde69d35547a7c
1 file changed +20 -1
t/t4203-mailmap.sh
+20 -1
@@ -309,6 +309,24 @@ test_expect_success 'mailmap.file overrides mailmap.blob' '
309 test_cmp expect actual
310 '
311
312 +test_expect_success 'mailmap.file can be missing' '
313 + test_when_finished "rm .mailmap" &&
314 + cp default.map .mailmap &&
315 +
316 + test_config mailmap.file nonexistent &&
317 + cat >expect <<-\EOF &&
318 + Repo Guy (1):
319 + initial
320 +
321 + nick1 (1):
322 + second
323 +
324 + EOF
325 + git shortlog HEAD >actual 2>err &&
326 + test_must_be_empty err &&
327 + test_cmp expect actual
328 +'
329 +
330 test_expect_success 'mailmap.blob can be missing' '
331 test_when_finished "rm .mailmap" &&
332 cp default.map .mailmap &&
@@ -321,7 +339,8 @@ test_expect_success 'mailmap.blob can be missing' '
339 second
340
341 EOF
324 - git -c mailmap.blob=map:nonexistent shortlog HEAD >actual &&
342 + git -c mailmap.blob=map:nonexistent shortlog HEAD >actual 2>err &&
343 + test_must_be_empty err &&
344 test_cmp expect actual
345 '
346