[PATCH 2 of 2 stable v2] tests: prevent Git system and global configuration from loading

Mads Kiilerich mads at kiilerich.com
Wed Apr 19 14:27:37 UTC 2023


On 19/04/2023 15:14, Manuel Jacob wrote:
> On 19/04/2023 14.27, Mads Kiilerich wrote:
>> On 18/04/2023 20:35, Manuel Jacob wrote:
>> ...
>> I think this changeset should come first. As you say, it makes the 
>> test work the same way everywhere. user.useconfigonly is probably 
>> just one of many settings that could break it.
>>
>>
>> If it still doesn't work for you with this change (without the 
>> previous change), it can't be because your setup has 
>> user.useconfigonly set. There must be some other explanation.
>
> If I have only this changeset without the parent, command `git commit 
> -m "committed new 0" --author "User ǝɯɐᴎ <me at example.com>" 
> "97u1nbm0setup.py"` fails with:
>
> Committer identity unknown
>
> *** Please tell me who you are.
> ...

Ok, after experimenting and reading git man pages, the shortest and 
clearest description seems to be:

The git commit --author option can tell git to use another name as 
author when committing, but git still has to know the user to use as 
committer (to be shown with --format=full).

Without any git user configuration (for example because there is no 
~/.gitconfig or because GIT_CONFIG_GLOBAL=/dev/null or because 
user.useConfigOnly), commit will fail with some kind of error, even if 
--author is specified.

But if EMAIL is set (and without user.useConfigOnly), it will use that 
as username, apparently combined with the getpwnam gecos information.


The following thus seems to works for me - no matter what global/system 
git configuration I have:

GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null EMAIL='foo at bar' 
git commit -m "committed new 0" --author "User ǝɯɐᴎ <me at example.com>"

Silently dropping the setting of EMAIL in the first changeset is thus a 
bit risky. Could the consequences of that perhaps have interfered with 
your testing?

/Mads



More information about the kallithea-general mailing list