[Intel-gfx] [dim PATCH 1/7] dim: don't fail on grep not matching

Jani Nikula jani.nikula at intel.com
Thu Mar 23 10:06:16 UTC 2017


Oops, the comment told us to watch out for this.

Fixes: 56e53a49e28f ("dim: declare and assign separately")
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 dim | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/dim b/dim
index c1ac9e546ea9..ddcc18f17f0d 100755
--- a/dim
+++ b/dim
@@ -1091,10 +1091,7 @@ function checkpatch_commit
 	git --no-pager log --oneline -1 $commit
 	$cmd | scripts/checkpatch.pl -q --emacs --strict - || true
 
-	# FIXME: this relies on local assignment not failing on command
-	# substitution failures
-	bug_lines=$($cmd | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-].*\WBUG')
-	if test "$bug_lines" -eq 1; then
+	if bug_lines=$($cmd | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-].*\WBUG') && [[ "$bug_lines" = "1" ]]; then
 		warn_or_fail "New BUG macro added"
 	fi
 
-- 
2.1.4



More information about the Intel-gfx mailing list