Blame


1 f2900386 2022-10-31 thomas #!/bin/sh
2 f2900386 2022-10-31 thomas #
3 f2900386 2022-10-31 thomas # Copyright (c) 2022 Stefan Sperling <stsp@openbsd.org>
4 f2900386 2022-10-31 thomas #
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.
8 f2900386 2022-10-31 thomas #
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.
16 f2900386 2022-10-31 thomas
17 f2900386 2022-10-31 thomas . ../cmdline/common.sh
18 f2900386 2022-10-31 thomas
19 a07c01e0 2022-11-08 thomas make_repo()
20 a07c01e0 2022-11-08 thomas {
21 a07c01e0 2022-11-08 thomas local repo_path="$1"
22 a07c01e0 2022-11-08 thomas local no_tree="$2"
23 a07c01e0 2022-11-08 thomas
24 a07c01e0 2022-11-08 thomas gotadmin init "${repo_path}"
25 a07c01e0 2022-11-08 thomas
26 a07c01e0 2022-11-08 thomas if [ -n "$no_tree" ]; then
27 a07c01e0 2022-11-08 thomas return
28 a07c01e0 2022-11-08 thomas fi
29 a07c01e0 2022-11-08 thomas
30 d6e78555 2023-06-01 thomas test_tree=`mktemp -d "${GOTD_TEST_ROOT}/gotd-test-tree-XXXXXXXXXX"`
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
35 a07c01e0 2022-11-08 thomas }
36 a07c01e0 2022-11-08 thomas
37 a07c01e0 2022-11-08 thomas
38 f2900386 2022-10-31 thomas if [ -e "${GOTD_TEST_REPO}" ]; then
39 f2900386 2022-10-31 thomas rm -rf "${GOTD_TEST_REPO}"
40 f2900386 2022-10-31 thomas fi
41 f2900386 2022-10-31 thomas
42 a07c01e0 2022-11-08 thomas make_repo "${GOTD_TEST_REPO}" "$1"