mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
Merge branch 'main' into indent-bad-edit
This commit is contained in:
commit
6f6ff03338
3 changed files with 28 additions and 4 deletions
|
@ -1,5 +1,9 @@
|
|||
# Release history
|
||||
|
||||
### main branch
|
||||
|
||||
- Fixed /commit bug from repo refactor, added test coverage
|
||||
|
||||
### v0.11.0
|
||||
|
||||
- Automatically summarize chat history to avoid exhausting context window.
|
||||
|
|
|
@ -85,7 +85,7 @@ class Commands:
|
|||
return
|
||||
|
||||
commit_message = args.strip()
|
||||
self.coder.commit(message=commit_message, which="repo_files")
|
||||
self.coder.repo.commit(message=commit_message)
|
||||
|
||||
def cmd_clear(self, args):
|
||||
"Clear the chat history"
|
||||
|
@ -307,9 +307,7 @@ class Commands:
|
|||
if self.coder.repo and git_added:
|
||||
git_added = " ".join(git_added)
|
||||
commit_message = f"aider: Added {git_added}"
|
||||
self.coder.repo.repo.git.commit("-m", commit_message, "--no-verify")
|
||||
commit_hash = self.coder.repo.repo.head.commit.hexsha[:7]
|
||||
self.io.tool_output(f"Commit {commit_hash} {commit_message}")
|
||||
self.coder.repo.commit(message=commit_message)
|
||||
|
||||
if not added_fnames:
|
||||
return
|
||||
|
|
|
@ -254,3 +254,25 @@ class TestCommands(TestCase):
|
|||
self.assertIn(filenames[0], coder.abs_fnames)
|
||||
self.assertNotIn(filenames[1], coder.abs_fnames)
|
||||
self.assertIn(filenames[2], coder.abs_fnames)
|
||||
|
||||
def test_cmd_commit(self):
|
||||
with GitTemporaryDirectory():
|
||||
fname = "test.txt"
|
||||
with open(fname, "w") as f:
|
||||
f.write("test")
|
||||
repo = git.Repo()
|
||||
repo.git.add(fname)
|
||||
repo.git.commit("-m", "initial")
|
||||
|
||||
io = InputOutput(pretty=False, yes=True)
|
||||
coder = Coder.create(models.GPT35, None, io)
|
||||
commands = Commands(io, coder)
|
||||
|
||||
self.assertFalse(repo.is_dirty())
|
||||
with open(fname, "w") as f:
|
||||
f.write("new")
|
||||
self.assertTrue(repo.is_dirty())
|
||||
|
||||
commit_message = "Test commit message"
|
||||
commands.cmd_commit(commit_message)
|
||||
self.assertFalse(repo.is_dirty())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue