[repo] Hook self-test: keep its source files next to the work dir by absolute path and remove them first, so a run leaves nothing behind

This commit is contained in:
2026-11-07 19:22:32 +01:00
parent 60fb4b63ee
commit 85edfa7128
+5 -2
View File
@@ -65,8 +65,11 @@ expect_staged() {
B='-----BEGIN'
E='-----END'
mkdir -p "$WORK/../ianitor-hook-src.$$" && SRC="$WORK/../ianitor-hook-src.$$"
trap 'rm -rf "$WORK" "$SRC"' EXIT INT TERM
# An absolute path next to $WORK (not "$WORK/..", which no longer resolves once $WORK is gone),
# removed first.
SRC="$(dirname "$WORK")/ianitor-hook-src.$$"
mkdir -p "$SRC" || exit 2
trap 'rm -rf "$SRC" "$WORK"' EXIT INT TERM
printf '%s RSA PRIVATE KEY-----\nMIIBOgIBAAJBAK\n%s RSA PRIVATE KEY-----\n' "$B" "$E" > "$SRC/pem"
head -c 6291456 /dev/zero | tr '\000' 'a' > "$SRC/six-mb"