From 01ea6919574f5e349b2ac14a1615a653f5a90990 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 21 Jul 2023 13:01:48 -0300 Subject: [PATCH] Update commands to use the underlying repo --- aider/commands.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index 5b6e96b50..960d94e46 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -171,10 +171,10 @@ class Commands: ) return - local_head = self.coder.repo.git.rev_parse("HEAD") - current_branch = self.coder.repo.active_branch.name + local_head = self.coder.repo.repo.git.rev_parse("HEAD") + current_branch = self.coder.repo.repo.active_branch.name try: - remote_head = self.coder.repo.git.rev_parse(f"origin/{current_branch}") + remote_head = self.coder.repo.repo.git.rev_parse(f"origin/{current_branch}") has_origin = True except git.exc.GitCommandError: has_origin = False @@ -187,14 +187,14 @@ class Commands: ) return - last_commit = self.coder.repo.head.commit + last_commit = self.coder.repo.repo.head.commit if ( not last_commit.message.startswith("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.") return - self.coder.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} " @@ -215,7 +215,7 @@ class Commands: return commits = f"{self.coder.last_aider_commit_hash}~1" - diff = self.coder.get_diffs( + diff = self.coder.repo.get_diffs( self.coder.pretty, commits, self.coder.last_aider_commit_hash, @@ -278,7 +278,7 @@ class Commands: abs_file_path = self.coder.abs_root_path(matched_file) if self.coder.repo and matched_file not in git_files: - self.coder.repo.git.add(abs_file_path) + self.coder.repo.repo.git.add(abs_file_path) git_added.append(matched_file) if abs_file_path in self.coder.abs_fnames: @@ -295,8 +295,8 @@ class Commands: if self.coder.repo and git_added: git_added = " ".join(git_added) commit_message = f"aider: Added {git_added}" - self.coder.repo.git.commit("-m", commit_message, "--no-verify") - commit_hash = self.coder.repo.head.commit.hexsha[:7] + self.coder.repo.repo.git.commit("-m", commit_message, "--no-verify") + commit_hash = self.coder.repo.repo.head.commit.hexsha[:7] self.io.tool_output(f"Commit {commit_hash} {commit_message}") if not added_fnames: