puppetlabs/puppetlabs-vcsrepo — pull request #106 by mikegerwitz (2013-12-02 17:00:56+00:00)
Title: Correctly handle detached head for latest on latest Git versions

Newer versions of Git (I'm not sure as of what version) will output the following for `git branch -a` while in a detached HEAD state:

```
$ git branch -a
* (detached from 4689c51)
master
remotes/origin/HEAD -> origin/master
```

The first line is different than what is expected from previous Git version: "(no branch)". This patch uses rev-parse, which should work with most existing Git versions and will hopefully be immune to this problem in the future.

This patch also gets rid of "origin/HEAD", which is not a valid (and does throw an error in newer Git versions); origin/master points to the tip of master on origin, which seems to be what was desired.