#2505: GetComponens --update fails if a git repository is on a detached head
Reporter:Roland Haas
Status:new
Milestone:
Version:development version
Type:bug
Priority:minor
Component:GetComponents

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")

Warning: Could 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).

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2505/getcomponens-update-fails-if-a-git