scripts/check_format: fix unsupported git pathspec magic exclude

Pathspec magic exclude is unsupported in git <1.9.5.

Change-Id: Ibba4e6d6f0fa34ce766a42af0cd32a1dc3d16716
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460973
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Tomasz Kulasek 2019-07-09 14:11:20 +02:00 committed by Ben Walker
parent 14034200d9
commit 4171d1f552

View File

@ -14,6 +14,10 @@ function nproc() {
fi fi
function version_lt() {
[ $( echo -e "$1\n$2" | sort -V | head -1 ) != "$1" ]
}
rc=0 rc=0
echo -n "Checking file permissions..." echo -n "Checking file permissions..."
@ -92,6 +96,14 @@ else
echo "You do not have astyle installed so your code style is not being checked!" echo "You do not have astyle installed so your code style is not being checked!"
fi fi
GIT_VERSION=$( git --version | cut -d' ' -f3 )
if version_lt "1.9.5" "${GIT_VERSION}"; then
# git <1.9.5 doesn't support pathspec magic exclude
echo " Your git version is too old to perform all tests. Please update git to at least 1.9.5 version..."
exit 0
fi
echo -n "Checking comment style..." echo -n "Checking comment style..."
git grep --line-number -e '/[*][^ *-]' -- '*.[ch]' > comment.log || true git grep --line-number -e '/[*][^ *-]' -- '*.[ch]' > comment.log || true