From f90d7ee523e43a46138780ce6015a6f398a0e85c Mon Sep 17 00:00:00 2001 From: BAK BYEONG JUN Date: Tue, 15 Apr 2025 09:42:18 +0000 Subject: [PATCH] init --- tasks/git-clone-checkout/task.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tasks/git-clone-checkout/task.yaml b/tasks/git-clone-checkout/task.yaml index d4ec1b0..4eaf1ff 100644 --- a/tasks/git-clone-checkout/task.yaml +++ b/tasks/git-clone-checkout/task.yaml @@ -57,7 +57,7 @@ spec: - name: deleteExisting type: string - default: "false" + default: "true" description: Clean out the contents of the destination directory if it already exists before cloning. - name: httpProxy @@ -166,12 +166,16 @@ spec: if [ "$(params.deleteExisting)" = "true" ] && [ -d "$CLONE_DIR" ]; then echo "[INFO] Deleting existing directory $CLONE_DIR" rm -rf "$CLONE_DIR" + echo "[INFO] Cloning repository..." + git clone --depth=$(params.depth) $(params.url) "$CLONE_DIR" + cd "$CLONE_DIR" + else + cd "$CLONE_DIR" + git init + git remote add origin $(params.url) + git pull --depth=$(params.depth) origin master --allow-unrelated-histories fi - echo "[INFO] Cloning repository..." - git clone --depth=$(params.depth) $(params.url) "$CLONE_DIR" - cd "$CLONE_DIR" - if [ -n "$(params.refspec)" ]; then git fetch origin $(params.refspec) fi