Skip to content

bin: use --no-mailmap when loading commits#148

Open
mcollina wants to merge 1 commit into
mainfrom
fix-no-mailmap-signedoff
Open

bin: use --no-mailmap when loading commits#148
mcollina wants to merge 1 commit into
mainfrom
fix-no-mailmap-signedoff

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented May 2, 2026

Summary

  • load commits with git show --no-mailmap so validation uses the raw commit author
  • avoid false Signed-off-by mismatch warnings caused by .mailmap rewriting
  • add a CLI regression test covering a mailmapped author/sign-off pair

Testing

  • node test/cli-test.js
  • npm test

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina requested a review from aduh95 May 28, 2026 15:20
Comment thread test/cli-test.js
Comment on lines +401 to +410
const defaultShow = git(repoDir, ['show', '--quiet', '--format=medium', 'HEAD'])
const rawShow = git(repoDir, ['show', '--no-mailmap', '--quiet', '--format=medium', 'HEAD'])

tt.match(defaultShow,
/Author:\s+Matteo Collina <matteo\.collina@gmail\.com>/,
'git show applies mailmap by default')
tt.match(rawShow,
/Author:\s+Matteo Collina <hello@matteocollina\.com>/,
'git show --no-mailmap preserves the raw author email')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would make the test fail for unrelated reasons (e.g if the git global config disables mailmaps)

Comment thread test/cli-test.js
Comment on lines +377 to +387
const repoDir = mkdtempSync(join(tmpdir(), 'core-validate-commit-'))
const env = {
GIT_AUTHOR_NAME: 'Matteo Collina',
GIT_AUTHOR_EMAIL: 'hello@matteocollina.com',
GIT_COMMITTER_NAME: 'Matteo Collina',
GIT_COMMITTER_EMAIL: 'hello@matteocollina.com'
}

git(repoDir, ['init', '-b', 'main'])
git(repoDir, ['config', 'user.name', 'Test User'])
git(repoDir, ['config', 'user.email', 'test@example.com'])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instead use this repo like is done for the other tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants