Skip to content

Commit

Permalink
Attempt to extract date from only the last line of git log output
Browse files Browse the repository at this point in the history
Previously, the code assumes the output of `git log --format="%at"` only
contains commit timestamp. But this is not true.

`--format` only controls a portion of the output. `git log` command can
output additional information thats not controlled by format. e.g.: When
`showSignature` is set, it will always display commit signature info.

This commit attempts to locate timestamps only from the very last line
of `git log` output.
  • Loading branch information
yuha0 committed Jun 24, 2022
1 parent c9b1c8b commit 0c944b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mkdocs_rss_plugin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ def get_file_dates(
date="short",
format="%at",
diff_filter="AR",
)
).split("\n")[-1]
if not dt_updated:
dt_updated = self.repo.log(
in_page.file.abs_src_path,
n=1,
date="short",
format="%at",
)
).split("\n")[-1]
except GitCommandError as err:
logging.warning(
"[rss-plugin] Unable to read git logs of '%s'. Is git log readable?"
Expand Down

0 comments on commit 0c944b5

Please sign in to comment.