GetComponens --update fails if a git repository is on a detached head
Issue #2505
new
if one is one a detached head eg after a git checkout master~1
then a GetComponents --update
of the Cactus tree containing this repository fails with an error message along the lines:
./GetComponents --update --root . repos/cactusamrex/azure-pipelines/carpetx.th
-----------------------------------------------------------------
Checking out module: CarpetX/SHTOOLS
from repository: https://bitbucket.org/eschnett/cactusamrex.git
into: ./arrangements
Switched to branch 'master'
sh: 1: Syntax error: "(" unexpected (expecting "then")
?[1m?[31mWarning: ?[0mCould not update cactusamrex. Could not checkout original branch.
which is due to a set of commands in GetComponents like this:
"if [ xrefs/heads/$current_branch != x`$git symbolic-ref -q HEAD` ] ; then " .
" $git checkout $current_branch ; " .
"fi");
which fail if $current_branch
reads (HEAD detached at 6b009bf)
.