fix logic when there is no git repo

This commit is contained in:
Paul Gauthier 2023-05-11 06:01:37 -07:00
parent 86ba5c778c
commit a614179209
2 changed files with 11 additions and 7 deletions

View file

@ -1,15 +1,15 @@
# Aider # Aider
Aider is a command-line tool that allows you to chat with GPT-4 about your code. Aider is a command-line tool that allows you to chat with GPT-4 about your code.
Aider will directly edit your source files as directed by the GPT-4 chat, and commit those changes to your local git repo. Ask GPT for features, improvements, and bug fixes and aider will directly apply the changes to your source files.
Each change is automatically committed to git with a sensible commit message, making it easy and safe for aider to help you code. Each change is automatically committed to git with a sensible commit message.
[![asciicast](https://asciinema.org/a/eDDqO3PlqH4lUBBXnLlMG7l2x.svg)](https://asciinema.org/a/eDDqO3PlqH4lUBBXnLlMG7l2x) [![asciicast](https://asciinema.org/a/eDDqO3PlqH4lUBBXnLlMG7l2x.svg)](https://asciinema.org/a/eDDqO3PlqH4lUBBXnLlMG7l2x)
## Features ## Features
* Chat with GPT-4 about your code by launching aider with set of source files to discuss and edit together. * Chat with GPT-4 about your code by launching aider with set of source files to discuss and edit together.
* Request changes, improvements, and bug fixes to your code. * Request new features, changes, improvements, and bug fixes to your code. Ask for new test cases, updated documentation or code refactors.
* Aider will apply the edits suggested by GPT-4 directly to your source files. * Aider will apply the edits suggested by GPT-4 directly to your source files.
* Aider will automatically commit each changeset to your local git repo with a sensible commit message. These frequent, automatic commits provide a safety net. It's easy to undo aider's changes or use standard git workflows to manage longer sequences of changes. * Aider will automatically commit each changeset to your local git repo with a sensible commit message. These frequent, automatic commits provide a safety net. It's easy to undo aider's changes or use standard git workflows to manage longer sequences of changes.
* Aider can review multiple source files at once and make coordinated code changes across all of them in a single changeset/commit. * Aider can review multiple source files at once and make coordinated code changes across all of them in a single changeset/commit.

View file

@ -79,6 +79,14 @@ class Coder:
repo_paths.append(repo_path) repo_paths.append(repo_path)
except git.exc.InvalidGitRepositoryError: except git.exc.InvalidGitRepositoryError:
pass pass
if fname.is_dir():
continue
self.console.print(f"[bright_black]Loading {fname}")
fname = fname.resolve()
self.abs_fnames.add(str(fname))
num_repos = len(set(repo_paths)) num_repos = len(set(repo_paths))
if num_repos == 0: if num_repos == 0:
@ -95,10 +103,6 @@ class Coder:
new_files = [] new_files = []
for fname in abs_fnames: for fname in abs_fnames:
if fname.is_dir():
continue
self.console.print(f"[bright_black]Loading {fname}")
fname = fname.resolve() fname = fname.resolve()
self.abs_fnames.add(str(fname)) self.abs_fnames.add(str(fname))