class
Agate::Mailmap
- Agate::Mailmap
- Reference
- Object
Overview
A mailmap for resolving alternate author/committer names and emails.
# Load from a repository's .mailmap
mm = Mailmap.from_repository(repo)
name, email = mm.resolve("J. Doe", "john@old.com")
# Parse from a string
mm = Mailmap.from_buffer("Proper Name <proper@email.com> <old@email.com>\n")
name, email = mm.resolve("", "old@email.com")
name # => "Proper Name"
email # => "proper@email.com"
# Resolve a signature
resolved = mm.resolve_signature(commit.author)
Defined in:
agate/mailmap.crConstructors
-
.from_buffer(content : String) : Mailmap
Parses a mailmap from a string buffer.
-
.from_repository(repo : Repository) : Mailmap
Loads the mailmap from a repository's configuration (
.mailmapfile,mailmap.blob,mailmap.file). -
.new : Mailmap
Creates a new empty mailmap.
Instance Method Summary
-
#add_entry(real_name : String | Nil = nil, real_email : String | Nil = nil, replace_name : String | Nil = nil, replace_email : String = "") : Nil
Adds an entry to the mailmap.
-
#resolve(name : String, email : String) : Tuple(String, String)
Resolves a name and email pair through the mailmap.
- #resolve_signature(sig : Signature) : Signature
Constructor Detail
Parses a mailmap from a string buffer.
Loads the mailmap from a repository's configuration
(.mailmap file, mailmap.blob, mailmap.file).
Instance Method Detail
def add_entry(real_name : String | Nil = nil, real_email : String | Nil = nil, replace_name : String | Nil = nil, replace_email : String = "") : Nil
#
Adds an entry to the mailmap.
- real_name: the canonical name (or nil to keep original)
- real_email: the canonical email (or nil to keep original)
- replace_name: the name to match (or nil to match any name)
- replace_email: the email to match (required)
def resolve(name : String, email : String) : Tuple(String, String)
#
Resolves a name and email pair through the mailmap.
Returns {resolved_name, resolved_email}.