diff mbox

[maintainer-tools,RFC,11/17] dim: move dim_pull_request parameter check to the function

Message ID e27cbddc3904608c31239ae8a9d4ce5cc8ac04d3.1453818220.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Jan. 26, 2016, 2:32 p.m. UTC
More abstraction is better, also guards against invalid internal use.

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

Patch

diff --git a/dim b/dim
index b9152a256a26..34f2312be37a 100755
--- a/dim
+++ b/dim
@@ -581,6 +581,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
 
@@ -864,10 +869,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)