Skip to content
Snippets Groups Projects
Commit 4520bda0 authored by Jan Frenzel's avatar Jan Frenzel
Browse files

Replaced previous version of spell check with version that uses output

of git diff.
parent 1718aaaa
No related branches found
No related tags found
3 merge requests!322Merge preview into main,!319Merge preview into main,!262Restructure pages regarding switched off systems
This commit is part of merge request !262. Comments created here will be created in the context of that merge request.
......@@ -19,18 +19,33 @@ fi
any_fails=false
source_hash=`git merge-base HEAD "$branch"`
files=$(git diff --name-only "$source_hash")
for f in $files; do
if [ "${f: -3}" == ".md" ]; then
previous_count=`git show "$source_hash:$f" | getNumberOfAspellOutputLines`
current_count=`cat "$f" | getNumberOfAspellOutputLines`
#Remove everything except lines beginning with --- or +++
files=`git diff $source_hash | sed -n 's/^[-+]\{3,3\} //p'`
#Assume that we have pairs of lines (starting with --- and +++).
while read oldfile; do
read newfile
if [ "${newfile: -3}" == ".md" ]; then
if [ "$oldfile" == "/dev/null" ]; then
#Added files should not introduce new spelling mistakes
previous_count=0
else
previous_count=`git show "$source_hash:${oldfile:2}" | getNumberOfAspellOutputLines`
fi
if [ "$newfile" == "/dev/null" ]; then
#Deleted files do not contain any spelling mistakes
current_count=0
else
#Remove the prefix "b/"
newfile=${newfile:2}
current_count=`cat "$newfile" | getNumberOfAspellOutputLines`
fi
if [ $current_count -gt $previous_count ]; then
echo "-- File $f"
echo "-- File $newfile"
echo "Change increases spelling mistake count (from $previous_count to $current_count)"
any_fails=true
fi
fi
done
done <<< "$files"
if [ "$any_fails" == true ]; then
exit 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment