@@ -47,9 +47,15 @@ setup_hook()
echo "cnt=$skip_revs" > "$hook_type-counter"
rm -f "$rawsvnrepo/hooks/"*-commit # drop previous hooks
hook="$rawsvnrepo/hooks/$hook_type"
- cat > "$hook" <<- 'EOF1'
+ cat >"$hook" <<-EOF
#!/bin/sh
set -e
+
+ PATH=\"$PATH\"
+ export PATH
+ EOF
+
+ cat >>"$hook" <<-'EOF'
cd "$1/.." # "$1" is repository location
exec >> svn-hook.log 2>&1
hook="$(basename "$0")"
@@ -59,11 +65,11 @@ setup_hook()
cnt="$(($cnt - 1))"
echo "cnt=$cnt" > ./$hook-counter
[ "$cnt" = "0" ] || exit 0
-EOF1
+ EOF
+
if [ "$hook_type" = "pre-commit" ]; then
echo "echo 'commit disallowed' >&2; exit 1" >>"$hook"
else
- echo "PATH=\"$PATH\"; export PATH" >>"$hook"
echo "svnconf=\"$svnconf\"" >>"$hook"
cat >>"$hook" <<- 'EOF2'
cd work-auto-commits.svn
The post-commit hook in t9164 is executed with a default environment. To work around this issue we already write the current `PATH` value into the hook script. But this is done at a point where we already tried to execute non-built-in commands, namely basename(1). While this seems to work alright on most platforms, it fails on NixOS. Set the `PATH` variable earlier to fix this issue. Note that we do this via two separate heredocs. This is done because in the first one we do want to expand variables, whereas in the second one we don't. Signed-off-by: Patrick Steinhardt <ps@pks.im> --- t/t9164-git-svn-dcommit-concurrent.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)