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.
This commit is contained in:
Paul Gauthier 2023-05-10 19:40:35 -07:00
parent c6d388595d
commit 296053a8d7

View file

@ -161,6 +161,8 @@ class Commands:
matched_files = [word] matched_files = [word]
if self.coder.repo is not None: if self.coder.repo is not None:
self.coder.repo.git.add(os.path.join(self.coder.root, word)) 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: else:
self.console.print(f"[red]No files matched '{word}'") self.console.print(f"[red]No files matched '{word}'")
for matched_file in matched_files: for matched_file in matched_files: