Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with pre-receive hook if there is whitespace character in file/folder name #362

Open
windwalker78 opened this issue Aug 12, 2020 · 1 comment

Comments

@windwalker78
Copy link

windwalker78 commented Aug 12, 2020

Hello,

This is a suggestion for a change in: "pre-receive-hooks/block_file_extensions.sh". When you try to push an blob object, which has whitespace in its name, the current loop will break. My suggestion is to transform:

    for FILE  in `git log -1 --name-only --pretty=format:'' $COMMIT`;
    do
      case $FILE in
      *.zip|*.gz|*.tgz )
        echo "Hello there! We have restricted committing that filetype. Please see Dave in IT to discuss alternatives."
        exit 1
        ;;
      esac
    done

into:

      while IFS= read -r FILE; do
        case "$FILE" in
          *.zip|*.gz|*.tgz )
          echo "Hello there! We have restricted committing that filetype. Please see Dave in IT to discuss alternatives."
          exit 1
        esac
      done <<< "$(git log -1 --name-only --pretty=format:'' $COMMIT)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@windwalker78 and others