From 697eab1b3e8936fd6932cc81646934651337cc39 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 29 May 2020 08:59:04 +0200 Subject: git_commit: fix duplicite email address. The patch is about to handle situations like seen in 3ea6977d0f1813d982743a09660eec1760e981ec. contrib/ChangeLog: * gcc-changelog/git_commit.py: Properly handle duplicite authors. * gcc-changelog/test_email.py: New test. * gcc-changelog/test_patches.txt: New patch. --- contrib/gcc-changelog/git_commit.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'contrib/gcc-changelog/git_commit.py') diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index a24a251..084e83c 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -232,6 +232,12 @@ class ChangeLogEntry: def is_empty(self): return not self.lines and self.prs == self.initial_prs + def contains_author(self, author): + for author_lines in self.author_lines: + if author_lines[0] == author: + return True + return False + class GitCommit: def __init__(self, hexsha, date, author, body, modified_files, @@ -408,7 +414,7 @@ class GitCommit: self.changelog_entries.append(last_entry) will_deduce = True elif author_tuple: - if author_tuple not in last_entry.author_lines: + if not last_entry.contains_author(author_tuple[0]): last_entry.author_lines.append(author_tuple) continue -- cgit v1.1