diff --git a/.githooks/test-pre-commit.sh b/.githooks/test-pre-commit.sh index a7a239c..771e14a 100755 --- a/.githooks/test-pre-commit.sh +++ b/.githooks/test-pre-commit.sh @@ -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"