@@ -48,7 +48,7 @@ while [ : ]; do
4848 ;;
4949 --)
5050 shift ;
51- break
51+ break
5252 ;;
5353 esac
5454done
7373
7474# # check out the source
7575GIT_REPO=$( cut -d# -f1 <<< $GIT_URLREF )
76- GIT_REF=$( cut -d# -f2- <<< $GIT_URLREF )
76+ GIT_REF=$( cut -s - d# -f2- <<< $GIT_URLREF )
7777
7878echo " Fetching $GIT_REPO #$GIT_REF to $DESTINATION "
7979
@@ -86,17 +86,25 @@ if [[ -n "${SPARSE_PATH}" ]]; then
8686 git sparse-checkout set ${SPARSE_PATH}
8787 popd
8888else
89- git clone ${GIT_REPO} ${DESTINATION}
89+ git clone ${GIT_REPO} ${DESTINATION}
9090fi
9191pushd ${DESTINATION}
92- git checkout ${GIT_REF}
92+ if [[ -n " ${GIT_REF} " ]]; then
93+ git checkout ${GIT_REF}
94+ fi
9395COMMIT_SHA=$( git rev-parse HEAD)
9496git submodule update --init --recursive
97+ if [[ " ${GIT_REPO} " == * " gitlab" * ]]; then
98+ git remote remove origin
99+ if grep -q -r gitlab-ci-token .git; then
100+ grep -r gitlab-ci-token .git | awk -F: ' {print $1}' | xargs rm -f
101+ fi
102+ git branch -D main
103+ fi
95104popd
96105
97106# # update the manifest file
98-
99107mkdir -p $( dirname ${MANIFEST} )
100108touch ${MANIFEST}
101109PACKAGE=$( basename " ${DESTINATION} " )
102- yq eval --inplace " . += {\" ${PACKAGE} \" : {\" url\" : \" ${GIT_REPO} \" , \" tracking_ref\" : \" ${GIT_REF} \" , \" latest_verified_commit\" : \" ${COMMIT_SHA} \" , \" mode\" : \" git-clone\" }}" ${MANIFEST}
110+ yq eval --inplace " . += {\" ${PACKAGE} \" : {\" url\" : \" ${GIT_REPO} \" , \" tracking_ref\" : \" ${GIT_REF} \" , \" latest_verified_commit\" : \" ${COMMIT_SHA} \" , \" mode\" : \" git-clone\" }}" ${MANIFEST}
0 commit comments