Skip to content

Commit

Permalink
Read authorship information from last commit when squashing
Browse files Browse the repository at this point in the history
  • Loading branch information
kellda committed Sep 9, 2021
1 parent 2ee9234 commit 489bec3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions homu/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,12 @@ def create_merge(state, repo_cfg, branch, logger, git_cfg,
ok = False
if state.squash:
try:
commiter_name = subprocess.check_output(
git_cmd('log', '-1', '--format="%an"',
state.head_sha)).decode('ascii').strip()
commiter_email = subprocess.check_output(
git_cmd('log', '-1', '--format="%ae"',
state.head_sha)).decode('ascii').strip()
merge_base_sha = subprocess.check_output(
git_cmd(
'merge-base',
Expand All @@ -1038,9 +1044,9 @@ def create_merge(state, repo_cfg, branch, logger, git_cfg,
merge_base_sha))
utils.logged_call(git_cmd(
'-c',
'user.name=' + git_cfg['name'],
'user.name=' + commiter_name,
'-c',
'user.email=' + git_cfg['email'],
'user.email=' + commiter_email,
'commit',
'-m',
squash_msg))
Expand Down

0 comments on commit 489bec3

Please sign in to comment.