Download raw body.
regress: unset HOME for 'git init'
On Fri, Aug 15, 2025 at 01:04:34PM +0100, Thomas Adam wrote:
> Hi,
>
> When running regress, there's a potential that the "git init" command could
> implicitly use ~/.gitconfig -- this has consequences for us, since this file
> could affect the created git repo.
>
> Specifically though, it's possible that the default branch name could be
> anything, rather than what we want it to be -- which should be to match the
> default for git(1). Although this is still marked as a TODO item in
> regress/cmdline/common.sh -- I think for now, explicitly making git(1) think
> there's no ~/.gitconfig is the way to go -- we can address any specific git
> issues we want to set (such as the default branch name) at a later date.
>
> OK?
I would suggest to set GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM to /dev/null,
rather than unsetting HOME. And we should probably do this across the entire
test suite, not just during 'git init'.
GIT_CONFIG_GLOBAL, GIT_CONFIG_SYSTEM
Take the configuration from the given files instead from global or
system-level configuration files. If GIT_CONFIG_SYSTEM is set, the
system config file defined at build time (usually /etc/gitconfig)
will not be read. Likewise, if GIT_CONFIG_GLOBAL is set, neither
$HOME/.gitconfig nor $XDG_CONFIG_HOME/git/config will be read. Can be
set to /dev/null to skip reading configuration files of the
respective level.
regress: unset HOME for 'git init'