From 489669256bf9a09b772d838e7f76144cee317620 Mon Sep 17 00:00:00 2001 From: rmcdermo Date: Fri, 17 Jan 2025 16:43:03 -0500 Subject: [PATCH] Build: handle possible corrupt state of library repo --- Build/Scripts/HYPRE/build_hypre.sh | 8 ++++++++ Build/Scripts/SUNDIALS/build_sundials.sh | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Build/Scripts/HYPRE/build_hypre.sh b/Build/Scripts/HYPRE/build_hypre.sh index 3bdf051b900..b4cf155f52c 100755 --- a/Build/Scripts/HYPRE/build_hypre.sh +++ b/Build/Scripts/HYPRE/build_hypre.sh @@ -32,6 +32,14 @@ echo "Checking for hypre repository..." if [ -d "$FIREMODELS/hypre" ]; then echo "Hypre repository exists. Building hypre library." cd $FIREMODELS/hypre + # Handle possible corrupted state of repository + if git branch | grep -q "* master"; then + echo "On master branch" + else + git checkout master + fi + git checkout . + git clean -dxf if [[ "$(git tag -l $HYPRE_LIB_TAG)" == $HYPRE_LIB_TAG ]]; then echo "Checking out $HYPRE_LIB_TAG" git checkout $HYPRE_LIB_TAG diff --git a/Build/Scripts/SUNDIALS/build_sundials.sh b/Build/Scripts/SUNDIALS/build_sundials.sh index f69b32b0846..a8929b3a045 100755 --- a/Build/Scripts/SUNDIALS/build_sundials.sh +++ b/Build/Scripts/SUNDIALS/build_sundials.sh @@ -33,6 +33,14 @@ echo "Checking for sundials repository..." if [ -d "$FIREMODELS/sundials" ]; then echo "Sundials repository exists. Building sundials library." cd $FIREMODELS/sundials + # Handle possible corrupted state of repository + if git branch | grep -q "* main"; then + echo "On main branch" + else + git checkout main + fi + git checkout . + git clean -dxf if [[ "$(git tag -l $SUNDIALS_LIB_TAG)" == $SUNDIALS_LIB_TAG ]]; then echo "Checking out $SUNDIALS_LIB_TAG" git checkout $SUNDIALS_LIB_TAG