3 f2900386 2022-10-31 thomas # Copyright (c) 2022 Stefan Sperling <stsp@openbsd.org>
5 f2900386 2022-10-31 thomas # Permission to use, copy, modify, and distribute this software for any
6 f2900386 2022-10-31 thomas # purpose with or without fee is hereby granted, provided that the above
7 f2900386 2022-10-31 thomas # copyright notice and this permission notice appear in all copies.
9 f2900386 2022-10-31 thomas # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 f2900386 2022-10-31 thomas # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 f2900386 2022-10-31 thomas # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 f2900386 2022-10-31 thomas # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 f2900386 2022-10-31 thomas # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 f2900386 2022-10-31 thomas # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 f2900386 2022-10-31 thomas # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 f2900386 2022-10-31 thomas . ../cmdline/common.sh
19 a07c01e0 2022-11-08 thomas make_repo()
21 a07c01e0 2022-11-08 thomas local repo_path="$1"
22 a07c01e0 2022-11-08 thomas local no_tree="$2"
24 a07c01e0 2022-11-08 thomas gotadmin init "${repo_path}"
26 a07c01e0 2022-11-08 thomas if [ -n "$no_tree" ]; then
30 a07c01e0 2022-11-08 thomas test_tree=`mktemp -d "${GOTD_TEST_ROOT}/gotd-test-tree-XXXXXXXXX"`
31 a07c01e0 2022-11-08 thomas make_test_tree "$test_tree"
32 a07c01e0 2022-11-08 thomas got import -m "import the test tree" -r "${GOTD_TEST_REPO}" "$test_tree" \
33 a07c01e0 2022-11-08 thomas > /dev/null
34 a07c01e0 2022-11-08 thomas rm -r "$test_tree" # TODO: trap
38 f2900386 2022-10-31 thomas if [ -e "${GOTD_TEST_REPO}" ]; then
39 f2900386 2022-10-31 thomas rm -rf "${GOTD_TEST_REPO}"
42 a07c01e0 2022-11-08 thomas make_repo "${GOTD_TEST_REPO}" "$1"