Skip to content

Commit 849bb24

Browse files
committed
copilot review fix
1 parent e995cdb commit 849bb24

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

install-afc.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ if [[ -n "${_requested_branch}" && -d "${SCRIPT_DIR}/.git" ]]; then
2828
if [[ "${_current_branch}" != "${_requested_branch}" ]]; then
2929
echo "→ Switching to branch '${_requested_branch}' before loading…"
3030
git -C "${SCRIPT_DIR}" fetch --prune --quiet
31-
git -C "${SCRIPT_DIR}" checkout --quiet -- "${_requested_branch}"
31+
if ! git -C "${SCRIPT_DIR}" rev-parse --verify --quiet "origin/${_requested_branch}" >/dev/null 2>&1 \
32+
&& ! git -C "${SCRIPT_DIR}" rev-parse --verify --quiet "${_requested_branch}" >/dev/null 2>&1; then
33+
echo "✗ Branch '${_requested_branch}' does not exist locally or on the remote."
34+
exit 1
35+
fi
36+
git -C "${SCRIPT_DIR}" checkout --quiet "${_requested_branch}"
3237
git -C "${SCRIPT_DIR}" pull --rebase --quiet 2>/dev/null || true
3338
echo "✓ Branch switched. Restarting script…"
3439
exec "${SCRIPT_DIR}/$(basename "${BASH_SOURCE[0]}")" "$@"

0 commit comments

Comments
 (0)