Browse Source
This allows us to augment the repo mailmap file, and to use mailmap files elsewhere than the repository root. Meaning that the entries in mailmap.file will override the entries in "./.mailmap", should they match. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
Marius Storm-Olsen
16 years ago
committed by
Junio C Hamano
10 changed files with 147 additions and 7 deletions
@ -1,7 +1,7 @@
@@ -1,7 +1,7 @@
|
||||
#ifndef MAILMAP_H |
||||
#define MAILMAP_H |
||||
|
||||
int read_mailmap(struct string_list *map, const char *filename, char **repo_abbrev); |
||||
int read_mailmap(struct string_list *map, char **repo_abbrev); |
||||
int map_email(struct string_list *mailmap, const char *email, char *name, int maxlen); |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,109 @@
@@ -0,0 +1,109 @@
|
||||
#!/bin/sh |
||||
|
||||
test_description='.mailmap configurations' |
||||
|
||||
. ./test-lib.sh |
||||
|
||||
test_expect_success setup ' |
||||
echo one >one && |
||||
git add one && |
||||
test_tick && |
||||
git commit -m initial && |
||||
echo two >>one && |
||||
git add one && |
||||
git commit --author "nick1 <bugs@company.xx>" -m second |
||||
' |
||||
|
||||
cat >expect <<\EOF |
||||
A U Thor (1): |
||||
initial |
||||
|
||||
nick1 (1): |
||||
second |
||||
|
||||
EOF |
||||
|
||||
test_expect_success 'No mailmap' ' |
||||
git shortlog HEAD >actual && |
||||
test_cmp expect actual |
||||
' |
||||
|
||||
cat >expect <<\EOF |
||||
Repo Guy (1): |
||||
initial |
||||
|
||||
nick1 (1): |
||||
second |
||||
|
||||
EOF |
||||
|
||||
test_expect_success 'default .mailmap' ' |
||||
echo "Repo Guy <author@example.com>" > .mailmap && |
||||
git shortlog HEAD >actual && |
||||
test_cmp expect actual |
||||
' |
||||
|
||||
# Using a mailmap file in a subdirectory of the repo here, but |
||||
# could just as well have been a file outside of the repository |
||||
cat >expect <<\EOF |
||||
Internal Guy (1): |
||||
second |
||||
|
||||
Repo Guy (1): |
||||
initial |
||||
|
||||
EOF |
||||
test_expect_success 'mailmap.file set' ' |
||||
mkdir internal_mailmap && |
||||
echo "Internal Guy <bugs@company.xx>" > internal_mailmap/.mailmap && |
||||
git config mailmap.file internal_mailmap/.mailmap && |
||||
git shortlog HEAD >actual && |
||||
test_cmp expect actual |
||||
' |
||||
|
||||
cat >expect <<\EOF |
||||
External Guy (1): |
||||
initial |
||||
|
||||
Internal Guy (1): |
||||
second |
||||
|
||||
EOF |
||||
test_expect_success 'mailmap.file override' ' |
||||
echo "External Guy <author@example.com>" >> internal_mailmap/.mailmap && |
||||
git config mailmap.file internal_mailmap/.mailmap && |
||||
git shortlog HEAD >actual && |
||||
test_cmp expect actual |
||||
' |
||||
|
||||
cat >expect <<\EOF |
||||
Repo Guy (1): |
||||
initial |
||||
|
||||
nick1 (1): |
||||
second |
||||
|
||||
EOF |
||||
|
||||
test_expect_success 'mailmap.file non-existant' ' |
||||
rm internal_mailmap/.mailmap && |
||||
rmdir internal_mailmap && |
||||
git shortlog HEAD >actual && |
||||
test_cmp expect actual |
||||
' |
||||
|
||||
cat >expect <<\EOF |
||||
A U Thor (1): |
||||
initial |
||||
|
||||
nick1 (1): |
||||
second |
||||
|
||||
EOF |
||||
test_expect_success 'No mailmap files, but configured' ' |
||||
rm .mailmap && |
||||
git shortlog HEAD >actual && |
||||
test_cmp expect actual |
||||
' |
||||
|
||||
test_done |
Loading…
Reference in new issue