Git::Mailmap - Construct and read/write Git mailmap file.
version 0.001
require Git::Mailmap; my $mailmap_file_as_string = '<cto@company.xx> <cto@coompany.xx> Some Dude <some@dude.xx> nick1 <bugs@company.xx> Other Author <other@author.xx> nick2 <bugs@company.xx> '; my $mailmap = Git::Mailmap->new(); # => isa 'Git::Mailmap2' $mailmap->from_string($mailmap_file_as_string); my $correct = $mailmap->verify( 'proper-email' => '<cto@company.xx>'); # => 1 my $fail = $mailmap->verify( 'proper-email' => '<cto@company.xx>', 'proper-name' => 'CTO'); # => 0 # Fail: no email address with that name! my ($mapped_to_name, $mapped_to_email) = $mailmap->map( 'email' => '<bugs@company.xx>', 'name' => 'nick1'); # mapped_to_name => 'Some Dudeeed' # mapped_to_email => '<some@dude.xx>' my @mapped_to = $mailmap->map('email' => '<cto@coompany.xx>'); # mapped_to => is_deeply (undef, '<cto@company.xx>')
Git::Mailmap is a Perl implementation of the mailmap functionality in Git. It allows to create a mailmap by adding a mapped address at a time, or removing unwanted ones. You can also read or write the mailmap file as a string.
For mailmap, please see http://git-scm.com/docs/git-shortlog#_mapping_authors
Package Git::Mailmap is currently being developed so changes in the API and functionality are possible, though not likely.
The Git::Mailmap package requires the following packages (in addition to normal Perl core packages):
Creator function.
Map the committer name and email to proper name/email. The email can be proper-email or committer-email (alias). Email is mandatory parameter. If also name is given, then looks for both. If only email, then the mapping is done to the first matching email address, regardless of the name.
Add new committer. Add all other information.
Search for a given name and/or email.
Remove committer information. Remove as much information as you can.
Read the committers from a string.
Return a string. If you give the parameter filename, the mailmap will be written directly to file. If you give no parameters, this method will return a string consisting of the same text which otherwise would have been written to a file.
Mikko Koivunalho <mikko.koivunalho@iki.fi>
This software is copyright (c) 2015 by Mikko Koivunalho.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Git::Mailmap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Mailmap
CPAN shell
perl -MCPAN -e shell install Git::Mailmap
For more information on module installation, please visit the detailed CPAN module installation guide.