[PATCH] dim: switch to dry-run in warn_or_fail

Daniel Vetter daniel.vetter at ffwll.ch
Fri May 4 05:21:30 UTC 2018


When merging a pull requests there's potentially a long list of
problematic patches. By switching to dry-run mode we can dump them
all.

The upside here is that without this patch the workflow when
processing a pull is:

$ dim apply-pull ...
-> dim refuses, only reports first problem
$ dim -d apply-pull
-> you see all the issues, make up your mind to merge or not
$ dim -f apply-pull

With this patch we have one step less:

$ dim apply-pull
-> refuses pull, but with the auto-switch to dry-run reports
everything and you can immediately make up your mind to merge or not
$ dim -f apply-pull

Cc: Dave Airlie <airlied at gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/dim b/dim
index d8288a342352..499ffcfdd807 100755
--- a/dim
+++ b/dim
@@ -144,6 +144,12 @@ function echoerr
 	echo "$dim: $*" >&2
 }
 
+function enable_dry_run
+{
+	DRY_RUN=--dry-run
+	DRY="echo"
+}
+
 function warn_or_fail
 {
 	if [[ $FORCE ]] ; then
@@ -151,8 +157,8 @@ function warn_or_fail
 	elif [[ $DRY ]] ; then
 		echoerr "WARNING: $1, but continuing dry-run"
 	else
-		echoerr "ERROR: $1, aborting"
-		exit 1
+		echoerr "ERROR: $1, switching to dry-run mode"
+		enable_dry_run
 	fi
 }
 
@@ -2261,8 +2267,7 @@ HELP=
 while getopts hdfis opt; do
 	case "$opt" in
 		d)
-			DRY_RUN=--dry-run
-			DRY="echo"
+			enable_dry_run
 			;;
 		f)
 			FORCE=1
-- 
2.17.0



More information about the dim-tools mailing list