Skip to content

Commit c4fdfea

Browse files
committed
Fix bug in getting creation date commit when multiple creations
When you rename a file, that's also counted as creation.
1 parent dc2cfad commit c4fdfea

File tree

1 file changed

+4
-0
lines changed
  • mkdocs_git_revision_date_localized_plugin

1 file changed

+4
-0
lines changed

mkdocs_git_revision_date_localized_plugin/util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ def get_git_commit_timestamp(
109109
commit_timestamp = git.log(
110110
realpath, date="short", format="%at", diff_filter="A"
111111
)
112+
# A file can be created multiple times, through a file renamed.
113+
# Commits are ordered with most recent commit first
114+
# Get the oldest commit only
115+
commit_timestamp = commit_timestamp.split()[-1]
112116
else:
113117
commit_timestamp = git.log(
114118
realpath, date="short", format="%at", n=1

0 commit comments

Comments
 (0)