[PATCH] dim: make apply-patch fail again

Daniel Vetter daniel.vetter at ffwll.ch
Wed Oct 17 12:05:59 UTC 2018


Somewhere since I originally typed this and today git apply-mbox lost
the error status for "this patch didn't apply cleanly". So instead of
exiting, we happily continue on and add Link: tags and other nonsense
to the current patch, instead of the one that we wanted to apply.

Fix this.

v2: It wasn't git am, it was us, wrapping the apply_patch function in
an if, which defeats set -e. Add explicit error handling. Thanks to
Jani for figuring this one out.

Cc: Jani Nikula <jani.nikula at linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dim b/dim
index af092e50bb08..8be504e46995 100755
--- a/dim
+++ b/dim
@@ -924,7 +924,10 @@ function apply_patch #patch_file
 		sob=-s
 	fi
 
-	git am --scissors -3 $sob "$@" $patch
+	if ! git am --scissors -3 $sob "$@" $patch ; then
+		echoerr "ERROR: git apply-mbox failed"
+		return 1
+	fi
 
 	if [ -n "$message_id" ]; then
 		dim_commit_add_tag "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id"
-- 
2.19.1



More information about the dim-tools mailing list