]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4203-mailmap.sh
Add map_user() and clear_mailmap() to mailmap
[thirdparty/git.git] / t / t4203-mailmap.sh
CommitLineData
d551a488
MSO
1#!/bin/sh
2
3test_description='.mailmap configurations'
4
5. ./test-lib.sh
6
7test_expect_success setup '
8 echo one >one &&
9 git add one &&
10 test_tick &&
11 git commit -m initial &&
12 echo two >>one &&
13 git add one &&
14 git commit --author "nick1 <bugs@company.xx>" -m second
15'
16
17cat >expect <<\EOF
18A U Thor (1):
19 initial
20
21nick1 (1):
22 second
23
24EOF
25
26test_expect_success 'No mailmap' '
27 git shortlog HEAD >actual &&
28 test_cmp expect actual
29'
30
31cat >expect <<\EOF
32Repo Guy (1):
33 initial
34
35nick1 (1):
36 second
37
38EOF
39
40test_expect_success 'default .mailmap' '
41 echo "Repo Guy <author@example.com>" > .mailmap &&
42 git shortlog HEAD >actual &&
43 test_cmp expect actual
44'
45
46# Using a mailmap file in a subdirectory of the repo here, but
47# could just as well have been a file outside of the repository
48cat >expect <<\EOF
49Internal Guy (1):
50 second
51
52Repo Guy (1):
53 initial
54
55EOF
56test_expect_success 'mailmap.file set' '
57 mkdir internal_mailmap &&
58 echo "Internal Guy <bugs@company.xx>" > internal_mailmap/.mailmap &&
59 git config mailmap.file internal_mailmap/.mailmap &&
60 git shortlog HEAD >actual &&
61 test_cmp expect actual
62'
63
64cat >expect <<\EOF
65External Guy (1):
66 initial
67
68Internal Guy (1):
69 second
70
71EOF
72test_expect_success 'mailmap.file override' '
73 echo "External Guy <author@example.com>" >> internal_mailmap/.mailmap &&
74 git config mailmap.file internal_mailmap/.mailmap &&
75 git shortlog HEAD >actual &&
76 test_cmp expect actual
77'
78
79cat >expect <<\EOF
80Repo Guy (1):
81 initial
82
83nick1 (1):
84 second
85
86EOF
87
88test_expect_success 'mailmap.file non-existant' '
89 rm internal_mailmap/.mailmap &&
90 rmdir internal_mailmap &&
91 git shortlog HEAD >actual &&
92 test_cmp expect actual
93'
94
95cat >expect <<\EOF
96A U Thor (1):
97 initial
98
99nick1 (1):
100 second
101
102EOF
103test_expect_success 'No mailmap files, but configured' '
104 rm .mailmap &&
105 git shortlog HEAD >actual &&
106 test_cmp expect actual
107'
108
109test_done