fix number of queued ids passed from findtwixt() to got_pack_paint_commits()
[got-portable.git] / regress / gotwebd / prepare_test_repo.sh
blob7271ff360e32258fe78e8b8a7c1bd5c84524d446
1 #!/bin/sh
3 # Copyright (c) 2024 Mark Jamsek <mark@jamsek.dev>
4 # Copyright (c) 2022 Stefan Sperling <stsp@openbsd.org>
6 # Permission to use, copy, modify, and distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 . ${GOTWEBD_TEST_DATA_DIR}/common.sh
20 make_repo()
22 local chroot="$1"
23 local no_tree="$2"
24 local repo_path="${chroot}/got/public/repo.git"
26 if [ -e "${chroot}/got" ]; then
27 rm -rf "${chroot}/got"
30 mkdir -p "${chroot}/got/public"
31 if [ $? -ne 0 ]; then
32 echo "failed to make gotweb public repositories tree"
33 return 1
36 gotadmin init -A "$GOT_TEST_ALGO" "${repo_path}"
38 if [ -n "$no_tree" ]; then
39 return
42 test_tree=$(mktemp -d "${chroot}/gotwebd-test-tree-XXXXXXXXXX")
43 make_test_tree "$test_tree"
45 got import -m "import the test tree" -r "${repo_path}" "$test_tree" \
46 > /dev/null
47 if [ $? -ne 0 ]; then
48 echo "failed to import test tree"
49 return 1
52 rm -r "$test_tree" # TODO: trap
55 make_repo "$@"