github / github/platform-samples
Problem with pre-receive hook if there is whitespace character in file/folder name
- Linguagem predominante
- Shell
- Estrelas
- 2.2k
- Forks
- 1.9k
- Merge médio
- 7d 19h
- PRs com merge (30d)
- 1
Descrição
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)"
```
Guia de contribuição
Direção de pesquisa
Start with pre-receive-hooks/block_file_extensions.sh and inspect how the current git log output is iterated. Reproduce the hook with a file or folder name containing whitespace, then verify that the restricted extensions are still rejected and whitespace-containing names are processed correctly.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- git, shell
- Domínio
- devops
- Tipo de issue
- Bug
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 50/100