1
0
Fork 0

fix(shared): Make git author script more robust

This commit is contained in:
Joost De Cock 2023-05-22 15:56:30 +02:00
parent 83cb6b229c
commit f15f6f93b3

View file

@ -34,8 +34,14 @@ export const getGitMetadata = async (file, site) => {
}
}
if (!key) {
console.log({ email, author, slug })
throw `Git author email ${email} is unknown in the git-to-author table`
if (typeof email === 'undefined' && typeof email === 'undefined') {
// This means files lack git history (they are new and haven't been committed yet)
authors.add('unknown')
} else {
// There is a git history, but the author is not known
console.log({ email, author, slug })
throw `Git author email ${email} is unknown in the git-to-author table`
}
} else authors.add(key)
}