Browse code

Pass branch parameter to git clone

Without this parameter, when we set GIT_DEPTH,
it may happen that we clone only master and
then cannot checkout branch

Change-Id: I39376914f8bfc286a308c99db6bc92cddab195b5

Jakub Wachowski authored on 2016/11/18 22:28:47
Showing 1 changed files
... ...
@@ -534,10 +534,8 @@ function git_clone {
534 534
                 echo "the project to the \$PROJECTS variable in the job definition."
535 535
                 die $LINENO "Cloning not allowed in this configuration"
536 536
             fi
537
-            git_timed clone $git_clone_flags $git_remote $git_dest
538
-            cd $git_dest
539
-            # This checkout syntax works for both branches and tags
540
-            git checkout $git_ref
537
+            # '--branch' can also take tags
538
+            git_timed clone $git_clone_flags $git_remote $git_dest --branch $git_ref
541 539
         elif [[ "$RECLONE" = "True" ]]; then
542 540
             # if it does exist then simulate what clone does if asked to RECLONE
543 541
             cd $git_dest