Previously, the script attempted to directly merge ${merge}, which could f
ail if the branch was not already available locally. This update explicitly
fetches the branch from origin and then merges FETCH_HEAD with --ff, ensuring
the merge works even when the branch is missing locally.
27 lines
540 B
Bash
Executable File
27 lines
540 B
Bash
Executable File
#!/bin/bash
|
|
|
|
function die() {
|
|
echo $@
|
|
exit 1
|
|
}
|
|
|
|
[ $# -ge 3 -a $# -le 4 ] || die "usage: $0 <directory> <repository> <ref> [<merge-ref>]"
|
|
|
|
set -ex
|
|
|
|
dir=$1
|
|
repo=$2
|
|
ref=$3
|
|
merge=$4
|
|
|
|
rm -rf ${dir}
|
|
git clone --filter=blob:none -n ${repo} ${dir}
|
|
cd ${dir}
|
|
git config user.email "jenkins@openairinterface.org"
|
|
git config user.name "OAI Jenkins"
|
|
git config advice.detachedHead false
|
|
mkdir -p cmake_targets/log
|
|
git checkout -f ${ref}
|
|
[ -n "${merge}" ] && git fetch origin ${merge} && git merge --ff FETCH_HEAD -m "Temporary merge for CI"
|
|
exit 0
|