Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions get-linux-source/checkout_latest_kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -xeuo pipefail

FETCH_DEPTH=${FETCH_DEPTH:-1}
REFERENCE_REPO_PATH=${REFERENCE_REPO_PATH:-/libbpfci/mirrors/linux}

echo KERNEL_ORIGIN = ${KERNEL_ORIGIN}
echo KERNEL_BRANCH = ${KERNEL_BRANCH}
Expand All @@ -13,10 +14,12 @@ if [ -d "${REPO_PATH}" ]; then
exit 1
fi

mkdir -p "${REPO_PATH}"
cd "${REPO_PATH}"
clone_args=()
clone_args+=(--branch ${KERNEL_BRANCH})
clone_args+=(--reference-if-able ${REFERENCE_REPO_PATH})
if [ ${FETCH_DEPTH} -ge 1 ]; then
clone_args+=(--depth ${FETCH_DEPTH})
fi

git clone "${clone_args[@]}" ${KERNEL_ORIGIN} ${REPO_PATH}

git init
git remote add origin ${KERNEL_ORIGIN}
git fetch --depth=${FETCH_DEPTH} origin ${KERNEL_BRANCH}
git checkout FETCH_HEAD
Loading