Skip to content

Commit

Permalink
Merge pull request #163 from timvink/111-if-a-file-has-no-git-logs-us…
Browse files Browse the repository at this point in the history
…e-the-last-modified-timestamp-instead-of-the-current

Ensure creation date is never later than revision date
  • Loading branch information
timvink authored Mar 4, 2025
2 parents 8e7cad1 + 9319b59 commit 2a393fe
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit 2a393fe

Please sign in to comment.