From 8445b64d6b426775cdb7d91bd9fbc3a1d462fa3c Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 15 Oct 2025 06:42:16 -0700 Subject: [PATCH] Check if the dev branch exists before moving to it. --- tasks/general/acct_mgmt/users.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index 802bab3..ec7e10d 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -928,8 +928,17 @@ git ls-remote --heads | sort if [[ "$base" != "dev" ]]; then - echo -e "\n* Switching back to dev." - git switch dev + git ls-remote --exit-code --heads origin dev + dev_exists="$?" + if [[ "$dev_exists" == 0 ]]; then + echo -e "\n* Switching back to dev." + git switch dev + elif [[ "$dev_exists" == 2 ]]; then + echo -e "\n* Switching back to main." + git switch main + else + echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***" + fi fi echo -e "\n* Verifying which branch we're on."