mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 22:04:59 +00:00
wip: Added optional commit message to commit
method and updated cmd_commit
to use it or provide a default message.
This commit is contained in:
parent
6b24072973
commit
540c12fafa
1 changed files with 11 additions and 8 deletions
|
@ -385,7 +385,7 @@ class Coder:
|
||||||
|
|
||||||
return edited
|
return edited
|
||||||
|
|
||||||
def commit(self, history=None, prefix=None, ask=False):
|
def commit(self, history=None, prefix=None, ask=False, message=None):
|
||||||
repo = self.repo
|
repo = self.repo
|
||||||
if not repo:
|
if not repo:
|
||||||
return
|
return
|
||||||
|
@ -487,7 +487,8 @@ class Coder:
|
||||||
return files
|
return files
|
||||||
|
|
||||||
def cmd_commit(self, args):
|
def cmd_commit(self, args):
|
||||||
"Commit outstanding changes to the chat files with a sensible commit message"
|
"Commit outstanding changes to the chat files. Aider will provide a commit message if yo u don't."
|
||||||
|
|
||||||
if not self.repo:
|
if not self.repo:
|
||||||
self.console.print("[red]No git repository found.")
|
self.console.print("[red]No git repository found.")
|
||||||
return
|
return
|
||||||
|
@ -497,13 +498,15 @@ class Coder:
|
||||||
return
|
return
|
||||||
|
|
||||||
commit_message = args.strip()
|
commit_message = args.strip()
|
||||||
if not commit_message:
|
if commit_message:
|
||||||
commit_message = "aider: Manual commit of outstanding changes"
|
self.repo.git.add(*[os.path.relpath(fname, self.repo.working_tree_dir) for fname in self.fnames])
|
||||||
|
self.repo.git.commit("-m", commit_message, "--no-verify")
|
||||||
|
commit_hash = self.repo.head.commit.hexsha[:7]
|
||||||
|
self.console.print(f"[red]{commit_hash} {commit_message}")
|
||||||
|
return
|
||||||
|
|
||||||
|
self.commit()
|
||||||
|
|
||||||
self.repo.git.add(*[os.path.relpath(fname, self.repo.working_tree_dir) for fname in self.fnames])
|
|
||||||
self.repo.git.commit("-m", commit_message, "--no-verify")
|
|
||||||
commit_hash = self.repo.head.commit.hexsha[:7]
|
|
||||||
self.console.print(f"[red]{commit_hash} {commit_message}")
|
|
||||||
def cmd_undo(self, args):
|
def cmd_undo(self, args):
|
||||||
"Undo the last git commit if it was done by aider"
|
"Undo the last git commit if it was done by aider"
|
||||||
if not self.repo:
|
if not self.repo:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue