-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow us to read, and default to read, mailmap files from the tip of the history in bare repositories. This will help running tools like shortlog in server settings. * jk/mailmap-from-blob: mailmap: default mailmap.blob in bare repositories mailmap: fix some documentation loose-ends for mailmap.blob mailmap: clean up read_mailmap error handling mailmap: support reading mailmap from blobs mailmap: refactor mailmap parsing for non-file sources
- Loading branch information
Showing
7 changed files
with
214 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,104 @@ test_expect_success 'No mailmap files, but configured' ' | |
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'setup mailmap blob tests' ' | ||
git checkout -b map && | ||
test_when_finished "git checkout master" && | ||
cat >just-bugs <<-\EOF && | ||
Blob Guy <[email protected]> | ||
EOF | ||
cat >both <<-\EOF && | ||
Blob Guy <[email protected]> | ||
Blob Guy <[email protected]> | ||
EOF | ||
git add just-bugs both && | ||
git commit -m "my mailmaps" && | ||
echo "Repo Guy <[email protected]>" >.mailmap && | ||
echo "Internal Guy <[email protected]>" >internal.map | ||
' | ||
|
||
test_expect_success 'mailmap.blob set' ' | ||
cat >expect <<-\EOF && | ||
Blob Guy (1): | ||
second | ||
Repo Guy (1): | ||
initial | ||
EOF | ||
git -c mailmap.blob=map:just-bugs shortlog HEAD >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'mailmap.blob overrides .mailmap' ' | ||
cat >expect <<-\EOF && | ||
Blob Guy (2): | ||
initial | ||
second | ||
EOF | ||
git -c mailmap.blob=map:both shortlog HEAD >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'mailmap.file overrides mailmap.blob' ' | ||
cat >expect <<-\EOF && | ||
Blob Guy (1): | ||
second | ||
Internal Guy (1): | ||
initial | ||
EOF | ||
git \ | ||
-c mailmap.blob=map:both \ | ||
-c mailmap.file=internal.map \ | ||
shortlog HEAD >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'mailmap.blob can be missing' ' | ||
cat >expect <<-\EOF && | ||
Repo Guy (1): | ||
initial | ||
nick1 (1): | ||
second | ||
EOF | ||
git -c mailmap.blob=map:nonexistent shortlog HEAD >actual && | ||
test_cmp expect actual | ||
' | ||
|
||
test_expect_success 'mailmap.blob defaults to off in non-bare repo' ' | ||
git init non-bare && | ||
( | ||
cd non-bare && | ||
test_commit one .mailmap "Fake Name <[email protected]>" && | ||
echo " 1 Fake Name" >expect && | ||
git shortlog -ns HEAD >actual && | ||
test_cmp expect actual && | ||
rm .mailmap && | ||
echo " 1 A U Thor" >expect && | ||
git shortlog -ns HEAD >actual && | ||
test_cmp expect actual | ||
) | ||
' | ||
|
||
test_expect_success 'mailmap.blob defaults to HEAD:.mailmap in bare repo' ' | ||
git clone --bare non-bare bare && | ||
( | ||
cd bare && | ||
echo " 1 Fake Name" >expect && | ||
git shortlog -ns HEAD >actual && | ||
test_cmp expect actual | ||
) | ||
' | ||
|
||
test_expect_success 'cleanup after mailmap.blob tests' ' | ||
rm -f .mailmap | ||
' | ||
|
||
# Extended mailmap configurations should give us the following output for shortlog | ||
cat >expect <<\EOF | ||
A U Thor <[email protected]> (1): | ||
|