mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
aider: Set committer name to include "aider" and restore original committer name after commit.
This commit is contained in:
parent
01242b256c
commit
40c28ff7d8
1 changed files with 11 additions and 0 deletions
|
@ -82,6 +82,11 @@ class GitRepo:
|
|||
if context:
|
||||
full_commit_message += "\n\n# Aider chat conversation:\n\n" + context
|
||||
|
||||
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
|
||||
|
||||
cmd = ["-m", full_commit_message, "--no-verify"]
|
||||
if fnames:
|
||||
fnames = [str(self.abs_root_path(fn)) for fn in fnames]
|
||||
|
@ -100,6 +105,12 @@ class GitRepo:
|
|||
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"]
|
||||
|
||||
# Restore the original GIT_COMMITTER_NAME
|
||||
if original_committer_name is not None:
|
||||
os.environ["GIT_COMMITTER_NAME"] = original_committer_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue