branch: constness fixes
repo: remove test which deletes HEAD

This is not something anybody would ever do; removing HEAD makes the
.git/ directory no longer be a repository, so we wouldn't be expected to
handle such a situation.
refs: append to the HEAD reflog when updating the current branch

When we update the current branch, we must also append to HEAD's reflog
to keep them in sync.

This is a bit of a hack, but as git.git says, it covers 100% of
default cases.