mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
Don't rely on (aider) in git name field to police /undo #698
This commit is contained in:
parent
ea97d08449
commit
c1e55614f7
2 changed files with 1 additions and 8 deletions
|
@ -331,10 +331,7 @@ class Commands:
|
||||||
return
|
return
|
||||||
|
|
||||||
last_commit = self.coder.repo.repo.head.commit
|
last_commit = self.coder.repo.repo.head.commit
|
||||||
if (
|
if last_commit.hexsha[:7] != self.coder.last_aider_commit_hash:
|
||||||
not last_commit.author.name.endswith(" (aider)")
|
|
||||||
or 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("The last commit was not made by aider in this chat session.")
|
||||||
self.io.tool_error(
|
self.io.tool_error(
|
||||||
"You could try `/git reset --hard HEAD^` but be aware that this is a destructive"
|
"You could try `/git reset --hard HEAD^` but be aware that this is a destructive"
|
||||||
|
|
|
@ -523,8 +523,6 @@ class TestCommands(TestCase):
|
||||||
other_path.write_text("other content")
|
other_path.write_text("other content")
|
||||||
repo.git.add(str(other_path))
|
repo.git.add(str(other_path))
|
||||||
|
|
||||||
os.environ["GIT_AUTHOR_NAME"] = "Foo (aider)"
|
|
||||||
|
|
||||||
# Create and commit a file
|
# Create and commit a file
|
||||||
filename = "test_file.txt"
|
filename = "test_file.txt"
|
||||||
file_path = Path(repo_dir) / filename
|
file_path = Path(repo_dir) / filename
|
||||||
|
@ -536,8 +534,6 @@ class TestCommands(TestCase):
|
||||||
repo.git.add(filename)
|
repo.git.add(filename)
|
||||||
repo.git.commit("-m", "second commit")
|
repo.git.commit("-m", "second commit")
|
||||||
|
|
||||||
del os.environ["GIT_AUTHOR_NAME"]
|
|
||||||
|
|
||||||
# Store the commit hash
|
# Store the commit hash
|
||||||
last_commit_hash = repo.head.commit.hexsha[:7]
|
last_commit_hash = repo.head.commit.hexsha[:7]
|
||||||
coder.last_aider_commit_hash = last_commit_hash
|
coder.last_aider_commit_hash = last_commit_hash
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue