mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +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.")
|
self.io.tool_error("No git repository found.")
|
||||||
return
|
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
|
commit_before_message = self.coder.commit_before_message
|
||||||
|
|
||||||
if not commit_before_message or commit_before_message == current_head:
|
if not commit_before_message or commit_before_message == current_head:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue