-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read authorship information from last commit when squashing #152
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1027,6 +1027,15 @@ def create_merge(state, repo_cfg, branch, logger, git_cfg, | |
ok = False | ||
if state.squash: | ||
try: | ||
first_commit = subprocess.check_output( | ||
git_cmd('cherry', 'origin/master', | ||
state.head_sha))[2:42].decode('ascii') | ||
author_name = subprocess.check_output( | ||
git_cmd('log', '-1', '--format="%an"', | ||
first_commit)).decode('ascii').strip() | ||
author_email = subprocess.check_output( | ||
git_cmd('log', '-1', '--format="%ae"', | ||
first_commit)).decode('ascii').strip() | ||
merge_base_sha = subprocess.check_output( | ||
git_cmd( | ||
'merge-base', | ||
|
@@ -1038,9 +1047,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=' + author_name, | ||
'-c', | ||
'user.email=' + git_cfg['email'], | ||
'user.email=' + author_email, | ||
Comment on lines
-1041
to
+1052
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't these need to be escaped? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, I'll check. Probably not since we already give a list of arguments and not a single command line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it doesn't: arguments are passed as-is. Also note that |
||
'commit', | ||
'-m', | ||
squash_msg)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ran into this again in clippy recently so it'd be nice to take another look at this (rust-lang/rust-clippy#8356)
I believe this should be
merge_base_sha
rather than'origin/master'