Skip to content

Commit 489bec3

Browse files
committed
Read authorship information from last commit when squashing
1 parent 2ee9234 commit 489bec3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

homu/main.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,12 @@ def create_merge(state, repo_cfg, branch, logger, git_cfg,
10271027
ok = False
10281028
if state.squash:
10291029
try:
1030+
commiter_name = subprocess.check_output(
1031+
git_cmd('log', '-1', '--format="%an"',
1032+
state.head_sha)).decode('ascii').strip()
1033+
commiter_email = subprocess.check_output(
1034+
git_cmd('log', '-1', '--format="%ae"',
1035+
state.head_sha)).decode('ascii').strip()
10301036
merge_base_sha = subprocess.check_output(
10311037
git_cmd(
10321038
'merge-base',
@@ -1038,9 +1044,9 @@ def create_merge(state, repo_cfg, branch, logger, git_cfg,
10381044
merge_base_sha))
10391045
utils.logged_call(git_cmd(
10401046
'-c',
1041-
'user.name=' + git_cfg['name'],
1047+
'user.name=' + commiter_name,
10421048
'-c',
1043-
'user.email=' + git_cfg['email'],
1049+
'user.email=' + commiter_email,
10441050
'commit',
10451051
'-m',
10461052
squash_msg))

0 commit comments

Comments
 (0)