From 90742fc1be7b4ad77bf3fda110d5a9bda4eb2100 Mon Sep 17 00:00:00 2001 From: Jakub Wachowski Date: Fri, 18 Nov 2016 14:28:47 +0100 Subject: [PATCH] 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 --- functions-common | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/functions-common b/functions-common index d5014fd80a..458f3de363 100644 --- a/functions-common +++ b/functions-common @@ -534,10 +534,8 @@ function git_clone { echo "the project to the \$PROJECTS variable in the job definition." die $LINENO "Cloning not allowed in this configuration" fi - git_timed clone $git_clone_flags $git_remote $git_dest - cd $git_dest - # This checkout syntax works for both branches and tags - git checkout $git_ref + # '--branch' can also take tags + git_timed clone $git_clone_flags $git_remote $git_dest --branch $git_ref elif [[ "$RECLONE" = "True" ]]; then # if it does exist then simulate what clone does if asked to RECLONE cd $git_dest