github / github/platform-samples

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

Đang mở
#362 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Shell
Star
2.2k
Fork
1.9k
Merge trung bình
7 ngày 19 giờ
Pull request đã merge (30 ngày)
1

Mô tả

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)"
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.