feat: add error handling for git operations in auto_commit method

This commit is contained in:
Paul Gauthier (aider) 2024-09-04 08:52:11 -07:00
parent 8d0f7daa3a
commit cef78282bd

View file

@ -1859,6 +1859,7 @@ class Coder:
if not context:
context = self.get_context_from_history(self.cur_messages)
try:
res = self.repo.commit(fnames=edited, context=context, aider_edits=True)
if res:
self.show_auto_commit_outcome(res)
@ -1870,6 +1871,9 @@ class Coder:
self.io.tool_output("No changes made to git tracked files.")
return self.gpt_prompts.files_content_gpt_no_edits
except ANY_GIT_ERROR as err:
self.io.tool_error(f"Git error during auto-commit: {str(err)}")
return None
def show_auto_commit_outcome(self, res):
commit_hash, commit_message = res