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

Manuel Jacob me at manueljacob.de
Wed Apr 19 15:27:40 UTC 2023


On 19/04/2023 17.21, Manuel Jacob wrote:
> On 19/04/2023 16.27, Mads Kiilerich wrote:
>> 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>"
> 
> On Arch Linux:
> 
> % git --version
> git version 2.40.0
> % 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>"
> Committer identity unknown
> 
> *** Please tell me who you are.
> 
> Run
> 
>    git config --global user.email "you at example.com"
>    git config --global user.name "Your Name"
> 
> to set your account's default identity.
> Omit --global to set the identity only in this repository.
> 
> fatal: empty ident name (for <foo at bar>) not allowed
> 
> 
> On CentOS 7:
> 
> % git --version
> git version 2.36.5
> % 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>"
> Committer identity unknown
> 
> *** Please tell me who you are.
> 
> Run
> 
>    git config --global user.email "you at example.com"
>    git config --global user.name "Your Name"
> 
> to set your account's default identity.
> Omit --global to set the identity only in this repository.
> 
> fatal: empty ident name (for <foo at bar>) not allowed
> 
> 
> But with openSUSE Leap 15.4 with git 2.35.3, it works (uses $USER as the 
> name).

Same on openSUSE Tumbleweed with git 2.40.0.

> 
>> 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
>>
> 
> _______________________________________________
> kallithea-general mailing list
> kallithea-general at sfconservancy.org
> https://lists.sfconservancy.org/mailman/listinfo/kallithea-general



More information about the kallithea-general mailing list