Expose git_reference_dwim

Extract this function out of the rev-parse code to be able to DWIM a
reference instead of its target.
Merge pull request #1560 from carlosmn/ref-dwim

Expose git_reference_dwim