[pacman-dev] [PATCH] pacdiff: allow DIFFPROG to contain commandline options

Allan McRae allan at archlinux.org
Sun Jun 29 03:55:06 EDT 2014

Also use 'vim -d' as default diff viewer.

Signed-off-by: Allan McRae <allan at archlinux.org>

In FS#40758, someone pointed out that vimdiff was not installed in their
vim package and suggested using 'vim -d' as the default DIFFPROG. I was
tempted to say use the DIFFPROG environmental variable to deal with that,
but you are unable to pass command line options using that.

The drawback is DIFFPROG can not genuinely contain spaces in the command.
Is anyone actually concerned about that?

 contrib/pacdiff.sh.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
index c8fbe74..ecb6ae2 100644
--- a/contrib/pacdiff.sh.in
+++ b/contrib/pacdiff.sh.in
@@ -23,7 +23,7 @@ shopt -s extglob
 declare -r myname='pacdiff'
 declare -r myver='@PACKAGE_VERSION@'
+diffprog=${DIFFPROG:-'vim -d'}
 declare -a oldsaves
@@ -49,7 +49,7 @@ General Options:
   --nocolor         remove colors from output
 Environment Variables:
-  DIFFPROG          override the merge program: (default: vimdiff)
+  DIFFPROG          override the merge program: (default: 'vim -d')
   DIFFSEARCHPATH    override the search path. (only when using find)
                     (default: /etc)
@@ -118,7 +118,7 @@ done
-if ! type -p $diffprog >/dev/null; then
+if ! type -p ${diffprog%% *} >/dev/null; then
 	error "Cannot find the $diffprog binary required for viewing differences."
 	exit 1

More information about the pacman-dev mailing list