Fix crash when a detached HEAD commit or a repo with no tags is used.

In these case, there are no references, so calling the 'git describe' command
fails rather ungracefully.