mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-13 08:05:01 +00:00
Handled case where first commit cannot be undone
This commit is contained in:
parent
3ce3799f8d
commit
6fdb4f8214
2 changed files with 11 additions and 0 deletions
|
@ -306,6 +306,10 @@ class Commands:
|
|||
return
|
||||
|
||||
last_commit = self.coder.repo.repo.head.commit
|
||||
if not last_commit.parents:
|
||||
self.io.tool_error("This is the first commit in the repository. Cannot undo.")
|
||||
return
|
||||
|
||||
prev_commit = last_commit.parents[0]
|
||||
changed_files_last_commit = [item.a_path for item in last_commit.diff(prev_commit)]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue