mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
fix: Catch ValueError when getting current commit in cmd_diff
This commit is contained in:
parent
543227f6bd
commit
55d55c32b2
1 changed files with 6 additions and 1 deletions
|
@ -471,7 +471,12 @@ class Commands:
|
|||
self.io.tool_error("No git repository found.")
|
||||
return
|
||||
|
||||
current_head = self.coder.repo.repo.head.commit.hexsha
|
||||
try:
|
||||
current_head = self.coder.repo.repo.head.commit.hexsha
|
||||
except ValueError:
|
||||
self.io.tool_error("Unable to get current commit. The repository might be empty.")
|
||||
return
|
||||
|
||||
commit_before_message = self.coder.commit_before_message
|
||||
|
||||
if not commit_before_message or commit_before_message == current_head:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue