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

Does not get git user.email value if defined within an includeif gitconfig file #435

Closed
doolio opened this issue Aug 31, 2023 · 12 comments · Fixed by #443
Closed

Does not get git user.email value if defined within an includeif gitconfig file #435

doolio opened this issue Aug 31, 2023 · 12 comments · Fixed by #443

Comments

@doolio
Copy link

doolio commented Aug 31, 2023

rye already initialises the project directory as a git repository - great. I don't know the order in which it does this but could it use a user's git name and email settings and include those in the pyproject.toml it creates?

@CharlesChen0823
Copy link
Contributor

rye using git config user and email, or you can set author in config.toml file(which describes in document)

@doolio
Copy link
Author

doolio commented Aug 31, 2023

rye using git config user and email

Right you are but not in all cases it seems. See below. I've changed the issue title accordingly.

image

@doolio doolio changed the title FR: Use git name email values in pyproject.toml Does not get git user.email value if defined within an includeif gitconfig file Aug 31, 2023
@CharlesChen0823
Copy link
Contributor

can you show the output git config --get-regexp "^user.(name|email)$"

@doolio
Copy link
Author

doolio commented Sep 1, 2023

That seems to work.

image

@CharlesChen0823
Copy link
Contributor

I can't reproduce, can you show the steps of reproduce?

@doolio
Copy link
Author

doolio commented Sep 5, 2023

Of course. So firstly, my git config is as follows such that any repository in the "github" directory will use the github associated user.email.

image

Steps to reproduce:

  1. Match my git config with some valid email address
  2. Create a directory for a rye managed python project
  3. cd into this directory
  4. Execute rye init which initialises the project directory as a git repository - great
  5. Check user.email setting in this repository which should be set according to my git config - it is
  6. Check email setting in the pyproject.toml expecting it to match user.email setting - it does not

image

@CharlesChen0823
Copy link
Contributor

Thanks, I reproduce.
In my test, currently includeIf only work at an exists git repository.
When create new project, rye init firstly generate pyproject.toml, then try execute git init; so git command cannot get the content of includeIf at the steps of generating pyproject.toml.

@doolio
Copy link
Author

doolio commented Sep 6, 2023

When create new project, rye init firstly generate pyproject.toml, then try execute git init; so git command cannot get the content of includeIf at the steps of generating pyproject.toml.

OK, so it could only work if rye init produces the pyproject.toml last. Is that a possibility? I would think many people use different emails with git and so don't set at the global level.

@CharlesChen0823
Copy link
Contributor

I have try fix this problem includeif not work, but not sure this is a better.

@doolio
Copy link
Author

doolio commented Sep 7, 2023

I have try fix this problem includeif not work, but not sure this is a better.

How can I test if I have official rye already installed?

@mitsuhiko
Copy link
Collaborator

@doolio you can validate with this command if you have a rust compiler installation:

rye update --rev e7d070402b5fdb2a73e92d3e1f09e530841fec8b

@doolio
Copy link
Author

doolio commented Sep 8, 2023

@mitsuhiko thanks I hadn't but I removed my binary install and installed the latest version via cargo. However, your suggested command does not work. It returns unrecognized subcommand error which tallies with update not being a current subcommand of the latest version of rye or at least not the version I installed via cargo. Did you perhaps mean:

rye self update --rev e7d070402b5fdb2a73e92d3e1f09e530841fec8b

I went ahead and tried that in any case and it finished with the following output which I take means it is now at this commit.

image

Testing this commit I can state it is doing as I would like in using the user.email setting from an includeif git config file within the pyproject.toml. I hope the re-ordering of the steps performed by rye init to allow this don't have any unforeseen consequences as I think this is a small but very helpful feature that users that use different emails with git would appreciate. I personally would be very happy to see this commit merged into main. Thanks for looking into this and providing a solution @CharlesChen0823.

image

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

Successfully merging a pull request may close this issue.

3 participants