gjtorikian / jekyll-last-modified-at

A Jekyll plugin to show the last_modified_at time of a post.
MIT License
241 stars 38 forks source link

Fails to get timestamp from git if signature verification is enabled #104

Open teythoon opened 1 month ago

teythoon commented 1 month ago

On my system, git is configured to verify OpenPGP signatures when listing commits. This makes jekyll-last-modified-at fail to parse the modification time, returning 0, or 1970 as a result. Fortunately, the fix is simple, add --no-show-signature:

$ git config --get log.showsignature
true
$ git log -n 1 --format="%ct" -- _software/01-software.md | cat
gpg: Signature made Tue Jun 25 16:33:02 2024 +02:00
gpg:                using EDDSA key D1FE45FB978F6B65C4C0B9AA686F55B4AB2B3386
gpg: Good signature from "Justus Winter (Code Signing Key) <justus@sequoia-pgp.org>" [full]
gpg:                     "Justus Winter (Code Signing Key) <justus@pep-project.org>"
1719325976
$ git log -n 1 --no-show-signature --format="%ct" -- _software/01-software.md | cat
1719325976

Sticking that in last_modified_at_unix fixes the problem for me.