gjtorikian / jekyll-last-modified-at

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

Suppress git error output when site isn't under source control. #16

Closed chuckhoupt closed 10 years ago

chuckhoupt commented 10 years ago

Hi gjtorikian, Nice plugin. Here's a patch for us poor souls laboring outside of GIT repos. - chuckhoupt

Details:

When working in a directory that isn't part of a GIT repo, the plugin generates the following error message for each file processed:

fatal: Not a git repository (or any of the parent directories): .git

This patch fixes this by dev-nulling the output from the 'git rev-parse' command in is_git_repo?()

gjtorikian commented 10 years ago

Wooomp wooooomp. Thanks for the fix. Note of course that this just falls on mtime if it's not a git repo.

parkr commented 10 years ago

Note, as well, that if you clone a repository and delete the .git folder, you'll need to somehow set the mtime based on the git history, or rsync with the mtime preserved, then run jekyll build.