set -uo pipefail1shopt -s globstar23echo -e ".gitignore validation..."45# Get a list of files that exist in the repo but are ignored.67# The --verbose flag also includes files un-ignored via ! prefixes.8# We filter those out with a somewhat awkward `awk` directive.9# (Explanation: Split each line by : delimiters,10# see if the actual gitignore line shown in the third field starts with !,11# if it doesn't, print it.)1213# ignorecase for the sake of Windows users.1415output=$(git -c core.ignorecase=true check-ignore --verbose --no-index **/* | \16awk -F ':' '{ if ($3 !~ /^!/) print $0 }')1718# Then we take this result and return success if it's empty.19if [ -z "$output" ]; then20exit 021else22# And print the result if it isn't.23echo "$output"24exit 125fi262728