GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - git-pkgs/mailmap: Parse and resolve Git mailmap identities in Go

BranchesTags
Open more actions menu

Latest commit

 

History

5 Commits
5 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.golangci.yml
.golangci.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
doc.go
doc.go
 
 
go.mod
go.mod
 
 
mailmap.go
mailmap.go
 
 
mailmap_test.go
mailmap_test.go
 
 
precedence_test.go
precedence_test.go
 
 
public_test.go
public_test.go
 
 

Repository files navigation

mailmap

A Go library for parsing Git .mailmap files and resolving author identities. It uses only the standard library and supports the four mailmap entry forms for replacing names, email addresses, or both.

Installation

go get github.com/git-pkgs/mailmap

Usage

package main

import (
	"fmt"
	"log"
	"strings"

	"github.com/git-pkgs/mailmap"
)

func main() {
	m, err := mailmap.Parse(strings.NewReader(`Jane Doe <[email protected]> <jane@laptop.(none)>
`))
	if err != nil {
		log.Fatal(err)
	}
	name, email := m.Resolve("jane", "jane@laptop.(none)")
	fmt.Printf("%s <%s>\n", name, email)
	// Jane Doe <[email protected]>
}

Parse accepts an io.Reader, including an open .mailmap file. New() creates an empty map; empty, zero-value, and nil maps return identities unchanged.

Matching ignores case for names and email addresses, and entries matching both take priority over entries matching only email. The last matching entry in each group wins; unmatched identities are returned unchanged.

Blank lines, comments starting with #, and malformed entries are skipped. Reader errors and lines exceeding the default bufio.Scanner token limit return an error along with the entries parsed so far.

License

MIT.

About

Parse and resolve Git mailmap identities in Go

Topics

gitgolangmailmap

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.