1
0
mirror of https://github.com/gitattributes/gitattributes.git synced 2025-01-22 08:18:50 -05:00

docs: posix compliant script

This commit is contained in:
Carlo Corradini 2023-08-17 13:06:00 +02:00 committed by GitHub
parent 8075afad8d
commit a9b4cc3d8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,12 +13,12 @@ ## CI step
To check if all files have a corresponding rule in .gitattributes, this script can be used:
```sh
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep "text: auto")
if [[ "$missing_attributes" ]]; then
echo ".gitattributes rule missing for the following files:";
echo "$missing_attributes";
missing_attributes=$(git ls-files | git check-attr -a --stdin | grep 'text: auto' || printf '\n')
if [ -n "$missing_attributes" ]; then
printf '%s\n%s\n' '.gitattributes rule missing for the following files:' "$missing_attributes"
else
echo "All files have a corresponding rule in .gitattributes";
printf '%s\n' 'All files have a corresponding rule in .gitattributes'
fi
```