From 296053a8d7da1e85abf03a97e8840d42f73c6917 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 10 May 2023 19:40:35 -0700 Subject: [PATCH] aider: Added commit message to `cmd_add` method to indicate that the file was created and added by the aider. # Context: USER: also commit the add with a suitable message ASSISTANT: To commit the added file with a suitable message, we will modify the `cmd_add` method in the `aider/commands.py` file. After adding the file to git, we will commit it with a message indicating that the file was created and added by the aider. Here are the changes to the `aider/commands.py` file: ```python aider/commands.py <<<<<<< ORIGINAL if self.coder.repo is not None: self.coder.repo.git.add(os.path.join(self.coder.root, word)) ======= if self.coder.repo is not None: self.coder.repo.git.add(os.path.join(self.coder.root, word)) commit_message = f"aider: Created and added {word} to git." self.coder.repo.git.commit("-m", commit_message, "--no-verify") >>>>>>> UPDATED ``` These changes commit the added file with a message indicating that the file was created and added by the aider. --- aider/commands.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aider/commands.py b/aider/commands.py index 5ea766a76..a1e755e3a 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -161,6 +161,8 @@ class Commands: matched_files = [word] if self.coder.repo is not None: self.coder.repo.git.add(os.path.join(self.coder.root, word)) + commit_message = f"aider: Created and added {word} to git." + self.coder.repo.git.commit("-m", commit_message, "--no-verify") else: self.console.print(f"[red]No files matched '{word}'") for matched_file in matched_files: