gjtorikian / jekyll-last-modified-at

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

Properly fetch the article file path relative to git directory's parent #15

Closed parkr closed 10 years ago

parkr commented 10 years ago

As I was running v0.2.0 on my personal site, I kept getting this (debug message mine):

git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- /tmp/parkermoore.de/portfolio.html
fatal: /tmp/parkermoore.de/portfolio.html: '/tmp/parkermoore.de/portfolio.html' is outside repository
git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- /tmp/parkermoore.de/404.md
fatal: /tmp/parkermoore.de/404.md: '/tmp/parkermoore.de/404.md' is outside repository
git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- /tmp/parkermoore.de/projects.md
fatal: /tmp/parkermoore.de/projects.md: '/tmp/parkermoore.de/projects.md' is outside repository
git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- /tmp/parkermoore.de/resume.md
fatal: /tmp/parkermoore.de/resume.md: '/tmp/parkermoore.de/resume.md' is outside repository
git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- /tmp/parkermoore.de/index.md
fatal: /tmp/parkermoore.de/index.md: '/tmp/parkermoore.de/index.md' is outside repository

Turns out the filename after the -- has to be the relative path from the git directory's parent. With the attached changes, I successfully achieved the output I was looking for:

git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- portfolio.html
git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- 404.md
git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- projects.md
git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- resume.md
git --git-dir /tmp/parkermoore.de/.git log --format="%ct" -- index.md

No error messages, yay!

gjtorikian commented 10 years ago

:cake: