summaryrefslogblamecommitdiffstats
path: root/clone_single_branch
blob: 8c6f2636db15147dd26715232098dff3f50d7571 (plain) (tree)






















                                                                                             
# clone_single_branch is intended for use when we only want a small part of a big repository 
# for immediate use.
# This is especially true for projects which do not release tarballs.

# This function would normally be used in the PRE_BUILD script,
# in which case DOWNLOAD  should simply be 'true'

# VERSION can be either a branch name or a tag

base_clone_single_branch() {
  cd $BUILD_DIRECTORY
  if [[ -d $3 ]];then
    message "${PROBLEM_COLOR}$3 already exists!\n$DEFAULT_COLOR"
    false
  else
    message "${MESSAGE_COLOR}Cloning into $3\n$DEFAULT_COLOR"
    git clone -q --depth=1 --single-branch -b $1 $2 $3
  fi
}

clone_single_branch() {
  base_clone_single_branch $VERSION $SOURCE_URL $SPELL
}