Add mailmap.file as configurational option for mailmap location
[git/gitweb.git] / t / t4203-mailmap.sh
blobfc50ac22e356c8e4a352a40b0660b876aa8c7ce1
1 #!/bin/sh
3 test_description='.mailmap configurations'
5 . ./test-lib.sh
7 test_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
17 cat >expect <<\EOF
18 A U Thor (1):
19 initial
21 nick1 (1):
22 second
24 EOF
26 test_expect_success 'No mailmap' '
27 git shortlog HEAD >actual &&
28 test_cmp expect actual
31 cat >expect <<\EOF
32 Repo Guy (1):
33 initial
35 nick1 (1):
36 second
38 EOF
40 test_expect_success 'default .mailmap' '
41 echo "Repo Guy <author@example.com>" > .mailmap &&
42 git shortlog HEAD >actual &&
43 test_cmp expect actual
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
48 cat >expect <<\EOF
49 Internal Guy (1):
50 second
52 Repo Guy (1):
53 initial
55 EOF
56 test_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
64 cat >expect <<\EOF
65 External Guy (1):
66 initial
68 Internal Guy (1):
69 second
71 EOF
72 test_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
79 cat >expect <<\EOF
80 Repo Guy (1):
81 initial
83 nick1 (1):
84 second
86 EOF
88 test_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
95 cat >expect <<\EOF
96 A U Thor (1):
97 initial
99 nick1 (1):
100 second
103 test_expect_success 'No mailmap files, but configured' '
104 rm .mailmap &&
105 git shortlog HEAD >actual &&
106 test_cmp expect actual
109 test_done