forked from dotnet/android-samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pre-commit.windows
41 lines (34 loc) · 961 Bytes
/
pre-commit.windows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
run_validator()
{
./xcsv.exe $1 $2 $3;
if [ $? != 0 ]; then
exit 1;
fi;
}
for dir in `find . -maxdepth 1 -type d | grep -v "\.$" | grep -v "\./\." | sed "s/^\.\///"`; do
build_done="false"
for file in `git diff --cached --name-only | grep "^$dir\/"`; do
if ! [ -d $dir ]; then
break;
fi;
if [ -f $dir/Makefile ]; then
break;
fi;
if [ -e $dir/ignore ]; then
break;
fi;
if [ $file = $dir/README.md ]; then
run_validator markdown $dir;
elif [ $file = $dir/Metadata.xml ]; then
run_validator metadata $dir;
elif [ `echo $file | grep "^$dir\/Screenshots\/"` ]; then
run_validator screenshot $dir;
else
if [ $build_done = "false" ]; then
run_validator build $dir;
build_done="true"
fi;
fi;
done;
done;