From c1e55614f7bf5850e858cff17209d472c3c6dbe6 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 27 Jun 2024 07:15:06 -0700 Subject: [PATCH] Don't rely on (aider) in git name field to police /undo #698 --- aider/commands.py | 5 +---- aider/tests/test_commands.py | 4 ---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index 00189fecd..5ea285111 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -331,10 +331,7 @@ class Commands: return last_commit = self.coder.repo.repo.head.commit - if ( - not last_commit.author.name.endswith(" (aider)") - or last_commit.hexsha[:7] != self.coder.last_aider_commit_hash - ): + if last_commit.hexsha[:7] != self.coder.last_aider_commit_hash: self.io.tool_error("The last commit was not made by aider in this chat session.") self.io.tool_error( "You could try `/git reset --hard HEAD^` but be aware that this is a destructive" diff --git a/aider/tests/test_commands.py b/aider/tests/test_commands.py index f6629f481..262262f39 100644 --- a/aider/tests/test_commands.py +++ b/aider/tests/test_commands.py @@ -523,8 +523,6 @@ class TestCommands(TestCase): other_path.write_text("other content") repo.git.add(str(other_path)) - os.environ["GIT_AUTHOR_NAME"] = "Foo (aider)" - # Create and commit a file filename = "test_file.txt" file_path = Path(repo_dir) / filename @@ -536,8 +534,6 @@ class TestCommands(TestCase): repo.git.add(filename) repo.git.commit("-m", "second commit") - del os.environ["GIT_AUTHOR_NAME"] - # Store the commit hash last_commit_hash = repo.head.commit.hexsha[:7] coder.last_aider_commit_hash = last_commit_hash