hatch new does not use git's user.email setting if defined via an includeIf config file
My git config is as follows:
You can see that I define a separate user.email depending on which forge I'm working with. With this any repo created under a github directory will use the user.email defined in the ~/.gitconfig-github file etc.
However, hatch new does not see this setting because the project directory it creates is not a git repo. In fact, hatch new I believe would have to create the project directory and initialise it as a git repo before creating the pyproject.toml with the correct user.name. Could hatch new be updated to accommodate such a git configuration? I think having the project directory also a repository when it is created would be a welcome feature as well. Thanks.
Thanks! Two questions:
- Is there a way on the command line to access that?
- Regarding initializing Git in new projects, what do other tools do? I'm thinking Cargo, NPM, etc.
- Is there a way on the command line to access that?
Something like the following will work but only if the project directory is a git repo. Until it is a git repo any settings defined in git includeIf config file are not available - not even to git. So the only way I see that this could work is if hatch new initialises the project directory as a git repository before it does anything else. If it did that then any includeIf settings would be available to it to use.
git config --get-regexp "^user.(name|email)$"
- Regarding initializing Git in new projects, what do other tools do? I'm thinking Cargo, NPM, etc.
I can't speak to the tools you have mentioned as I'm just learning (with python) and have never used them. I can say though that rye a similar tool to hatch does this. It wasn't correctly picking up my user.email setting however but it does now after I reported the issue.