mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-04 03:35:00 +00:00
feat: add error handling for git operations in auto_commit method
This commit is contained in:
parent
8d0f7daa3a
commit
cef78282bd
1 changed files with 14 additions and 10 deletions
|
@ -1859,17 +1859,21 @@ class Coder:
|
||||||
if not context:
|
if not context:
|
||||||
context = self.get_context_from_history(self.cur_messages)
|
context = self.get_context_from_history(self.cur_messages)
|
||||||
|
|
||||||
res = self.repo.commit(fnames=edited, context=context, aider_edits=True)
|
try:
|
||||||
if res:
|
res = self.repo.commit(fnames=edited, context=context, aider_edits=True)
|
||||||
self.show_auto_commit_outcome(res)
|
if res:
|
||||||
commit_hash, commit_message = res
|
self.show_auto_commit_outcome(res)
|
||||||
return self.gpt_prompts.files_content_gpt_edits.format(
|
commit_hash, commit_message = res
|
||||||
hash=commit_hash,
|
return self.gpt_prompts.files_content_gpt_edits.format(
|
||||||
message=commit_message,
|
hash=commit_hash,
|
||||||
)
|
message=commit_message,
|
||||||
|
)
|
||||||
|
|
||||||
self.io.tool_output("No changes made to git tracked files.")
|
self.io.tool_output("No changes made to git tracked files.")
|
||||||
return self.gpt_prompts.files_content_gpt_no_edits
|
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):
|
def show_auto_commit_outcome(self, res):
|
||||||
commit_hash, commit_message = res
|
commit_hash, commit_message = res
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue