Blame


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