This change ensures that when ref `HEAD` is specified, it is not incorrectly resolved to `refs/head/HEAD`. `HEAD` is not treated as a branch, and correctly resolved from the ref spec. Resolves: #7024 Closes: #6874