Simplify and improve logic for finding .git directory

So I actually got around to fixing issue #4 myself. :)