summaryrefslogtreecommitdiff
path: root/t/t4203-mailmap.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t4203-mailmap.sh')
-rwxr-xr-xt/t4203-mailmap.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 0b2d21e..cd1cab3 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -963,4 +963,63 @@ test_expect_success SYMLINKS 'symlinks not respected in-tree' '
test_cmp expect actual
'
+test_expect_success 'prepare for cat-file --mailmap' '
+ rm -f .mailmap &&
+ git commit --allow-empty -m foo --author="Orig <orig@example.com>"
+'
+
+test_expect_success '--no-use-mailmap disables mailmap in cat-file' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-EOF &&
+ A U Thor <author@example.com> Orig <orig@example.com>
+ EOF
+ cat >expect <<-EOF &&
+ author Orig <orig@example.com>
+ EOF
+ git cat-file --no-use-mailmap commit HEAD >log &&
+ sed -n "/^author /s/\([^>]*>\).*/\1/p" log >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--use-mailmap enables mailmap in cat-file' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-EOF &&
+ A U Thor <author@example.com> Orig <orig@example.com>
+ EOF
+ cat >expect <<-EOF &&
+ author A U Thor <author@example.com>
+ EOF
+ git cat-file --use-mailmap commit HEAD >log &&
+ sed -n "/^author /s/\([^>]*>\).*/\1/p" log >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--no-mailmap disables mailmap in cat-file for annotated tag objects' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-EOF &&
+ Orig <orig@example.com> C O Mitter <committer@example.com>
+ EOF
+ cat >expect <<-EOF &&
+ tagger C O Mitter <committer@example.com>
+ EOF
+ git tag -a -m "annotated tag" v1 &&
+ git cat-file --no-mailmap -p v1 >log &&
+ sed -n "/^tagger /s/\([^>]*>\).*/\1/p" log >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--mailmap enables mailmap in cat-file for annotated tag objects' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-EOF &&
+ Orig <orig@example.com> C O Mitter <committer@example.com>
+ EOF
+ cat >expect <<-EOF &&
+ tagger Orig <orig@example.com>
+ EOF
+ git tag -a -m "annotated tag" v2 &&
+ git cat-file --mailmap -p v2 >log &&
+ sed -n "/^tagger /s/\([^>]*>\).*/\1/p" log >actual &&
+ test_cmp expect actual
+'
+
test_done