#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later

set -euo pipefail

. "$(dirname "$0")/lib.sh"

setup "$1"
plan 6

# prefix filter
write_conf \
    "d $TESTDIR/prefix-yes/sub 0755 - - -" \
    "d $TESTDIR/prefix-no/sub 0755 - - -"
run_test "prefix filter command" "$SEEDFILES" --create --prefix="$TESTDIR/prefix-yes" "$TESTDIR/conf"
assert_exists "$TESTDIR/prefix-yes/sub"
assert_not_exists "$TESTDIR/prefix-no"

# exclude prefix filter
write_conf \
    "d $TESTDIR/exc-a 0755 - - -" \
    "d $TESTDIR/exc-b 0755 - - -"
run_test "exclude prefix filter command" "$SEEDFILES" --create --exclude-prefix="$TESTDIR/exc-b" "$TESTDIR/conf"
assert_exists "$TESTDIR/exc-a"
assert_not_exists "$TESTDIR/exc-b"

done_testing
