Introduce git_reference_shorthand

Generate a shorthand name out of the full refname.
Merge pull request #1559 from carlosmn/ref-shorthand

Introduce git_reference_shorthand