Skip to content

Commit 3e7038b

Browse files
committed
Fix bug where we used two git.log operations, and missed diff_filter, ignore_all_space and ignore_blank_lines
1 parent f62d9e6 commit 3e7038b

File tree

1 file changed

+3
-13
lines changed
  • src/mkdocs_git_revision_date_localized_plugin

1 file changed

+3
-13
lines changed

src/mkdocs_git_revision_date_localized_plugin/util.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,18 @@ def get_git_commit_timestamp(self, path: str, is_first_commit: bool = False) ->
9797
if commit_timestamp != "":
9898
commit_timestamp = commit_timestamp.split()[-1]
9999
else:
100-
# Latest commit touching a specific file
101-
commit_timestamp = git.log(
102-
realpath,
103-
date="unix",
104-
format="%at",
105-
diff_filter="r",
106-
n=1,
107-
no_show_signature=True,
108-
follow=follow_option,
109-
ignore_all_space=True,
110-
ignore_blank_lines=True,
111-
)
112-
113100
# Retrieve the history for the file in the format <hash> <timestamp>
114101
# The maximum number of commits we will ever need to examine is 1 more than the number of ignored commits.
115102
lines = git.log(
116103
realpath,
117104
date="unix",
118105
format="%H %at",
106+
diff_filter="r",
119107
n=len(self.ignored_commits) + 1,
120108
no_show_signature=True,
121109
follow=follow_option,
110+
ignore_all_space=True,
111+
ignore_blank_lines=True,
122112
).split("\n")
123113

124114
# process the commits for the file in reverse-chronological order. Ignore any commit that is on the

0 commit comments

Comments
 (0)