From 69deea0979d804203b7a9ee203782fbb226335a1 Mon Sep 17 00:00:00 2001 From: JSTayco Date: Sat, 1 Apr 2023 10:17:36 -0700 Subject: [PATCH] Fix auto branch switch --- setup.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 1f564bb..7b40b49 100755 --- a/setup.sh +++ b/setup.sh @@ -356,10 +356,15 @@ update_kohya_ss() { git -C "$DIR" pull "$GIT_REPO" "$BRANCH" >&3 fi - if ! git -C "$DIR" switch "$BRANCH" >&4; then - echo "Branch $BRANCH did not exist. Creating it." >&4 - git -C "$DIR" switch -c "$BRANCH" >&4 + if [ "$MANUAL_BRANCH_SWITCH" = false ]; then + git -C "$DIR" switch "$BRANCH" >&3 + else + if ! git -C "$DIR" switch "$BRANCH" >&4; then + echo "Branch $BRANCH did not exist. Creating it." >&4 + git -C "$DIR" switch -c "$BRANCH" >&4 + fi fi + fi else echo "You need to install git."