From e52807b86812de0e3c84a0228be7bce3bc8ab478 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sun, 23 Jul 2023 10:31:59 -0300 Subject: [PATCH 1/5] cleanup --- tests/test_commands.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_commands.py b/tests/test_commands.py index 20787ccc9..706755ed9 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -25,10 +25,7 @@ class TestCommands(TestCase): def tearDown(self): os.chdir(self.original_cwd) - try: - shutil.rmtree(self.tempdir) - except OSError: - pass # Ignore errors (Windows) + shutil.rmtree(self.tempdir, ignore_errors=True) def test_cmd_add(self): # Initialize the Commands and InputOutput objects From e63ae71e3e1f4f4fa198c39334e1a88526fb15d9 Mon Sep 17 00:00:00 2001 From: paul-gauthier <69695708+paul-gauthier@users.noreply.github.com> Date: Sun, 23 Jul 2023 16:17:50 -0300 Subject: [PATCH 2/5] Update install.md --- docs/install.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/install.md b/docs/install.md index 0389a0ba4..f0eb4049f 100644 --- a/docs/install.md +++ b/docs/install.md @@ -56,6 +56,9 @@ See the [usage instructions](/#usage) to start coding with aider. The rest of the install steps are completely optional. +--- + + ## Install universal ctags (optional) Aider does not require ctags, and will operate just fine without it. From 8c6b50c64f43c2e7d4cd5ad4bc8e25ac0a7b5ea8 Mon Sep 17 00:00:00 2001 From: paul-gauthier <69695708+paul-gauthier@users.noreply.github.com> Date: Sun, 23 Jul 2023 16:18:30 -0300 Subject: [PATCH 3/5] Update install.md --- docs/install.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/install.md b/docs/install.md index f0eb4049f..10827338b 100644 --- a/docs/install.md +++ b/docs/install.md @@ -4,6 +4,9 @@ - [pip install aider-chat](#pip-install-aider-chat) - [Provide your OpenAI API key](#provide-your-openai-api-key) - [Install git](#install-git) + +Optional steps: + - [Install universal ctags (optional)](#install-universal-ctags-optional) - [Add aider to your editor (optional)](#add-aider-to-your-editor-optional) From 96f15c45334f9adc138199e18239e90a283a1831 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 24 Jul 2023 13:05:00 -0300 Subject: [PATCH 4/5] Be sure to include staged files in get_tracked_files --- aider/coders/base_coder.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 35cd6e25c..22f325922 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1014,6 +1014,11 @@ class Coder: if blob.type == "blob": # blob is a file files.append(blob.path) + # Add staged files + index = self.repo.index + staged_files = [item.a_path for item in index.diff("HEAD")] + files.extend(staged_files) + # convert to appropriate os.sep, since git always normalizes to / res = set(str(Path(PurePosixPath(path))) for path in files) From 745b3c320b82b1a29782694a2859f56aaa15c38f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 24 Jul 2023 14:00:35 -0300 Subject: [PATCH 5/5] Scan the git index using entries, which does not rely on a prior commit --- aider/coders/base_coder.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 22f325922..c5ace1287 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1007,16 +1007,18 @@ class Coder: try: commit = self.repo.head.commit except ValueError: - return set() + commit = None files = [] - for blob in commit.tree.traverse(): - if blob.type == "blob": # blob is a file - files.append(blob.path) + if commit: + for blob in commit.tree.traverse(): + if blob.type == "blob": # blob is a file + files.append(blob.path) # Add staged files index = self.repo.index - staged_files = [item.a_path for item in index.diff("HEAD")] + staged_files = [path for path, _ in index.entries.keys()] + files.extend(staged_files) # convert to appropriate os.sep, since git always normalizes to /