Implement GitRepository.setHeadDetached.

Rewrote comment to avoid copyright issues (okay, I'm
probably overly cautious about this, but we really don't
want dlibgit to be GPL'd).