You've already forked Atomcms-edit
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:
+9
-1
@@ -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" ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user