Transform a reference to its target following the refspec's rules
where to store the target name
the size ouf the out buffer
out
the refspec
the name of the reference to transform
GIT_SUCCESS, GIT_ESHORTBUFFER or another error