Skip to content

Commit 14affa1

Browse files
authored
Merge pull request #38 from guitarrapc/feature/fix_test
fix: integration-test-checkout_advanced_fetchoptions failed on tag
2 parents b2a6489 + 9219171 commit 14affa1

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

Diff for: .circleci/test-deploy.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424
- image: cimg/base:stable
2525
steps:
2626
- git-shallow-clone/checkout_advanced:
27-
clone_options: '--shallow-since "2022-10-10"'
28-
fetch_options: '--shallow-since "2022-10-10"'
27+
clone_options: "--depth 100 --single-branch"
28+
fetch_options: "--depth 5"
2929
integration-test-checkout_advanced_notags:
3030
docker:
3131
- image: cimg/base:stable
3232
steps:
3333
- git-shallow-clone/checkout_advanced:
34-
clone_options: "--depth 1"
34+
clone_options: "--depth 1 --no-tags"
3535
fetch_options: "--depth 1000 --no-tags"
3636
tag_fetch_options: "--no-tags"
3737
# should be no tags on PR. should be 1 tag on tag push.

Diff for: src/commands/checkout.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,31 @@ steps:
9393
git config --global url."ssh://[email protected]".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

Comments
 (0)