Skip to content

Commit 2a393fe

Browse files
authored
Merge pull request #163 from timvink/111-if-a-file-has-no-git-logs-use-the-last-modified-timestamp-instead-of-the-current
Ensure creation date is never later than revision date
2 parents 8e7cad1 + 9319b59 commit 2a393fe

File tree

1 file changed

+7
-0
lines changed
  • src/mkdocs_git_revision_date_localized_plugin

1 file changed

+7
-0
lines changed

src/mkdocs_git_revision_date_localized_plugin/plugin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,13 @@ def on_page_markdown(
271271
is_first_commit=True,
272272
)
273273

274+
if first_revision_timestamp > last_revision_timestamp:
275+
# See also https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/issues/111
276+
msg = "First revision timestamp is older than last revision timestamp for page %s. " % page.file.src_path
277+
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."
278+
logging.warning(msg)
279+
first_revision_hash, first_revision_timestamp = last_revision_hash, last_revision_timestamp
280+
274281
# Creation date formats
275282
creation_dates = self.util.get_date_formats_for_timestamp(first_revision_timestamp, locale=locale, add_spans=True)
276283
creation_date = creation_dates[self.config["type"]]

0 commit comments

Comments
 (0)