Skip to content

Commit 0a216e7

Browse files
fpozzobontimvink
authored andcommitted
moving co-author filter to page responsibility
1 parent 619b18d commit 0a216e7

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/mkdocs_git_authors_plugin/git/page.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,13 @@ def _process_git_blame(self) -> None:
200200
# Process co-authors if present
201201
for co_author in commit.co_authors():
202202
# Create the co-author
203-
if co_author not in self._authors:
204-
self._authors.append(co_author)
205-
co_author.add_lines(self, commit)
203+
if (
204+
co_author.email() not in ignore_authors
205+
and co_author.email() != commit.author().email()
206+
):
207+
if co_author not in self._authors:
208+
self._authors.append(co_author)
209+
co_author.add_lines(self, commit)
206210

207211
def path(self) -> Path:
208212
"""

src/mkdocs_git_authors_plugin/git/repo.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ def get_commit(self, sha: str, **kwargs) -> Union[Any, None]:
116116
if not self._commits.get(sha):
117117
from .commit import Commit
118118

119-
kwargs["co_authors"] = self._get_co_authors(sha, kwargs.get("author_email"))
119+
kwargs["co_authors"] = self._get_co_authors(sha)
120120
self._commits[sha] = Commit(self, sha, **kwargs)
121121
return self._commits.get(sha)
122122

123-
def _get_co_authors(self, sha, author_email) -> List[Any]:
123+
def _get_co_authors(self, sha) -> List[Any]:
124124
"""
125125
Execute git log and parse the results.
126126
@@ -168,7 +168,6 @@ def _get_co_authors(self, sha, author_email) -> List[Any]:
168168
if len(lines) == 0:
169169
raise GitCommandError
170170
co_authors = []
171-
ignore_authors = self.config("ignore_authors")
172171

173172
for line in lines:
174173
if line.startswith("Author: "):
@@ -179,11 +178,7 @@ def _get_co_authors(self, sha, author_email) -> List[Any]:
179178
if result is not None and result.group(1) != "" and result.group(2) != "":
180179
# Extract co-authors from the commit
181180
co_author = self.author(result.group(1), result.group(2))
182-
if (
183-
co_author.email() not in ignore_authors
184-
and co_author.email() != author_email
185-
):
186-
co_authors.append(co_author)
181+
co_authors.append(co_author)
187182
return co_authors
188183

189184
def page(self, path):

0 commit comments

Comments
 (0)