Merge pull request #1061 from nulltoken/topic/explicit-head-errors repository: Refine repository_head() error report