mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
fix: Ensure commit message history is available before displaying diff
This commit is contained in:
parent
37c40efe37
commit
1265f6a279
1 changed files with 6 additions and 1 deletions
|
@ -476,12 +476,17 @@ class Commands:
|
||||||
self.io.tool_error("Unable to get current commit. The repository might be empty.")
|
self.io.tool_error("Unable to get current commit. The repository might be empty.")
|
||||||
return
|
return
|
||||||
|
|
||||||
commit_before_message = self.coder.commit_before_message
|
if len(self.coder.commit_before_message) < 2:
|
||||||
|
return
|
||||||
|
|
||||||
|
commit_before_message = self.coder.commit_before_message[-2]
|
||||||
|
|
||||||
if not commit_before_message or commit_before_message == current_head:
|
if not commit_before_message or commit_before_message == current_head:
|
||||||
self.io.tool_error("No changes to display since the last message.")
|
self.io.tool_error("No changes to display since the last message.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.io.tool_output(f"Diff since {commit_before_message[:7]}...")
|
||||||
|
|
||||||
diff = self.coder.repo.diff_commits(
|
diff = self.coder.repo.diff_commits(
|
||||||
self.coder.pretty,
|
self.coder.pretty,
|
||||||
commit_before_message,
|
commit_before_message,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue