Add a Remote::default_branch() function
Summary 💡
Similar to the libgit2 Remote::default_branch() function.
I believe under the hood this does something like:
git symbolic-ref --short refs/remotes/${remote_name}/HEAD
Motivation 🔦
It would be nice to have an easy way to get the default branch for a remote (if known).
I see - it's actually trying to get the remotes HEAD, which typically lives as a tracking branch in the local repository as well. The git2 implementation seems to query the remote to get the live view of the remote HEAD at least according to the method description.
It's worth noting that one can obtain these values today by probing the tracking branch for the remote HEAD for an offline version, or by asking for remote refs using the fetch machinery (it's no problem to just obtain remote refs based on a ref-spec without fetching or changing anything, see the implementation of gix remote refs.