From 34c433111086dc932f1cc944e70e1a8488918cc1 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 2 Jan 2024 09:04:42 -0800 Subject: [PATCH] Refactor dirty_files to only include indexed changes. --- aider/commands.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index 8169e7b1d..d429bf5cd 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -187,8 +187,9 @@ class Commands: return last_commit = self.coder.repo.repo.head.commit + dump(last_commit) changed_files_last_commit = {item.a_path for item in last_commit.diff(None)} - dirty_files = self.coder.repo.repo.untracked_files + [item.a_path for item in self.coder.repo.repo.index.diff(None)] + dirty_files = [item.a_path for item in self.coder.repo.repo.index.diff(None)] dirty_files_in_last_commit = changed_files_last_commit.intersection(dirty_files) dump(changed_files_last_commit) dump(dirty_files) @@ -228,7 +229,7 @@ class Commands: " command!" ) return - # self.coder.repo.repo.git.reset("--hard", "HEAD~1") + self.coder.repo.repo.git.reset("--hard", "HEAD~1") self.io.tool_output( f"{last_commit.message.strip()}\n" f"The above commit {self.coder.last_aider_commit_hash} "