Allow for ocaml-typo=prune
parent
5af8d6d946
commit
3f8c68b9d4
|
@ -157,6 +157,24 @@ EOF
|
||||||
testsuite > /dev/null && exit 1 || echo pass
|
testsuite > /dev/null && exit 1 || echo pass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Test to see if any part of the directory name has been marked prune
|
||||||
|
not_pruned () {
|
||||||
|
DIR=$(dirname "$1")
|
||||||
|
if [ "$DIR" = "." ] ; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
case ",$(git check-attr ocaml-typo "$DIR" | sed -e 's/.*: //')," in
|
||||||
|
,prune,)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
|
||||||
|
not_pruned $DIR
|
||||||
|
return $?
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
CheckTypoTree () {
|
CheckTypoTree () {
|
||||||
export OCAML_CT_HEAD=$1
|
export OCAML_CT_HEAD=$1
|
||||||
export OCAML_CT_LS_FILES="git diff-tree --no-commit-id --name-only -r $2 --"
|
export OCAML_CT_LS_FILES="git diff-tree --no-commit-id --name-only -r $2 --"
|
||||||
|
@ -166,9 +184,13 @@ CheckTypoTree () {
|
||||||
git diff-tree --diff-filter=d --no-commit-id --name-only -r $1 \
|
git diff-tree --diff-filter=d --no-commit-id --name-only -r $1 \
|
||||||
| (while IFS= read -r path
|
| (while IFS= read -r path
|
||||||
do
|
do
|
||||||
echo "Checking $1: $path"
|
if not_pruned $path ; then
|
||||||
if ! tools/check-typo $path ; then
|
echo "Checking $1: $path"
|
||||||
touch check-typo-failed
|
if ! tools/check-typo $path ; then
|
||||||
|
touch check-typo-failed
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "NOT checking $1: $path (ocaml-typo=prune)"
|
||||||
fi
|
fi
|
||||||
done)
|
done)
|
||||||
rm -f tmp-index
|
rm -f tmp-index
|
||||||
|
|
|
@ -45,6 +45,24 @@ if ! git diff-index --check --cached $against -- $FILES ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Test to see if any part of the directory name has been marked prune
|
||||||
|
not_pruned () {
|
||||||
|
DIR=$(dirname "$1")
|
||||||
|
if [ "$DIR" = "." ] ; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
case ",$(git check-attr ocaml-typo "$DIR" | sed -e 's/.*: //')," in
|
||||||
|
,prune,)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
|
||||||
|
not_pruned $DIR
|
||||||
|
return $?
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Now run check-typo over all the files in the index
|
# Now run check-typo over all the files in the index
|
||||||
ERRORS=0
|
ERRORS=0
|
||||||
export OCAML_CT_PREFIX=:
|
export OCAML_CT_PREFIX=:
|
||||||
|
@ -52,7 +70,7 @@ export OCAML_CT_CAT="git cat-file --textconv"
|
||||||
export OCAML_CT_CA_FLAG=--cached
|
export OCAML_CT_CA_FLAG=--cached
|
||||||
git diff --diff-filter=d --staged --name-only | (while IFS= read -r path
|
git diff --diff-filter=d --staged --name-only | (while IFS= read -r path
|
||||||
do
|
do
|
||||||
if ! tools/check-typo $path ; then
|
if not_pruned $path && ! tools/check-typo $path ; then
|
||||||
ERRORS=1
|
ERRORS=1
|
||||||
fi
|
fi
|
||||||
done; exit $ERRORS)
|
done; exit $ERRORS)
|
||||||
|
|
Loading…
Reference in New Issue