From 0b4a3d7b3c1399c20c1d5bf7054beb4cbed83167 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 9 Aug 2024 19:44:31 -0400 Subject: [PATCH] refactor: Use get_head() in cmd_diff --- aider/commands.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index 400098ef2..66296bdba 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -471,9 +471,8 @@ class Commands: self.io.tool_error("No git repository found.") return - try: - current_head = self.coder.repo.repo.head.commit.hexsha - except ValueError: + current_head = self.coder.repo.get_head() + if current_head is None: self.io.tool_error("Unable to get current commit. The repository might be empty.") return