mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
catch configparser errors
This commit is contained in:
parent
238b53e2ff
commit
0f9efc881e
1 changed files with 11 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
import configparser
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -57,9 +58,17 @@ def setup_git(git_root, io):
|
||||||
if not repo:
|
if not repo:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
user_name = None
|
||||||
|
user_email = None
|
||||||
with repo.config_reader() as config:
|
with repo.config_reader() as config:
|
||||||
user_name = config.get_value("user", "name", None)
|
try:
|
||||||
user_email = config.get_value("user", "email", None)
|
user_name = config.get_value("user", "name", None)
|
||||||
|
except configparser.NoSectionError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
user_email = config.get_value("user", "email", None)
|
||||||
|
except configparser.NoSectionError:
|
||||||
|
pass
|
||||||
|
|
||||||
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