mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
fix: Set git_root to None if no git repositories are found in the home directory
This commit is contained in:
parent
b8a52c2bef
commit
6f09f651a1
1 changed files with 4 additions and 0 deletions
|
@ -25,6 +25,7 @@ from .dump import dump # noqa: F401
|
||||||
def setup_git_home(io):
|
def setup_git_home(io):
|
||||||
home = Path.home()
|
home = Path.home()
|
||||||
git_repos = list(home.glob("*/.git"))
|
git_repos = list(home.glob("*/.git"))
|
||||||
|
git_root = None
|
||||||
|
|
||||||
if git_repos:
|
if git_repos:
|
||||||
io.tool_output("Found git repositories in your home directory:")
|
io.tool_output("Found git repositories in your home directory:")
|
||||||
|
@ -61,6 +62,9 @@ def setup_git_home(io):
|
||||||
else:
|
else:
|
||||||
return # no response
|
return # no response
|
||||||
|
|
||||||
|
if not git_root:
|
||||||
|
return
|
||||||
|
|
||||||
if git_root.exists():
|
if git_root.exists():
|
||||||
if git_root.is_dir():
|
if git_root.is_dir():
|
||||||
os.chdir(git_root)
|
os.chdir(git_root)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue