Fix trailing whitespace check in Windows and Linux
Previous check in check.bat considered only uncommitted changes.
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
@ECHO OFF
|
||||
:: This batch file performs the same checks as TravisCI and should be run after each commit and before
|
||||
:: pushing the commits
|
||||
:: This batch file performs the same checks as TravisCI and should be run after each commit and
|
||||
:: before pushing the commits
|
||||
|
||||
echo "---------- Trailing whitespace check -------------"
|
||||
REM git diff --check 'git rev-list --max-count=1 --reverse HEAD' ..$TRAVIS_BRANCH
|
||||
git diff --check master
|
||||
:: check uncommitted changes
|
||||
git diff --check HEAD
|
||||
if errorlevel 1 (
|
||||
echo Failure Reason is %errorlevel%
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
:: check all commits starting from initial commit
|
||||
for /F %i in ('"git rev-list --max-parents=0 HEAD"') do git diff --check %i..HEAD
|
||||
if errorlevel 1 (
|
||||
echo Failure Reason is %errorlevel%
|
||||
exit /b %errorlevel%
|
||||
@@ -31,4 +37,4 @@ if errorlevel 1 (
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
echo "---------- All tests passed -------------"
|
||||
echo "---------- All tests passed -------------"
|
||||
|
||||
@@ -5,7 +5,13 @@
|
||||
#
|
||||
|
||||
echo "---------- Trailing whitespace check -------------"
|
||||
git diff --check `git rev-list HEAD | tail -n 1`..$TRAVIS_BRANCH
|
||||
# check uncommitted changes
|
||||
git diff --check HEAD
|
||||
if [ $? != 0 ]; then
|
||||
exit 1;
|
||||
fi
|
||||
# check all commits starting from initial commit
|
||||
git diff --check `git rev-list --max-parents=0 HEAD`..HEAD
|
||||
if [ $? != 0 ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user