Documentation
¶
Overview ¶
Package mailmap parses Git .mailmap files and resolves author identities.
Parse accepts the four mailmap forms for replacing names, email addresses, or both. Names and email addresses match without regard to case. Entries matching both name and email take priority over entries matching only email; within either group, the last matching entry wins.
Blank lines, comments starting with #, and malformed entries are skipped. Parse returns a partially populated Mailmap together with any reader or scanner error. It uses bufio.Scanner's default token limit.
An empty, zero-value, or nil Mailmap returns identities unchanged.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mailmap ¶
type Mailmap struct {
// contains filtered or unexported fields
}
Mailmap holds parsed .mailmap entries and resolves author identities.
func Parse ¶
Parse reads a .mailmap file and returns a Mailmap for resolving identities.
Example ¶
package main
import (
"fmt"
"strings"
"github.com/git-pkgs/mailmap"
)
func main() {
m, err := mailmap.Parse(strings.NewReader(`Jane Doe <jane@example.com> <jane@laptop.(none)>
`))
if err != nil {
panic(err)
}
name, email := m.Resolve("jane", "jane@laptop.(none)")
fmt.Printf("%s <%s>\n", name, email)
}
Output: Jane Doe <jane@example.com>