Blob


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