Skip to content

Commit

Permalink
don't apply the spell check on all the file if no changes (#4031)
Browse files Browse the repository at this point in the history
Before that:

$time git commit --amend 2> log
real    7m19.811s
user    49m14.012s
sys     0m16.668s

$ls -lh log
-rw-rw-r-- 1 sbrunner sbrunner 1,8M janv. 20 14:05 log
  • Loading branch information
sbrunner authored and 3nids committed Jan 20, 2017
1 parent f389cea commit 4543835
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/prepare-commit.sh
Expand Up @@ -41,7 +41,9 @@ set -e

# determine changed files
MODIFIED=$(git status --porcelain| sed -ne "s/^ *[MA] *//p" | sort -u)
${TOPLEVEL}/scripts/spell_check/check_spelling.sh $MODIFIED
if [ "$MODIFIED" != "" ]; then
${TOPLEVEL}/scripts/spell_check/check_spelling.sh $MODIFIED
fi


if [ -z "$MODIFIED" ]; then
Expand Down
3 changes: 3 additions & 0 deletions scripts/spell_check/check_spelling.sh
Expand Up @@ -41,6 +41,9 @@ shift $(expr $OPTIND - 1)
if [ ! $# -eq 0 ]; then
EXCLUDE=$(cat $AGIGNORE | sed -e 's/\s*#.*$//' -e '/^\s*$/d' | tr '\n' '|' | sed -e 's/|$//')
INPUTFILES=$(echo $@ | tr -s '[[:blank:]]' '\n' | egrep -iv "$EXCLUDE" | tr '\n' ' ' )
if [ "$INPUTFILES" == "" ]; then
exit 0
fi
echo "Running spell check on files: $INPUTFILES"
else
INPUTFILES="."
Expand Down

0 comments on commit 4543835

Please sign in to comment.