Skip to content

Ensure creation date is never later than revision date #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
7 changes: 7 additions & 0 deletions src/mkdocs_git_revision_date_localized_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,13 @@ def on_page_markdown(
is_first_commit=True,
)

if first_revision_timestamp > last_revision_timestamp:
# See also https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/issues/111
msg = "First revision timestamp is older than last revision timestamp for page %s. " % page.file.src_path
msg += "This can be due to a quick in `git` follow behaviour. You can try to set `enable_git_follow: false` in the plugin configuration."
logging.warning(msg)
first_revision_hash, first_revision_timestamp = last_revision_hash, last_revision_timestamp

# Creation date formats
creation_dates = self.util.get_date_formats_for_timestamp(first_revision_timestamp, locale=locale, add_spans=True)
creation_date = creation_dates[self.config["type"]]
Expand Down
Loading