Skip to contentSkip to conversation

dim: Avoid false positives with BUG detection

PATCH In review Tvrtko Ursulin 2 participants 3 messages Mar 18, 2016 – Mar 21, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 dim: Avoid false positives with BUG detection

From: Tvrtko Ursulin <[email protected]>

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.

---
 dim | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
dim +4 -2
index 67671de198a0..2d03acd8329b 100755
@@ -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
 }
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 6 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

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.

Quoted 6 lines

v2: Sent the incomplete version out...

v3: Rebase.

Ack, please push.
-Daniel

Quoted 31 lines
---
 dim | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
dim +4 -2
index 67671de198a0..2d03acd8329b 100755
@@ -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
 }
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

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.

Quoted 8 lines
Quoted 6 lines

v2: Sent the incomplete version out...

v3: Rebase.

Ack, please push.

I didn't realize I can - pushed. :)

Thanks,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx