<html>#2505: GetComponens --update fails if a git repository is on a detached head
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Roland Haas</td></tr>
<tr><td style='text-align:right'> Status:</td><td>new</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'> Version:</td><td>development version</td></tr>
<tr><td style='text-align:right'> Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>minor</td></tr>
<tr><td style='text-align:right'>Component:</td><td>GetComponents</td></tr>
</table>
<p>if one is one a detached head eg after a <code>git checkout master~1</code> then a <code>GetComponents --update</code> of the Cactus tree containing this repository fails with an error message along the lines:</p>
<div class="codehilite"><pre><span></span>./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.
</pre></div>
<p>which is due to a set of commands in GetComponents like this:</p>
<div class="codehilite"><pre><span></span>"if [ xrefs/heads/$current_branch != x`$git symbolic-ref -q HEAD` ] ; then " .
" $git checkout $current_branch ; " .
"fi");
</pre></div>
<p>which fail if <code>$current_branch</code> reads <code>(HEAD detached at 6b009bf)</code>.</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2505/getcomponens-update-fails-if-a-git'>https://bitbucket.org/einsteintoolkit/tickets/issues/2505/getcomponens-update-fails-if-a-git</a></p>
</html>