From 3e7038b9202f07a422a8bc4d574c4118a3ffb19f Mon Sep 17 00:00:00 2001 From: Tim Vink Date: Fri, 31 Oct 2025 15:24:17 +0100 Subject: [PATCH] Fix bug where we used two git.log operations, and missed diff_filter, ignore_all_space and ignore_blank_lines --- .../util.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/mkdocs_git_revision_date_localized_plugin/util.py b/src/mkdocs_git_revision_date_localized_plugin/util.py index 5820595..c0826d5 100644 --- a/src/mkdocs_git_revision_date_localized_plugin/util.py +++ b/src/mkdocs_git_revision_date_localized_plugin/util.py @@ -97,28 +97,18 @@ def get_git_commit_timestamp(self, path: str, is_first_commit: bool = False) -> if commit_timestamp != "": commit_timestamp = commit_timestamp.split()[-1] else: - # Latest commit touching a specific file - commit_timestamp = git.log( - realpath, - date="unix", - format="%at", - diff_filter="r", - n=1, - no_show_signature=True, - follow=follow_option, - ignore_all_space=True, - ignore_blank_lines=True, - ) - # Retrieve the history for the file in the format # The maximum number of commits we will ever need to examine is 1 more than the number of ignored commits. lines = git.log( realpath, date="unix", format="%H %at", + diff_filter="r", n=len(self.ignored_commits) + 1, no_show_signature=True, follow=follow_option, + ignore_all_space=True, + ignore_blank_lines=True, ).split("\n") # process the commits for the file in reverse-chronological order. Ignore any commit that is on the