[Intel-gfx] [maintainer-tools PATCH v2 11/33] dim: move dim_pull_request parameter check to the function

Jani Nikula jani.nikula at intel.com
Thu Jan 28 05:27:05 PST 2016


More abstraction is better, also guards against invalid internal use.

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

diff --git a/dim b/dim
index a2c0d74c37e8..5833306e35c5 100755
--- a/dim
+++ b/dim
@@ -591,6 +591,11 @@ function dim_create_workdir
 # dim_pull_request branch upstream
 function dim_pull_request
 {
+	if [[ "x$1" = "x" || "x$2" = "x" ]]; then
+		echo "usage: $0 $subcommand branch upstream"
+		exit 1
+	fi
+
 	branch=$1
 	upstream=$2
 
@@ -874,10 +879,6 @@ case "$subcommand" in
 		$DRY git cherry-pick $1
 		;;
 	pull-request)
-		if [[ "x$1" = "x" || "x$2" = "x" ]]; then
-			echo "usage: $0 $subcommand branch upstream"
-			exit 1
-		fi
 		dim_pull_request $*
 		;;
 	pull-request-next)
-- 
2.1.4



More information about the Intel-gfx mailing list