]> git.ipfire.org Git - thirdparty/git.git/commitdiff
mailmap: test for silent exiting on missing file/blob
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 12 Jan 2021 20:17:55 +0000 (21:17 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Jan 2021 22:04:41 +0000 (14:04 -0800)
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>
t/t4203-mailmap.sh

index a42b4547565c2bb3f7148afd99412be520d99ff8..2b342d7f7cbdf33b6978a859e1602bc235fcf668 100755 (executable)
@@ -309,6 +309,24 @@ test_expect_success 'mailmap.file overrides mailmap.blob' '
        test_cmp expect actual
 '
 
+test_expect_success 'mailmap.file can be missing' '
+       test_when_finished "rm .mailmap" &&
+       cp default.map .mailmap &&
+
+       test_config mailmap.file nonexistent &&
+       cat >expect <<-\EOF &&
+       Repo Guy (1):
+             initial
+
+       nick1 (1):
+             second
+
+       EOF
+       git shortlog HEAD >actual 2>err &&
+       test_must_be_empty err &&
+       test_cmp expect actual
+'
+
 test_expect_success 'mailmap.blob can be missing' '
        test_when_finished "rm .mailmap" &&
        cp default.map .mailmap &&
@@ -321,7 +339,8 @@ test_expect_success 'mailmap.blob can be missing' '
              second
 
        EOF
-       git -c mailmap.blob=map:nonexistent shortlog HEAD >actual &&
+       git -c mailmap.blob=map:nonexistent shortlog HEAD >actual 2>err &&
+       test_must_be_empty err &&
        test_cmp expect actual
 '