[Intel-gfx] [maintainer-tools PATCH 1/2] dim: abstract git commit range expansion helper

Jani Nikula jani.nikula at intel.com
Wed Mar 16 17:40:03 UTC 2016


Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 dim | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/dim b/dim
index 67671de198a0..65985bc4909a 100755
--- a/dim
+++ b/dim
@@ -690,19 +690,23 @@ function checkpatch_commit
 	fi
 }
 
-dim_alias_check_patch=checkpatch
-dim_alias_cp=checkpatch
-function dim_checkpatch
+# turn $1 in to a git commit range
+function rangeish()
 {
-	local range
-
 	if [ -z "$1" ]; then
-		range="HEAD^..HEAD"
+		echo "HEAD^..HEAD"
 	elif [ -n "`echo $1 | grep '\.\.'`" ]; then
-		range="$1"
+		echo "$1"
 	else
-		range="$1..HEAD"
+		echo "$1..HEAD"
 	fi
+}
+
+dim_alias_check_patch=checkpatch
+dim_alias_cp=checkpatch
+function dim_checkpatch
+{
+	local range=$(rangeish "$1")
 
 	for commit in $(git rev-list --reverse $range); do
 		checkpatch_commit $commit || true
-- 
2.1.4



More information about the Intel-gfx mailing list