Skip to content

Commit 2b754d8

Browse files
committed
fix(squash): keep author when squashed commits have same author
When the commits being squashed all share the same author, the resulting squashed commit should have that same author. This was the intent of the code, but it was broken due to author comparisons comparing entire signatures, which includes the author **time**, instead of just comparing the author name and email. I.e. if the author times were different, then the authors were deemed different even if they shared the same name and email. The comparisons using time enabled automated tests to not see this issue because in automated scenarios patches could all be created quickly enough to share the same timestamp. Fixes: #592
1 parent afc3319 commit 2b754d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmd/squash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ fn try_squash(
230230
for commit in patchnames[1..].iter().map(|pn| trans.get_patch_commit(pn)) {
231231
let commit_ref = commit.decode()?;
232232
let author = commit.author()?;
233-
if author != base_author {
233+
if author.name != base_author.name || author.email != base_author.email {
234234
use_base_author = false;
235235
}
236236
let parent = commit.get_parent_commit()?;

0 commit comments

Comments
 (0)