Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hatch new does not use git's user.email setting if defined via an includeIf config file #968

Open
doolio opened this issue Sep 13, 2023 Discussed in #954 · 2 comments
Open

Comments

@doolio
Copy link

doolio commented Sep 13, 2023

My git config is as follows:

image

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.

@ofek
Copy link
Collaborator

ofek commented Sep 13, 2023

Thanks! Two questions:

  1. Is there a way on the command line to access that?
  2. Regarding initializing Git in new projects, what do other tools do? I'm thinking Cargo, NPM, etc.

@doolio
Copy link
Author

doolio commented Sep 13, 2023

  1. 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)$"
  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants