path.c: rewrite reflog path for refs repos/<id>/HEAD and 1ST_HEAD

The normal rule is given ref "abc", its reflog path is
"logs/abc". It's not true for "repos/<id>/HEAD" because the correct
reflog path is "repos/<id>/logs/HEAD", not "logs/repos/<id>/HEAD".
The same rule applies to "1ST_HEAD".
refs.c: create repos/xxx/logs before writing repos/xxx/logs/HEAD
refs.c: detach HEAD when a ref is updated/deleted from another worktree

Between error+reject update and detach, the latter seems less
intrusive on the current repo's operations. People may be doing an
interactive rebase and only realize at the last step that the rebased
ref can't be updated because it's checked out elsewhere.

This is effective when a ref is updated anywhere, including from the
main checkout as well as all linked ones, because "repos" directory is
shared between all repos. The user will be reported about the
detaching. reflog is also updated to keep track of the event.
refs.c: refactor do_head_ref(... to do_one_head_ref("HEAD", ...
rev-list: include repos/xx/HEAD (and maybe 1ST_HEAD) in --all

This makes sure "repack -ad" won't turn detached HEADs from
$GIT_DIR/repos/ into broken refs.
refs.c: include refs 1ST_HEAD and repos/xxx/HEAD in for_each_reflog
prune: strategies for linked checkouts

alias REPO=$GIT_COMMON_DIR/repos/<id>

 - linked checkouts are supposed to update mtime of $REPO/gitdir

 - linked checkouts are supposed to keep its location in $REPO/gitdir up to
   date

 - "git checkout --to" is supposed to create $REPO/locked if the new
   repo is on a different partition than the shared one.

 - "git checkout --to" is supposed to make hardlink named $REPO/link
   pointing to the .git file

The pruning rules are:

 - if $REPO/locked exists, repos/<id> is not supposed to be pruned.

 - if $REPO/locked exists and $REPO/gitdir's mtimer is older than a
   really long limit, warn about old unused repo.

 - if $REPO/link exists and its link count is greated than 1, the repo
   is kept.

 - if $REPO/gitdir's mtime is older than a limit, and it points to
   nowhere, repos/<id> is to be pruned.
gc: support prune --repos
checkout: list linked checkouts with --list