Skip to content

Commit

Permalink
catch configparser errors
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Mar 10, 2024
1 parent 238b53e commit 0f9efc8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions aider/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import configparser
import os
import sys
from pathlib import Path
Expand Down Expand Up @@ -57,9 +58,17 @@ def setup_git(git_root, io):
if not repo:
return

user_name = None
user_email = None
with repo.config_reader() as config:
user_name = config.get_value("user", "name", None)
user_email = config.get_value("user", "email", None)
try:
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:
return repo.working_tree_dir
Expand Down

0 comments on commit 0f9efc8

Please sign in to comment.