13
}
14
15
test_expect_success 'setup commits and contacts file' '
16
- cat >contacts <<-EOF &&
17
- $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
18
- nick1 <bugs@company.xx>
19
- EOF
20
-
16
echo one >one &&
17
git add one &&
18
test_tick &&
43
$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
44
nick1 <bugs@company.xx>
45
EOF
51
- git check-mailmap --stdin <contacts >actual &&
46
+ git check-mailmap --stdin <expect >actual &&
47
test_cmp expect actual
48
'
49
55
-test_expect_success 'check-mailmap --stdin arguments' '
50
+test_expect_success 'check-mailmap --stdin arguments: no mapping' '
51
+ test_when_finished "rm contacts" &&
52
+ cat >contacts <<-EOF &&
53
+ $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
54
+ nick1 <bugs@company.xx>
55
+ EOF
56
cat >expect <<-\EOF &&
57
Internal Guy <bugs@company.xy>
58
EOF
59
- cat <contacts >>expect &&
59
+ cat contacts >>expect &&
60
+
61
git check-mailmap --stdin "Internal Guy <bugs@company.xy>" \
62
<contacts >actual &&
63
test_cmp expect actual
64
'
65
66
+test_expect_success 'check-mailmap --stdin arguments: mapping' '
67
+ test_when_finished "rm .mailmap" &&
68
+ cat >.mailmap <<-EOF &&
69
+ New Name <$GIT_AUTHOR_EMAIL>
70
+ EOF
71
+ cat >stdin <<-EOF &&
72
+ Old Name <$GIT_AUTHOR_EMAIL>
73
+ EOF
74
+
75
+ cp .mailmap expect &&
76
+ git check-mailmap --stdin <stdin >actual &&
77
+ test_cmp expect actual &&
78
+
79
+ cat .mailmap >>expect &&
80
+ git check-mailmap --stdin "Another Old Name <$GIT_AUTHOR_EMAIL>" \
81
+ <stdin >actual &&
82
+ test_cmp expect actual
83
+'
84
+
85
test_expect_success 'check-mailmap bogus contact' '
86
test_must_fail git check-mailmap bogus
87
'
88
89
+test_expect_success 'check-mailmap bogus contact --stdin' '
90
+ test_must_fail git check-mailmap --stdin bogus </dev/null
91
+'
92
+
93
test_expect_success 'No mailmap' '
94
cat >expect <<-EOF &&
95
$GIT_AUTHOR_NAME (1):