Handle git worktrees when computing the head repo
Handle git worktrees when computing the head repo

Git 1.5.0 introduces support for worktrees. A worktree has a
.git file, rather than a folder. (The file contents points to to a
.git folder buried underneath the .git folder of the main repository.)

A new option has been added to resolve paths within the git dir,
`git rev-parse --git-path foo/bar`.

The commit uses this new facility, but falls back to the old approach
for backwards compability.

Fixes #969

cpick/hub,cpick/hub,cpick/hub