[workspace] F00: empty crates, licences, Nix flake, hook, CI
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# Dependency direction (CLAUDE.md §1): `relay` never depends on `client`;
|
||||
# `protocol` depends on nothing in this repository.
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
fail=0
|
||||
tree() { cargo tree --quiet -p "$1" -e normal --prefix none --format '{p}' | awk '{print $1}' | sort -u; }
|
||||
|
||||
if tree tabellarius-relay | grep -qx tabellarius-client; then
|
||||
echo "FAIL tabellarius-relay depends on tabellarius-client"; fail=1
|
||||
else
|
||||
echo "ok tabellarius-relay does not depend on tabellarius-client"
|
||||
fi
|
||||
|
||||
own=$(tree tabellarius-protocol | grep '^tabellarius-' | grep -vx tabellarius-protocol || true)
|
||||
if [ -n "$own" ]; then
|
||||
echo "FAIL tabellarius-protocol depends on: $own"; fail=1
|
||||
else
|
||||
echo "ok tabellarius-protocol depends on nothing in this repository"
|
||||
fi
|
||||
|
||||
exit $fail
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# Proves the pre-commit hook in a throwaway repository. Prints a count; exits 1 on any failure.
|
||||
set -eu
|
||||
root=$(cd "$(dirname "$0")/.." && pwd)
|
||||
passed=0
|
||||
failed=0
|
||||
|
||||
run_case() { # name path bytes expect(accept|reject)
|
||||
repo=$(mktemp -d)
|
||||
(
|
||||
cd "$repo"
|
||||
git init -q
|
||||
git config core.autocrlf false
|
||||
git config user.name hook-test
|
||||
git config user.email hook-test@invalid
|
||||
cp -r "$root/.githooks" .githooks
|
||||
git config core.hooksPath .githooks
|
||||
mkdir -p "$(dirname "$2")"
|
||||
head -c "$3" /dev/zero > "$2"
|
||||
git add -f "$2"
|
||||
git commit -q -m case >/dev/null 2>&1
|
||||
) && got=accept || got=reject
|
||||
rm -rf "$repo"
|
||||
if [ "$got" = "$4" ]; then passed=$((passed + 1)); else failed=$((failed + 1)); echo "FAIL $1: $got"; fi
|
||||
}
|
||||
|
||||
run_case "6 MB file is rejected" big.bin 6291456 reject
|
||||
run_case "file under target/ is rejected" target/debug/x 10 reject
|
||||
run_case "nested target/ is rejected" crates/relay/target/x 10 reject
|
||||
run_case "nix result link path is rejected" result 10 reject
|
||||
run_case "5 MB file is accepted" ok.bin 5242880 accept
|
||||
run_case "ordinary source file is accepted" crates/relay/src/main.rs 10 accept
|
||||
run_case "'targets.rs' is not mistaken for target/" src/targets.rs 10 accept
|
||||
|
||||
echo "hook tests: $passed passed, $failed failed"
|
||||
[ "$failed" -eq 0 ]
|
||||
Reference in New Issue
Block a user