All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 maintainer-tools] dim: Avoid false positives with BUG detection
@ 2016-03-18 11:52 Tvrtko Ursulin
  2016-03-21  9:37 ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Tvrtko Ursulin @ 2016-03-18 11:52 UTC (permalink / raw)
  To: Intel-gfx; +Cc: Jani Nikula

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Makes sure that the diff line adding the BUG is not immediately
preceded by the diff line removing the BUG. Or in other words,
avoids false positives when existing BUG is edited.

v2: Sent the incomplete version out...

v3: Rebase.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 dim | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dim b/dim
index 67671de198a0..2d03acd8329b 100755
--- a/dim
+++ b/dim
@@ -681,11 +681,13 @@ function dim_conf
 function checkpatch_commit
 {
 	local commit=$1
+	local cmd="git show --pretty=email $commit"
 
 	git --no-pager log --oneline -1 $commit
-	git show $commit --pretty=email | scripts/checkpatch.pl -q --emacs --strict - || true
+	$cmd | scripts/checkpatch.pl -q --emacs --strict - || true
 
-	if git show $commit --pretty=email | grep '^\+.*\WBUG' > /dev/null; then
+	local bug_lines=$($cmd | grep -m 1 -B 1 '^\+.*\WBUG' | grep -c '^[+-].*\WBUG')
+	if test "$bug_lines" -eq 1; then
 		warn_or_fail "New BUG macro added"
 	fi
 }
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-21  9:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18 11:52 [PATCH v3 maintainer-tools] dim: Avoid false positives with BUG detection Tvrtko Ursulin
2016-03-21  9:37 ` Daniel Vetter
2016-03-21  9:57   ` Tvrtko Ursulin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.