line-range-format.txt: clarify -L:regex usage form
[gitweb.git] / t / t4203-mailmap.sh
index 842b7549ec3ed6b1fa268a96d085048d2f0b7793..baa4685dcce59f17223161706a8cf059ecdabcd1 100755 (executable)
@@ -13,6 +13,11 @@ fuzz_blame () {
 }
 
 test_expect_success setup '
+       cat >contacts <<-\EOF &&
+       A U Thor <author@example.com>
+       nick1 <bugs@company.xx>
+       EOF
+
        echo one >one &&
        git add one &&
        test_tick &&
@@ -23,6 +28,44 @@ test_expect_success setup '
        git commit --author "nick1 <bugs@company.xx>" -m second
 '
 
+test_expect_success 'check-mailmap no arguments' '
+       test_must_fail git check-mailmap
+'
+
+test_expect_success 'check-mailmap arguments' '
+       cat >expect <<-\EOF &&
+       A U Thor <author@example.com>
+       nick1 <bugs@company.xx>
+       EOF
+       git check-mailmap \
+               "A U Thor <author@example.com>" \
+               "nick1 <bugs@company.xx>" >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check-mailmap --stdin' '
+       cat >expect <<-\EOF &&
+       A U Thor <author@example.com>
+       nick1 <bugs@company.xx>
+       EOF
+       git check-mailmap --stdin <contacts >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check-mailmap --stdin arguments' '
+       cat >expect <<-\EOF &&
+       Internal Guy <bugs@company.xy>
+       EOF
+       cat <contacts >>expect &&
+       git check-mailmap --stdin "Internal Guy <bugs@company.xy>" \
+               <contacts >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check-mailmap bogus contact' '
+       test_must_fail git check-mailmap bogus
+'
+
 cat >expect <<\EOF
 A U Thor (1):
       initial
@@ -247,6 +290,24 @@ test_expect_success 'cleanup after mailmap.blob tests' '
        rm -f .mailmap
 '
 
+test_expect_success 'single-character name' '
+       echo "     1    A <author@example.com>" >expect &&
+       echo "     1    nick1 <bugs@company.xx>" >>expect &&
+       echo "A <author@example.com>" >.mailmap &&
+       test_when_finished "rm .mailmap" &&
+       git shortlog -es HEAD >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'preserve canonical email case' '
+       echo "     1    A U Thor <AUTHOR@example.com>" >expect &&
+       echo "     1    nick1 <bugs@company.xx>" >>expect &&
+       echo "<AUTHOR@example.com> <author@example.com>" >.mailmap &&
+       test_when_finished "rm .mailmap" &&
+       git shortlog -es HEAD >actual &&
+       test_cmp expect actual
+'
+
 # Extended mailmap configurations should give us the following output for shortlog
 cat >expect <<\EOF
 A U Thor <author@example.com> (1):