mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
fix: Handle GitCommandError when retrieving git user config
This commit is contained in:
parent
a3c0d628a1
commit
987d024847
1 changed files with 9 additions and 2 deletions
|
@ -126,8 +126,15 @@ def setup_git(git_root, io):
|
|||
if not repo:
|
||||
return
|
||||
|
||||
user_name = repo.git.config("--get", "user.name") or None
|
||||
user_email = repo.git.config("--get", "user.email") or None
|
||||
try:
|
||||
user_name = repo.git.config("--get", "user.name") or None
|
||||
except git.exc.GitCommandError:
|
||||
user_name = None
|
||||
|
||||
try:
|
||||
user_email = repo.git.config("--get", "user.email") or None
|
||||
except git.exc.GitCommandError:
|
||||
user_email = None
|
||||
|
||||
if user_name and user_email:
|
||||
return repo.working_tree_dir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue