Guts / mkdocs-rss-plugin

MkDocs plugin to generate a RSS feeds for created and updated pages, using git log and YAML frontmatter (page.meta).
https://guts.github.io/mkdocs-rss-plugin/
MIT License
91 stars 27 forks source link

date detection from "git log" is broken when git client is configured with "--show-signature" #124

Open yuha0 opened 2 years ago

yuha0 commented 2 years ago

I can't build mkdocs sites from repositories where commits are signed and git client is configured to always show commit signature.

The problem seems to be here:

https://github.com/Guts/mkdocs-rss-plugin/blob/c9b1c8b17794ea5ff2fb1fa4ccecbf74bc220ca7/mkdocs_rss_plugin/util.py#L145-L159

It assumes that git log -1 --date=short --format="%at"'s output will only contain the timestamp and nothing else, which isn't true.

My gitconfig contains:

[log]
    showSignature = true

Which is equivalent to git log --show-signature ..., and the output will always contain commit signature info:

$ git log --date=short -1 --format="%at"
gpg: Signature made Tue Jun 21 17:19:48 2022 PDT
gpg:                using EDDSA key 90DA57F75A16D8729DBEE227CD67D78AC53D68C5
gpg: Good signature from "Yuhao Zhang <git@yuha0.com>" [ultimate]
1655857188

And the plugin will crash at:

https://github.com/Guts/mkdocs-rss-plugin/blob/c9b1c8b17794ea5ff2fb1fa4ccecbf74bc220ca7/mkdocs_rss_plugin/util.py#L179-L180

Because the whole string cannot be converted to int.

Guts commented 2 years ago

Really interesting use case!

Thanks for the PR! I'm gonna to review it right now.