creationix / wheat

Wheat is a blog engine for coders written in node.JS
Other
1.36k stars 134 forks source link

Is Git.getHead() necessary in wheat.js? #45

Closed austinyun closed 12 years ago

austinyun commented 12 years ago

WARNING: If this has something to do with cacheing / the "safe" function in Git, I have no idea, because I honestly don't understand that stuff at all.

Makes an if/else branch unnecessary.

I've tested this on a clone of howtonode.org and it seems to work.

I believe Git.getHead() should always return fs, because my understanding is that the HEAD in Git only moves on checkouts and commits?

I stuck a console.log(sha) in a clone of howtonode.org and clicked all over the site and never got anything but fs. Besides that, the only place the head seems to be used anywhere in wheat is on reading the "description.markdown" file. I figured the lines might have something to do with reading the same version of other files (eg. authors.markdown) that were in place at the time of that particular commit, but behavior seems to be the same with the patch in place.

creationix commented 12 years ago

git-fs runs in two modes. One uses fs-only and the other uses git-only. The difference is if you're running from a bare git repo or a full clone with working directory. Usually you have a working checkout while writing articles, but then deploy with a bare repo so you can push directly to it. (that's how howtonode.org works anyway).

What I want to do it port git-fs to follow the github.com/c9/vfs interface and migrate to that.

austinyun commented 12 years ago

Hm, so in bare repo Mode, getHead won't return fa. But why does the head matter in a bare repo?

Lol, turns out I understand the internals of Git even less than I thought.