refs: move head_ref{,_submodule} to the common code