Skip to content

Commit 45a94a9

Browse files
committed
remove creation_date_with_follow options, alway retrieve first commit with follow mode
1 parent 93ca65c commit 45a94a9

File tree

4 files changed

+7
-29
lines changed

4 files changed

+7
-29
lines changed

mkdocs_git_revision_date_localized_plugin/plugin.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class GitRevisionDateLocalizedPlugin(BasePlugin):
4141
("timezone", config_options.Type(str, default="UTC")),
4242
("exclude", config_options.Type(list, default=[])),
4343
("enable_creation_date", config_options.Type(bool, default=False)),
44-
("creation_date_with_follow", config_options.Type(bool, default=False)),
4544
("enabled", config_options.Type(bool, default=True)),
4645
)
4746

@@ -256,7 +255,6 @@ def on_page_markdown(
256255
first_revision_timestamp = self.util.get_git_commit_timestamp(
257256
path=page.file.abs_src_path,
258257
is_first_commit=True,
259-
follow_mode=self.config.get("creation_date_with_follow")
260258
)
261259

262260
# Creation date formats

mkdocs_git_revision_date_localized_plugin/util.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ def _date_formats(
8585
def get_git_commit_timestamp(
8686
self,
8787
path: str,
88-
is_first_commit: bool = False,
89-
follow_mode: bool = False
88+
is_first_commit: bool = False
9089
) -> int:
9190
"""
9291
Get a list of commit dates in unix timestamp, starts with the most recent commit.
@@ -96,7 +95,6 @@ def get_git_commit_timestamp(
9695
else, get that of the most recent commit.
9796
path (str): Location of a markdown file that is part of a Git repository.
9897
is_first_commit (bool): retrieve commit timestamp when file was created.
99-
follow_mode (bool): retrieve first commit timestamp with follow mode.
10098
10199
Returns:
102100
int: commit date in unix timestamp, starts with the most recent commit.
@@ -114,7 +112,7 @@ def get_git_commit_timestamp(
114112
if is_first_commit:
115113
# diff_filter="A" will select the commit that created the file
116114
commit_timestamp = git.log(
117-
realpath, date="unix", format="%at", diff_filter="A", no_show_signature=True, follow=follow_mode
115+
realpath, date="unix", format="%at", diff_filter="A", no_show_signature=True, follow=True
118116
)
119117
# A file can be created multiple times, through a file renamed.
120118
# Commits are ordered with most recent commit first

tests/fixtures/basic_project/mkdocs_creation_date_with_follow.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/test_builds.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -264,20 +264,11 @@ def validate_build(testproject_path, plugin_config: dict = {}):
264264
searches = [x in contents for x in date_formats.values()]
265265
assert any(searches), "No correct creation date formats output was found"
266266

267-
if plugin_config.get("creation_date_with_follow"):
268-
commit_timestamp=repo.get_git_commit_timestamp(
269-
path=str(testproject_path / "docs/subfolder/page_with_renamed.md"),
270-
is_first_commit=True,
271-
follow_mode=True
272-
)
273-
assert commit_timestamp == 1655229469
274-
else:
275-
commit_timestamp=repo.get_git_commit_timestamp(
276-
path=str(testproject_path / "docs/subfolder/page_with_renamed.md"),
277-
is_first_commit=True,
278-
follow_mode=False
279-
)
280-
assert commit_timestamp == 1655229515
267+
commit_timestamp=repo.get_git_commit_timestamp(
268+
path=str(testproject_path / "docs/subfolder/page_with_renamed.md"),
269+
is_first_commit=True
270+
)
271+
assert commit_timestamp == 1655229469
281272

282273
def validate_mkdocs_file(temp_path: str, mkdocs_yml_file: str):
283274
"""
@@ -313,7 +304,6 @@ def validate_mkdocs_file(temp_path: str, mkdocs_yml_file: str):
313304
'basic_project/mkdocs_with_override.yml',
314305
'basic_project/mkdocs_theme_language.yml',
315306
'basic_project/mkdocs_creation_date.yml',
316-
'basic_project/mkdocs_creation_date_with_follow.yml',
317307
'basic_project/mkdocs_theme_locale_disabled.yml',
318308
'basic_project/mkdocs_timeago_locale.yml',
319309
'basic_project/mkdocs_timeago.yml',

0 commit comments

Comments
 (0)