diff options
author | Treeve Jelbert | 2015-06-14 11:10:45 +0200 |
---|---|---|
committer | Treeve Jelbert | 2015-06-14 11:10:45 +0200 |
commit | 4dc9981487912fa5cc99507cb664e2da6c253ec5 (patch) | |
tree | 72b92c4568393334d3396f5b6f3c228b10b84821 /clone_single_branch | |
parent | f1bf82ebfb33842e477bd2c3cb3bbddd1b78106f (diff) |
add clone_single_branch function
Diffstat (limited to 'clone_single_branch')
-rw-r--r-- | clone_single_branch | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clone_single_branch b/clone_single_branch new file mode 100644 index 0000000000..8c6f2636db --- /dev/null +++ b/clone_single_branch @@ -0,0 +1,23 @@ +# 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 +} |