Skip to content

Commit

Permalink
Do a hard reset if update fails and try update again
Browse files Browse the repository at this point in the history
Signed-off-by: Mesbah Alam <Mesbah_Alam@ca.ibm.com>
  • Loading branch information
Mesbah-Alam committed Sep 27, 2022
1 parent 2b1925c commit 3f04c94
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion jck/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,34 @@
</then>
</if>
<echo message="Updating ${JCK_ROOT_USED} with latest..." />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false" resultproperty="return.code">
<arg value="pull" />
<arg value="${JCK_GIT_REPO_USED}" />
<arg value="${jck_branch}" />
</exec>
<if>
<not>
<equals arg1="${return.code}" arg2="0"/>
</not>
<then>
<echo message="Performing hard reset..." />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="reset" />
<arg value="--hard" />
<arg value="origin/master" />
</exec>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="clean" />
<arg value="-f" />
<arg value="-d" />
</exec>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="pull" />
<arg value="${JCK_GIT_REPO_USED}" />
<arg value="${jck_branch}" />
</exec>
</then>
</if>
</else>
</if>
</else>
Expand Down

0 comments on commit 3f04c94

Please sign in to comment.