Open sean-c-johnston opened 4 months ago
There should be no need to shell out to git config
, gix-config
should work well enough for this.
If we implement the continuous version of this, I think it should be implemented by copying the git config at the start of every command. The code that creates new commits should not have any git-specific logic.
Is your feature request related to a problem? Please describe. I have multiple git identities so that I can separate my personal and work GitHub accounts, managed using
[includeIf]
in git config, to load additional work/personal config files depending on the repo's path.I would like to be able to accomplish this with
jj
as well, without relying on myself to remember to set up a per-repo config each time.Describe the solution you'd like Provide an option in
jj/config.toml
which allows inheriting user name and email from git. e.g.user.inherit_from_git
or similar.I think this can be achieved using the git CLI: running
git config user.name
andgit config user.email
to let git resolve those values instead of implementing any logic to locate and handle.gitconfig
files.This could either:
user.name
anduser.email
when runningjj git clone
orjj git init
if this config value is set.user.name
anduser.email
every timejj
performs an action that modifies the author of a commit, as this would then allow it to stay up-to-date with any git config changes.These behaviours could even both be available -
user.inherit_from_git = always
oruser.inherit_from_git = once
for example.Describe alternatives you've considered As mentioned, this could be handled in a per-repo configuration (but this is manual and error prone).
Additional context I think ultimately, adding more complex
jj
configuration options to allow similar setups is inevitable given thatjj
has its own backend which does not rely on git, but that seems like a lot more work.In the meantime, this would allow users with multiple git identities to transition to
jj
much more easily.