diff --git a/aider/main.py b/aider/main.py index 3e16120fb..e28fa7676 100644 --- a/aider/main.py +++ b/aider/main.py @@ -24,12 +24,15 @@ from .dump import dump # noqa: F401 def setup_git_home(io): home = Path.home() - git_repos = list(home.glob("*/.git")) + home_git = home / ".git" + git_repos = [home_git] if home_git.exists() else [] + git_repos.extend(home.glob("*/.git")) if git_repos: - io.tool_output("Found existing Git repositories in folders in your home directory:") + io.tool_output("Found existing Git repositories in your home directory:") for i, repo in enumerate(git_repos, 1): - io.tool_output(f"{i}. {repo.parent.name}") + repo_name = "Home directory" if repo == home_git else repo.parent.name + io.tool_output(f"{i}. {repo_name}") while True: choice = io.prompt_ask( @@ -42,11 +45,12 @@ def setup_git_home(io): try: choice_num = int(choice) if 1 <= choice_num <= len(git_repos): - return str(git_repos[choice_num - 1].parent) + chosen_repo = git_repos[choice_num - 1] + return str(home if chosen_repo == home_git else chosen_repo.parent) else: io.tool_error(f"Please enter a number between 1 and {len(git_repos)}") except ValueError: - io.tool_error("Please enter a valid number or 'n'") + io.tool_error("Please enter a valid number") project_name = io.user_input("Enter a name for your new project directory: ") new_dir = home / project_name