@@ -93,29 +93,31 @@ steps:
9393 git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
9494 git config --global gc.auto 0 || true
9595
96- # checkout
97- git clone --depth << parameters.depth >> $CIRCLE_REPOSITORY_URL "<< parameters.path >>"
98- cd "<< parameters.path >>"
99-
100- # Define Tag Fetch args
96+ # Define Tag args
10197 if [ -n "$CIRCLE_TAG" ]; then
10298 # only tags operation have default --tags. others will no tag options
103- tag_args="--tags"
99+ clone_tag_args=
100+ fetch_tag_args="--tags"
104101 fi
105102 if [ '<< parameters.no_tags >>' == 'true' ]; then
106- tag_args="--no-tags"
103+ clone_tag_args="--no-tags"
104+ fetch_tag_args="--no-tags"
107105 fi
108106
107+ # checkout
108+ git clone ${clone_tag_args} --depth << parameters.depth >> $CIRCLE_REPOSITORY_URL "<< parameters.path >>"
109+ cd "<< parameters.path >>"
110+
109111 # Fetch remote and check the commit ID of the checked out code (sh version of bash `elif [[ "$CIRCLE_BRANCH" =~ ^pull\/* ]]`)
110112 if [ -n "$CIRCLE_TAG" ]; then
111113 # tag
112- git fetch ${tag_args } --depth << parameters.fetch_depth >> --force origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}"
114+ git fetch ${fetch_tag_args } --depth << parameters.fetch_depth >> --force origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}"
113115 elif [[ $(echo $CIRCLE_BRANCH | grep -E ^pull\/[0-9]+$) ]]; then
114116 # pull request
115- git fetch ${tag_args } --depth << parameters.fetch_depth >> --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
117+ git fetch ${fetch_tag_args } --depth << parameters.fetch_depth >> --force origin "${CIRCLE_BRANCH}/head:remotes/origin/${CIRCLE_BRANCH}"
116118 else
117119 # others
118- git fetch ${tag_args } --depth=<< parameters.fetch_depth >> --force origin "$CIRCLE_BRANCH:remotes/origin/$CIRCLE_BRANCH"
120+ git fetch ${fetch_tag_args } --depth=<< parameters.fetch_depth >> --force origin "$CIRCLE_BRANCH:remotes/origin/$CIRCLE_BRANCH"
119121 fi
120122
121123 # Check the commit ID of the checked out code
0 commit comments