From c0c02efafd0eb34355aa72e2f14f22ccd81018e9 Mon Sep 17 00:00:00 2001
From: intrigeri <intrigeri@boum.org>
Date: Sun, 12 Sep 2010 23:26:08 +0200
Subject: [PATCH] rdiff: support reading include/exclude patterns from files.

---
 AUTHORS           |  2 +-
 ChangeLog         |  7 +++++++
 handlers/rdiff.in | 10 ++++++++--
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 8c1d1c84..cec88192 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -21,7 +21,7 @@ garcondumonde@riseup.net
 Martin Krafft madduck@debian.org -- admingroup patch
 Anarcat -- lotsa patches
 Jamie McClelland -- cstream patches
-ale -- ldap cleanup
+ale -- ldap cleanup, rdiff support for reading include/exclude from files
 Sami Haahtinen <ressu@ressukka.net>
 Matthew Palmer -- mysql enhancements
 romain.tartiere@healthgrid.org -- ldap fixes
diff --git a/ChangeLog b/ChangeLog
index 7eb37d6a..792841e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+version 0.9.9 -- UNRELEASED
+    handler changes
+	rdiff:
+	 . Support reading include/exclude patterns from files using the
+	   "include @/etc/backup_includes" syntax (Closes Roundup bug
+	   #2370). Thanks to ale for the patch.
+
 version 0.9.8 -- September 12, 2010
     backupninja changes
 	 . Added GZIP_OPTS option, defaulting to --rsyncable, so that this
diff --git a/handlers/rdiff.in b/handlers/rdiff.in
index 60386fac..e391eddf 100644
--- a/handlers/rdiff.in
+++ b/handlers/rdiff.in
@@ -219,7 +219,10 @@ SAVEIFS=$IFS
 IFS=$(echo -en "\n\b")
 for i in $exclude; do
    str="${i//__star__/*}"
-   execstr="${execstr}--exclude '$str' "
+   case "$str" in
+      @*) execstr="${execstr}--exclude-globbing-filelist '${str#@}' " ;;
+      *) execstr="${execstr}--exclude '$str' " ;;
+   esac
 done
 IFS=$SAVEIFS
 # includes
@@ -228,7 +231,10 @@ IFS=$(echo -en "\n\b")
 for i in $include; do
    [ "$i" != "/" ] || fatal "Sorry, you cannot use 'include = /'"
    str="${i//__star__/*}"
-   execstr="${execstr}--include '$str' "
+   case "$str" in
+   @*) execstr="${execstr}--include-globbing-filelist '${str#@}' " ;;
+   *) execstr="${execstr}--include '$str' " ;;
+   esac
 done
 IFS=$SAVEIFS
 
-- 
GitLab