Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions src/mkdocs_git_revision_date_localized_plugin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <hash> <timestamp>
# 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
Expand Down