Fix auto branch switch

This commit is contained in:
JSTayco 2023-04-01 10:17:36 -07:00
parent 0dbbaf5891
commit 69deea0979
1 changed files with 8 additions and 3 deletions

View File

@ -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."