Merge branch 'jk/format-patch-from' into maint
[gitweb.git] / t / t4203-mailmap.sh
index baa4685dcce59f17223161706a8cf059ecdabcd1..0dd8b65d7cdec2ada739d7e0b524fd3c66dd5ef4 100755 (executable)
@@ -202,7 +202,8 @@ test_expect_success 'setup mailmap blob tests' '
        Blob Guy <author@example.com>
        Blob Guy <bugs@company.xx>
        EOF
-       git add just-bugs both &&
+       printf "Tricky Guy <author@example.com>" >no-newline &&
+       git add just-bugs both no-newline &&
        git commit -m "my mailmaps" &&
        echo "Repo Guy <author@example.com>" >.mailmap &&
        echo "Internal Guy <author@example.com>" >internal.map
@@ -286,6 +287,19 @@ test_expect_success 'mailmap.blob defaults to HEAD:.mailmap in bare repo' '
        )
 '
 
+test_expect_success 'mailmap.blob can handle blobs without trailing newline' '
+       cat >expect <<-\EOF &&
+       Tricky Guy (1):
+             initial
+
+       nick1 (1):
+             second
+
+       EOF
+       git -c mailmap.blob=map:no-newline shortlog HEAD >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'cleanup after mailmap.blob tests' '
        rm -f .mailmap
 '
@@ -470,4 +484,15 @@ test_expect_success 'Blame output (complex mapping)' '
        test_cmp expect actual.fuzz
 '
 
+cat >expect <<\EOF
+Some Dude <some@dude.xx>
+EOF
+
+test_expect_success 'commit --author honors mailmap' '
+       test_must_fail git commit --author "nick" --allow-empty -meight &&
+       git commit --author "Some Dude" --allow-empty -meight &&
+       git show --pretty=format:"%an <%ae>%n" >actual &&
+       test_cmp expect actual
+'
+
 test_done