mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 13:54:59 +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
|
@ -617,6 +617,13 @@ class TestCommands(TestCase):
|
|||
# Attempt to undo the last commit
|
||||
commands.cmd_undo("")
|
||||
|
||||
# Check that the commit is still present
|
||||
self.assertEqual(last_commit_hash, repo.head.commit.hexsha[:7])
|
||||
self.assertTrue(file_path.exists())
|
||||
|
||||
# Check that an error message was displayed
|
||||
self.assertIn("This is the first commit in the repository. Cannot undo.", io.get_last_error())
|
||||
|
||||
# Check that the last commit is still present
|
||||
self.assertEqual(last_commit_hash, repo.head.commit.hexsha[:7])
|
||||
self.assertTrue(file_path.exists())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue