Improve branch checkout fallback in update-Nitrov3.sh

Add fallback logic to try capitalized branch name if the
specified branch is not found, with a clear error message
if neither exists.
This commit is contained in:
root
2026-06-24 15:10:02 +02:00
parent 719b48a9ab
commit 391458ce49
+9 -1
View File
@@ -244,7 +244,15 @@ git_update() {
git stash --include-untracked || true
local old_head
old_head=$(git rev-parse HEAD)
git checkout "$branch"
if ! git checkout "$branch" 2>/dev/null; then
local alt="${branch^}"
if [ "$alt" != "$branch" ] && git checkout "$alt" 2>/dev/null; then
info "Branch '$branch' not found, using '$alt' instead"
branch="$alt"
else
die "Branch '$branch' (or '$alt') not found in $repo"
fi
fi
git pull
[ "$(git rev-parse HEAD)" != "$old_head" ]
}