aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/cppcheck/cppcheck.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/cppcheck/cppcheck.sh b/tools/cppcheck/cppcheck.sh
index 9730773acf..9bf95dc871 100755
--- a/tools/cppcheck/cppcheck.sh
+++ b/tools/cppcheck/cppcheck.sh
@@ -62,7 +62,7 @@ exit_cleanup() {
if [ "$MODE" = "html" ]; then
echo "</table></body></html>"
fi
- if [ -z "$1" ] ; then
+ if [ -n "$1" ] ; then
exit "$1"
fi
}
@@ -96,7 +96,7 @@ fi
if [ "$LAST_COMMITS" -gt 0 ] ; then
TARGET=$( git diff --name-only HEAD~"$LAST_COMMITS".. | grep -E '\.(c|cpp)$' )
- if [ -z "$TARGET" ] ; then
+ if [ -z "${TARGET//[[:space:]]/}" ] ; then
echo "No C or C++ files found in the last $LAST_COMMITS commit(s)."
exit_cleanup 0
fi
@@ -105,7 +105,7 @@ fi
if [ "$OPEN_FILES" = "yes" ] ; then
TARGET=$(git diff --name-only | grep -E '\.(c|cpp)$' )
TARGET="$TARGET $(git diff --staged --name-only | grep -E '\.(c|cpp)$' )"
- if [ -z "$TARGET" ] ; then
+ if [ -z "${TARGET//[[:space:]]/}" ] ; then
echo "No C or C++ files are currently opened (modified or added for next commit)."
exit_cleanup 0
fi