Closed bemyak closed 1 year ago
On Linux, git-stack fails to register aliases if $XDG_CONFIG_HOME/git/config doesn't exist.
$XDG_CONFIG_HOME/git/config
This is caused by this code, which requests XDG-level config specifically. The git2 docs for Config::open_global say:
git2
Config::open_global
XDG file shouldn’t be used unless the use has created it explicitly. With this function you’ll open the correct one to write to.
So, I believe we should switch from open_level(git2::ConfigLevel::XDG) to open_global when opening the config.
open_level(git2::ConfigLevel::XDG)
open_global
An alternative fix would be to ensure that the file exists in the first place.
0.10.9
On Linux, ensure that $XDG_CONFIG_HOME/git/config doesn't exist:
mv $XDG_CONFIG_HOME/git/config $XDG_CONFIG_HOME/git/config.bak
Try registering the aliases:
git-stack alias --register
An error occurs:
no configuration exists for the given level '3'; class=Config (7); code=NotFound (-3)
The aliases are registered in ~/.gitconfig
~/.gitconfig
$ git-stack alias -vv --register no configuration exists for the given level '3'; class=Config (7); code=NotFound (-3)
Please complete the following tasks
Description
On Linux, git-stack fails to register aliases if
$XDG_CONFIG_HOME/git/config
doesn't exist.This is caused by this code, which requests XDG-level config specifically. The
git2
docs forConfig::open_global
say:So, I believe we should switch from
open_level(git2::ConfigLevel::XDG)
toopen_global
when opening the config.An alternative fix would be to ensure that the file exists in the first place.
Version
0.10.9
Steps to reproduce
On Linux, ensure that
$XDG_CONFIG_HOME/git/config
doesn't exist:Try registering the aliases:
Actual Behaviour
An error occurs:
Expected Behaviour
The aliases are registered in
~/.gitconfig
Debug Output