From f7488968c0ab80b923927cc8bf6376fd28fd5022 Mon Sep 17 00:00:00 2001
From: intrigeri <intrigeri@boum.org>
Date: Fri, 15 Jun 2012 20:21:09 +0200
Subject: [PATCH] rsync: generate excludes command-line snippet the same way as
 the duplicity handler does.

The latter has a robust history wrt. dealing with excludes / glob / quoting
etc., let's use that instead of the shiny new sed-based way.
---
 handlers/rsync.in | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/handlers/rsync.in b/handlers/rsync.in
index 386255e..c584e7f 100644
--- a/handlers/rsync.in
+++ b/handlers/rsync.in
@@ -275,8 +275,15 @@ function eval_config {
     mv=move_files
   fi
 
-  excludes=`echo "$exclude" | @SED@ -e "s/^/--exclude='/g" -e "s/ /' --exclude='/g" -e "s/$/'/"`
-
+  set -o noglob
+  SAVEIFS=$IFS
+  IFS=$(echo -en "\n\b")
+  for i in $exclude; do
+     str="${i//__star__/*}"
+     excludes="${excludes} --exclude='$str'"
+  done
+  IFS=$SAVEIFS
+  set +o noglob
 }
 
 function rotate_short {
-- 
GitLab