Skip to content

Commit cbe757f

Browse files
committed
Change indentation, add comment, use "git switch -c" instead of "git checkout -b"
1 parent 33585ea commit cbe757f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

entrypoint.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,14 @@ git config --global user.name "$USER_NAME"
7272
{
7373
git clone --single-branch --depth 1 --branch "$TARGET_BRANCH" "$GIT_CMD_REPOSITORY" "$CLONE_DIR"
7474
} || {
75-
if [ "$CREATE_TARGET_BRANCH_IF_NEEDED" = 'true' ] ; then
76-
git clone --single-branch --depth 1 "$GIT_CMD_REPOSITORY" "$CLONE_DIR"
77-
else
78-
false
79-
fi
75+
if [ "$CREATE_TARGET_BRANCH_IF_NEEDED" = "true" ]
76+
then
77+
# Default branch of the repository is cloned. Later on the required branch
78+
# will be created
79+
git clone --single-branch --depth 1 "$GIT_CMD_REPOSITORY" "$CLONE_DIR"
80+
else
81+
false
82+
fi
8083
} || {
8184
echo "::error::Could not clone the destination repository. Command:"
8285
echo "::error::git clone --single-branch --branch $TARGET_BRANCH $GIT_CMD_REPOSITORY $CLONE_DIR"
@@ -145,8 +148,9 @@ echo "[+] Set directory is safe ($CLONE_DIR)"
145148
git config --global --add safe.directory "$CLONE_DIR"
146149

147150

148-
if [ "$CREATE_TARGET_BRANCH_IF_NEEDED" = 'true' ] ; then
149-
git checkout -b "$TARGET_BRANCH"
151+
if [ "$CREATE_TARGET_BRANCH_IF_NEEDED" = "true" ]
152+
then
153+
git switch -c "$TARGET_BRANCH"
150154
fi
151155

152156
echo "[+] Adding git commit"

0 commit comments

Comments
 (0)