@@ -47,18 +47,18 @@ stages:
47
47
48
48
# On downstream pipeline checkout the necessary branch
49
49
- if [[ "$CI_PIPELINE_SOURCE" == 'pipeline' ]]; then
50
- if ` git -C $CI_PROJECT_DIR show-ref $ACI_SOURCE_BRANCH > /dev/null` ; then
51
- git -C $CI_PROJECT_DIR checkout $ACI_SOURCE_BRANCH;
52
- elif ` git -C $CI_PROJECT_DIR ls-remote --exit-code --heads origin $ACI_SOURCE_BRANCH > /dev/null` ; then
53
- git -C $CI_PROJECT_DIR config remote.origin.fetch "+refs/heads/* :refs/remotes/origin/*"
54
- git -C $CI_PROJECT_DIR remote update
55
- git -C $CI_PROJECT_DIR checkout $ACI_SOURCE_BRANCH;
56
- elif ` git -C $CI_PROJECT_DIR show-ref $ACI_TARGET_BRANCH > /dev/null` ; then
57
- git -C $CI_PROJECT_DIR checkout $ACI_TARGET_BRANCH;
58
- elif ` git -C $CI_PROJECT_DIR ls-remote --exit-code --heads origin $ACI_TARGET_BRANCH > /dev/null` ; then
59
- git -C $CI_PROJECT_DIR config remote.origin.fetch "+refs/heads/* :refs/remotes/origin/*"
60
- git -C $CI_PROJECT_DIR remote update
61
- git -C $CI_PROJECT_DIR checkout $ACI_TARGET_BRANCH;
50
+ if git -C " $CI_PROJECT_DIR" show-ref --quiet -- "$ACI_SOURCE_BRANCH" ; then
51
+ git -C " $CI_PROJECT_DIR" checkout -- " $ACI_SOURCE_BRANCH" ;
52
+ elif git -C " $CI_PROJECT_DIR" ls-remote --exit-code -- origin " $ACI_SOURCE_BRANCH" ; then
53
+ git -C " $CI_PROJECT_DIR" config remote.origin.fetch "+refs/heads/$ACI_SOURCE_BRANCH :refs/remotes/origin/$ACI_SOURCE_BRANCH";
54
+ git -C " $CI_PROJECT_DIR" remote update;
55
+ git -C " $CI_PROJECT_DIR" checkout -- " $ACI_SOURCE_BRANCH" ;
56
+ elif git -C " $CI_PROJECT_DIR" show-ref --quiet -- "$ACI_TARGET_BRANCH" ; then
57
+ git -C " $CI_PROJECT_DIR" checkout -- " $ACI_TARGET_BRANCH" ;
58
+ elif git -C " $CI_PROJECT_DIR" ls-remote --exit-code -- origin " $ACI_TARGET_BRANCH" ; then
59
+ git -C " $CI_PROJECT_DIR" config remote.origin.fetch "+refs/heads/$ACI_TARGET_BRANCH :refs/remotes/origin/$ACI_TARGET_BRANCH";
60
+ git -C " $CI_PROJECT_DIR" remote update;
61
+ git -C " $CI_PROJECT_DIR" checkout -- " $ACI_TARGET_BRANCH" ;
62
62
fi
63
63
fi
64
64
0 commit comments