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