mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 00:05:01 +00:00
finish removing aider: prefix
This commit is contained in:
parent
0cc00f2a1e
commit
5a3627de6e
4 changed files with 17 additions and 20 deletions
|
@ -59,7 +59,7 @@ class GitRepo:
|
|||
if aider_ignore_file:
|
||||
self.aider_ignore_file = Path(aider_ignore_file)
|
||||
|
||||
def commit(self, fnames=None, context=None, prefix=None, message=None):
|
||||
def commit(self, fnames=None, context=None, message=None, aider_edits=False):
|
||||
if not fnames and not self.repo.is_dirty():
|
||||
return
|
||||
|
||||
|
@ -75,9 +75,6 @@ class GitRepo:
|
|||
if not commit_message:
|
||||
commit_message = "(no commit message provided)"
|
||||
|
||||
if prefix:
|
||||
commit_message = prefix + commit_message
|
||||
|
||||
full_commit_message = commit_message
|
||||
if context:
|
||||
full_commit_message += "\n\n# Aider chat conversation:\n\n" + context
|
||||
|
@ -91,20 +88,22 @@ class GitRepo:
|
|||
else:
|
||||
cmd += ["-a"]
|
||||
|
||||
user_name = self.repo.config_reader().get_value("user", "name")
|
||||
committer_name = f"{user_name} (aider)"
|
||||
original_committer_name = os.environ.get("GIT_COMMITTER_NAME")
|
||||
os.environ["GIT_COMMITTER_NAME"] = committer_name
|
||||
if aider_edits:
|
||||
user_name = self.repo.config_reader().get_value("user", "name")
|
||||
committer_name = f"{user_name} (aider)"
|
||||
original_committer_name = os.environ.get("GIT_COMMITTER_NAME")
|
||||
os.environ["GIT_COMMITTER_NAME"] = committer_name
|
||||
|
||||
self.repo.git.commit(cmd)
|
||||
commit_hash = self.repo.head.commit.hexsha[:7]
|
||||
self.io.tool_output(f"Commit {commit_hash} {commit_message}")
|
||||
|
||||
# Restore the original GIT_COMMITTER_NAME
|
||||
if original_committer_name is not None:
|
||||
os.environ["GIT_COMMITTER_NAME"] = original_committer_name
|
||||
else:
|
||||
del os.environ["GIT_COMMITTER_NAME"]
|
||||
if aider_edits:
|
||||
if original_committer_name is not None:
|
||||
os.environ["GIT_COMMITTER_NAME"] = original_committer_name
|
||||
else:
|
||||
del os.environ["GIT_COMMITTER_NAME"]
|
||||
|
||||
return commit_hash, commit_message
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue