@@ -11,6 +11,9 @@ for tutorial in $tutorials; do
1111 # Check permalinks
1212 docs=$( find " ./$tutorial " -maxdepth 1 -type f -name " *.md" -print0 | xargs -0 grep -l " permalink:" | sed " s/^.\///" )
1313 for doc in $docs ; do
14+ # Only check files that are tracked by git
15+ git ls-files --error-unmatch " $doc " > /dev/null 2>&1 || continue
16+
1417 link=$( grep " permalink:" " $doc " | sed " s/permalink: \+//" )
1518 prefix=" tutorials-$tutorial "
1619
@@ -28,6 +31,8 @@ for tutorial in $tutorials; do
2831 images=$( find " ./$tutorial /images" -type f 2> /dev/null | sed " s/^.\///" )
2932 prefix=" tutorials-$tutorial -"
3033 for img in $images ; do
34+ # Only check files that are tracked by git
35+ git ls-files --error-unmatch " $img " > /dev/null 2>&1 || continue
3136 if ! [[ $img =~ ^$tutorial /images/$prefix ]]; then
3237 echo " $img : error: wrong filename"
3338 echo " $img : note: expected prefix \" $prefix \" "
4247# Check quickstart
4348docs=$( find ./quickstart -maxdepth 1 -type f -name " *.md" -print0 | xargs -0 grep -l " permalink:" | sed " s/^.\///" )
4449for doc in $docs ; do
50+ # Only check files that are tracked by git
51+ git ls-files --error-unmatch " $doc " > /dev/null 2>&1 || continue
4552 link=$( grep " permalink:" " $doc " | sed " s/permalink: \+//" )
4653 prefix=" quickstart"
4754
5966images=$( find ./quickstart/images -type f 2> /dev/null | sed " s/^.\///" )
6067prefix=" quickstart-"
6168for img in $images ; do
69+ # Only check files that are tracked by git
70+ git ls-files --error-unmatch " $img " > /dev/null 2>&1 || continue
6271 if ! [[ $img =~ ^quickstart/images/$prefix ]]; then
6372 echo " $img : error: wrong filename"
6473 echo " $img : note: expected prefix \" $prefix \" "
0 commit comments