From 01184be20525e8e28a6955246aa056d8061e602f Mon Sep 17 00:00:00 2001 From: Thomas Miceli Date: Tue, 4 Apr 2023 02:09:00 +0200 Subject: [PATCH] Fix pre-receive hook script --- internal/resources/pre-receive | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/internal/resources/pre-receive b/internal/resources/pre-receive index 86121c3..693b7a0 100644 --- a/internal/resources/pre-receive +++ b/internal/resources/pre-receive @@ -1,20 +1,24 @@ #!/bin/sh -disallowed_files=() +disallowed_files="" -while read old_rev new_rev ref +while read -r old_rev new_rev ref do - for file in $(git diff --name-only $old_rev $new_rev) + while IFS= read -r file do - if [[ $file =~ / ]]; then - disallowed_files+=($file) - fi - done + case $file in + */*) + disallowed_files="${disallowed_files}${file} " + ;; + esac + done <