[dim PATCH 2/7] dim: abstract and fix maintainer scope check for dinq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Separate maintainer scope check from checkpatch, and only do the check
on applying patches. Also, fix the failures on grep not matching.

Fixes: 56e53a49e28f ("dim: declare and assign separately")
Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 dim | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/dim b/dim
index ddcc18f17f0d..268bc6ca280d 100755
--- a/dim
+++ b/dim
@@ -698,6 +698,7 @@ function dim_apply_branch
 	fi
 
 	checkpatch_commit HEAD
+	check_maintainer $branch HEAD
 
 	eval $DRY $DIM_POST_APPLY_ACTION
 }
@@ -1080,6 +1081,25 @@ function dim_conf
 	dim_checkout drm-intel-next-fixes "$@"
 }
 
+# $1 branch
+# $2 commit
+function check_maintainer
+{
+	local branch commit
+
+	branch=$1
+	commit=$2
+
+        if [ "$branch" = "drm-intel-next-queued" ]; then
+		if non_i915_files=$(git diff-tree --no-commit-id --name-only -r $commit | \
+			grep -v "^\(drivers/gpu/drm/i915/\|include/drm/i915\|include/uapi/drm/i915\)") && [[ -n "$non_i915_files" ]]; then
+			echo -e "The following files are outside of i915 maintenance scope:\n"
+			echo "$non_i915_files"
+			echo -e "\nConfirm you have appropriate Acked-by and Reviewed-by for above files."
+		fi
+	fi
+}
+
 # $1 is the git sha1 to check
 function checkpatch_commit
 {
@@ -1094,19 +1114,6 @@ function checkpatch_commit
 	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
-
-        if [ "$branch" = "drm-intel-next-queued" ]; then
-		# FIXME: this relies on local assignment not failing on command
-		# substitution failures
-		non_i915_files=$(git diff-tree --no-commit-id --name-only -r $commit | \
-			grep -v "^\(drivers/gpu/drm/i915/\|include/drm/i915\|include/uapi/drm/i915\)")
-
-		if [ -n "$non_i915_files" ]; then
-			echo -e "The following files are outside of i915 maintenance scope:\n"
-			echo "$non_i915_files"
-			echo -e "\nConfirm you have appropriate Acked-by and Reviewed-by for above files."
-		fi
-	fi
 }
 
 # turn $1 in to a git commit range
-- 
2.1.4

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux