mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 00:05:01 +00:00
Set committer name to include "aider" and restore original committer name after commit.
This commit is contained in:
parent
97d103f6a4
commit
01242b256c
1 changed files with 11 additions and 0 deletions
|
@ -91,10 +91,21 @@ 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
|
||||
|
||||
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"]
|
||||
|
||||
return commit_hash, commit_message
|
||||
|
||||
def get_rel_repo_dir(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue