mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
Merge pull request #3423 from akirak/git-config
Retrieve the identity using git-config command
This commit is contained in:
commit
e6e692dc43
2 changed files with 3 additions and 12 deletions
|
@ -126,17 +126,8 @@ def setup_git(git_root, io):
|
|||
if not repo:
|
||||
return
|
||||
|
||||
user_name = None
|
||||
user_email = None
|
||||
with repo.config_reader() as config:
|
||||
try:
|
||||
user_name = config.get_value("user", "name", None)
|
||||
except (configparser.NoSectionError, configparser.NoOptionError):
|
||||
pass
|
||||
try:
|
||||
user_email = config.get_value("user", "email", None)
|
||||
except (configparser.NoSectionError, configparser.NoOptionError):
|
||||
pass
|
||||
user_name = repo.git.config("--default", "", "--get", "user.name") or None
|
||||
user_email = repo.git.config("--default", "", "--get", "user.email") or None
|
||||
|
||||
if user_name and user_email:
|
||||
return repo.working_tree_dir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue