summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeve Jelbert2015-06-14 11:10:45 +0200
committerTreeve Jelbert2015-06-14 11:10:45 +0200
commit4dc9981487912fa5cc99507cb664e2da6c253ec5 (patch)
tree72b92c4568393334d3396f5b6f3c228b10b84821
parentf1bf82ebfb33842e477bd2c3cb3bbddd1b78106f (diff)
add clone_single_branch function
-rw-r--r--ChangeLog3
-rw-r--r--clone_single_branch23
2 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d598d8b58d..cbe47832db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2015-06-14 Treeve Jelbert <treeve@sourcemage.org>
+ * clone_single_branch: added
+
2015-06-07 Treeve Jelbert <treeve@sourcemage.org>
* move bluez-qt tokde-frameworks
* qt5-qmake/signond: enw spell, single-signon
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
+}