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 Jul 6, 2022
1 parent 450d0ca commit 293a902
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 293a902

Please sign in to comment.