gjtorikian / jekyll-last-modified-at

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

Requires you to be in Jekyll's site #12

Closed parkr closed 10 years ago

parkr commented 10 years ago

I'm running a post-receive hook on my server in order to build my personal site, parkermoore.de. It runs jekyll build in whatever directory it cares to, and I specify the --source and --destination parameters in the hook. This plugin seems to break when it is executed from outside the site source, which is a problem. Is there a git switch or something that we can use to direct git to the proper git dir?

~/code/parkermoore.de$ git push
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 373 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: fatal: destination path '/tmp/parkermoore.de' already exists and is not an empty directory.
remote: Configuration file: /tmp/parkermoore.de/_config.yml
remote:             Source: /tmp/parkermoore.de
remote:        Destination: /var/www/parkermoore.de
remote:       Generating... fatal: /tmp/parkermoore.de/portfolio.html: '/tmp/parkermoore.de/portfolio.html' is outside repository
remote: fatal: /tmp/parkermoore.de/404.md: '/tmp/parkermoore.de/404.md' is outside repository
remote: fatal: /tmp/parkermoore.de/projects.md: '/tmp/parkermoore.de/projects.md' is outside repository
remote: fatal: /tmp/parkermoore.de/resume.md: '/tmp/parkermoore.de/resume.md' is outside repository
remote: fatal: /tmp/parkermoore.de/index.md: '/tmp/parkermoore.de/index.md' is outside repository
remote: done.
To git@parkermoo.re:parkermoore.de.git
   8008533..85c1966  master -> master
gjtorikian commented 10 years ago

I wonder if this would work: http://stackoverflow.com/a/3769169/213345

Given that we have access to the context in the plugin, it could always just do git --git-dir <source>.git. Not sure how to test it at the moment.

parkr commented 10 years ago

I thought about that, but hypothetically I should be able to run a jekyll site at any level inside a git repo, so my source (e.g. ./site) may not contain my git dir (./.git)

gjtorikian commented 10 years ago

The internet tells me you can do git rev-parse --show-toplevel to get the top level .git container dir.