Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/misc/scripts/gitignore_check.sh
9897 views
1
set -uo pipefail
2
shopt -s globstar
3
4
echo -e ".gitignore validation..."
5
6
# Get a list of files that exist in the repo but are ignored.
7
8
# The --verbose flag also includes files un-ignored via ! prefixes.
9
# We filter those out with a somewhat awkward `awk` directive.
10
# (Explanation: Split each line by : delimiters,
11
# see if the actual gitignore line shown in the third field starts with !,
12
# if it doesn't, print it.)
13
14
# ignorecase for the sake of Windows users.
15
16
output=$(git -c core.ignorecase=true check-ignore --verbose --no-index **/* | \
17
awk -F ':' '{ if ($3 !~ /^!/) print $0 }')
18
19
# Then we take this result and return success if it's empty.
20
if [ -z "$output" ]; then
21
exit 0
22
else
23
# And print the result if it isn't.
24
echo "$output"
25
exit 1
26
fi
27
28