b998dfa722
If refspec is a branch name, ensure that the local branch name is always set to the refspec. In the opposite case when refspec is a commit hash, ensure that for git repositories we always end up in the 'detached HEAD' state. It's also cheaper and simpler to always run `git checkout` or `hg checkout` than it is to test if a checkout is actually needed. If the desired refspec is already checked out then these commands are no-ops. Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>