From 6276dfd4b742dfbcab199e842a2f3dbfe6a93b64 Mon Sep 17 00:00:00 2001 From: Hinrikus Wolf <hinrikus@fsmpi.rwth-aachen.de> Date: Sat, 20 Jul 2019 20:41:12 +0200 Subject: [PATCH] add parameter for checking out a specific git branch --- scripts/common.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/common.sh b/scripts/common.sh index 6c306d6..7f59765 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -12,10 +12,16 @@ function get_sources() { # $1: source package name # $2: git repository +# $3: (optional) specifc branch or tag function get_git_sources() { git clone $2 $1 cd $1 - git tag --sort "version:refname" -l | tail -n1 | xargs git checkout + if [[ ! -z $3 ]] # checks if $3 is not empty + then + git checkout $3 + else + git tag --sort "version:refname" -l | tail -n1 | xargs git checkout + fi } # $1: patch directory name -- GitLab