Lawrence Barsanti
Lawrence Barsanti

Reputation: 33222

git-am not reading configuration correctly

It appears that git am --continue is not reading my configuration correctly.

git am --continue 
Applying: 
fatal: empty ident name (for <>) notallowed

I tried following the advice in git post-receive hook "empty ident name". Initially user.name and user.email were correct when running git config --global -l. I followed the advice in the previous question so the exact same values are also returned for git config --local -l.

I find it strange that (for <>) is in the error message. From the configuration in mentioned question, it looks like remote.origin.url is being ignored.

My setup works flawlessly otherwise. This is the first time I've run into this type of error.

Any suggestions?

Upvotes: 2

Views: 815

Answers (2)

VonC
VonC

Reputation: 1323115

Another case where git am might ignore the name: Git historically rejected a very short string as an author name while accepting a patch e-mail.

Git 2.33 (Q3 2021) fixes that.

See commit 72ee47c (16 May 2021) by edef (edef1c).
(Merged by Junio C Hamano -- gitster -- in commit 26b25e0, 10 Jun 2021)

mailinfo: don't discard names under 3 characters

Signed-off-by: edef

I sometimes receive patches from people with short mononyms, and in my cultural environment these are not uncommon (as seen in "Falsehoods Programmers Believe About Names").
To my dismay, git-am(man) currently discards their names, and replaces them with their email addresses.

Upvotes: 0

Benno
Benno

Reputation: 5456

I think the fact git am ignores the global configuration values is by design - the commit should have the the name/email of the patch author, not yours.

Instead, when continuing, git am reads this information from the file .git/rebase-apply/author-script, which should have been filled with the correct values by git mailinfo before stopping:

GIT_AUTHOR_NAME='Committer'
GIT_AUTHOR_EMAIL='[email protected]'
GIT_AUTHOR_DATE='Thu, 28 Apr 2016 11:38:59 -0700'

Most likely, the applied .patch-file was not correctly formatted (i.e. missing From: and Date: lines), so that git mailinfo wasn't able to figure out these values.

You can enter them manually and then run git am --continue to continue with the correct values.

Upvotes: 3

Related Questions