OrcaSlicer/tests/update_catch2.sh
Cory Cross b48dd917fd Vendor a 3.x version of Catch2
Everything is surely broken at this point.
2025-11-02 19:19:02 -08:00

39 lines
839 B
Bash
Executable file

#!/bin/bash
# update_catch2.sh [refspec]
# `./update_catch2 $(cat catch2/COMMIT)` should be a no-op
# Yes, this is kinda reinventing submodule or subtree or FetchContent
# But AFAICT FetchContent is not otherwise used in this repo
# submodules are annoying
# subtree is overkill
# So here you go, if you want to use it.
set -ex
SCRIPTDIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
TDIR="$(mktemp -d)"
trap 'rm -fR "${TDIR}"' EXIT
cd "${TDIR}"
git init -b dontcare
git fetch --depth=1 https://github.com/catchorg/Catch2.git "$1"
git checkout FETCH_HEAD
COMMIT="$(git rev-parse HEAD)"
cd "$SCRIPTDIR"
git rm -f -r --quiet -- catch2
rm -fR catch2 || true
mkdir catch2
mv "${TDIR}/"CMake* catch2
mv "${TDIR}/src" catch2
mv "${TDIR}/extras" catch2
mv "${TDIR}/LICENSE.txt" catch2
echo "${COMMIT}" > catch2/COMMIT
git add catch2