From 311ae043148ef950040683a814408bc1729d6220 Mon Sep 17 00:00:00 2001 From: Aleksandr Bobrov Date: Fri, 24 May 2024 14:52:40 +0400 Subject: [PATCH] aider: Fix issue in `cmd_commit` to set `commit_message` to `None` if `args` does not exist. # Aider chat conversation: USER: I did `git reset --hard HEAD~1` to discard the last edits. Please wait for further instructions before attempting that change again. Feel free to ask relevant questions about why the changes were reverted. ASSISTANT: Understood. If you have any specific instructions or changes you would like to make, please let me know! USER: in `cmd_commit` issue if args not exist please fix, as leave commit_message as None ASSISTANT: To fix the issue in `cmd_commit` when `args` does not exist, we need to ensure that `commit_message` is set to `None` if `args` is not provided. Here are the changes: 1. Check if `args` is provided and set `commit_message` to `None` if it is not. Here is the *SEARCH/REPLACE* block: aider/commands.py python <<<<<<< SEARCH commit_message = args.strip() ======= commit_message = args.strip() if args else None >>>>>>> REPLACE --- aider/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/commands.py b/aider/commands.py index 301029ca3..6a1d6041c 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -150,7 +150,7 @@ class Commands: self.io.tool_error("No more changes to commit.") return - commit_message = args.strip() + commit_message = args.strip() if args else None self.coder.repo.commit(message=commit_message) def cmd_lint(self, args="", fnames=None):