The following diff makes `update-patches' ask for 'y' or 'N', accept
nothing but 'y' as valid confirmation to open the editor and exit
cleanly otherwise.

Current behaviour is to prompt anything out of the blue and treat every
reply as confirmation to run an editor on updated patches. The only way
to get away without editing is ^C (which still updates patches
successfully but returns 1 anyway).

Someone mentioned a make variable as user knob to override this
behaviour (unconditionally?); If at all, I'd like to handle this
separately.

Feedback? OK?

Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1414
diff -u -p -r1.1414 bsd.port.mk
--- bsd.port.mk 4 Jun 2018 06:14:56 -0000       1.1414
+++ bsd.port.mk 8 Jun 2018 21:02:37 -0000
@@ -2362,11 +2362,12 @@ update-patches:
                PATCH_LIST='${PATCH_LIST}' DIFF_ARGS='${DIFF_ARGS}' \
                DISTORIG=${DISTORIG} PATCHORIG=${PATCHORIG} \
                ${_PERLSCRIPT}/update-patches`; \
-       case $$toedit in "");; \
-       *) read i?'edit patches: '; \
-       cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} $$toedit;; esac
-
-
+       if [ -n "$$toedit" ]; then \
+               read -r REPLY?'edit patches? [yN]: '; \
+               if [ "$$REPLY" = y ]; then \
+                       cd ${PATCHDIR} && $${VISUAL:-$${EDITOR:-/usr/bin/vi}} 
$$toedit; \
+               fi; \
+       fi
 
 .endif # IGNORECMD
 

Reply via email to