mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +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:
|
if not repo:
|
||||||
return
|
return
|
||||||
|
|
||||||
user_name = repo.git.config("--get", "user.name") or None
|
try:
|
||||||
user_email = repo.git.config("--get", "user.email") or None
|
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:
|
if user_name and user_email:
|
||||||
return repo.working_tree_dir
|
return repo.working_tree_dir
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue