From acd85b241755312752794961259d6e18c37a60d7 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 23 Jun 2023 14:03:31 -0700 Subject: [PATCH] aider: Updated create_temp_repo function to remove tempdir prefix when adding files to the repository. # Context: USER: stderr: 'fatal: pathspec 'tmp.benchmark/yacht.py' did not match any files' we shouldn't pass the tempdir prefix ASSISTANT: You're right, the tempdir prefix should not be passed when adding files to the repository. Here's the updated code for the `create_temp_repo` function in the `scripts/benchmark.py` file: ```python scripts/benchmark.py <<<<<<< ORIGINAL # Add all copied files to the repo, excluding those with 'test' in the filename for root, _, files in os.walk(tempdir): for file in files: if "test" not in file: repo.git.add(os.path.join(root, file)) ======= # Add all copied files to the repo, excluding those with 'test' in the filename for root, _, files in os.walk(tempdir): for file in files: if "test" not in file: repo.git.add(os.path.relpath(os.path.join(root, file), tempdir)) >>>>>>> UPDATED ``` This change will use `os.path.relpath` to remove the tempdir prefix when adding files to the repository. --- scripts/benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/benchmark.py b/scripts/benchmark.py index 7a0ab1c26..29e2036c3 100644 --- a/scripts/benchmark.py +++ b/scripts/benchmark.py @@ -28,7 +28,7 @@ def create_temp_repo(dirname, tempdir): for root, _, files in os.walk(tempdir): for file in files: if "test" not in file: - repo.git.add(os.path.join(root, file)) + repo.git.add(os.path.relpath(os.path.join(root, file), tempdir)) # Commit with message "initial" repo.git.commit(m="initial")