Commit 90421dd0 authored by bescoto's avatar bescoto

Fix for Toni Price's empty dir --include **XXX selection bug


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@739 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent a378ee4c
......@@ -7,6 +7,10 @@ report by Carsten Lorenz).
Another fix for long-filenames crash, this time when a long-named
directory with files in it gets deleted
Selection fix: empty directories could sometimes be improperly
excluded if certain include expressions involving a non-trailing '**'
were used. Bug reported by Toni Price.
New in v1.0.3 (2005/11/25)
--------------------------
......
......@@ -209,10 +209,12 @@ class Select:
def Select(self, rp):
"""Run through the selection functions and return dominant val 0/1/2"""
scanned = 0 # 0, by default, or 2 if prev sel func scanned rp
for sf in self.selection_functions:
result = sf(rp)
if result == 1 or result == 0 or (result == 2 and rp.isdir()):
return result
if result == 1: return 1
elif result == 0: return scanned
elif result == 2: scanned = 2
return 1
def ParseArgs(self, argtuples, filelists):
......
......@@ -448,4 +448,27 @@ testfiles/select**/2
# verbose = 1)
class CommandTest(unittest.TestCase):
"""Test rdiff-backup on actual directories"""
def testEmptyDirInclude(self):
"""Make sure empty directories are included with **xx exps
This checks for a bug present in 1.0.3/1.1.5 and similar.
"""
outrp = MakeOutputDir()
selrp = rpath.RPath(Globals.local_connection, 'testfiles/seltest')
re_init_dir(selrp)
emptydir = selrp.append('emptydir')
emptydir.mkdir()
rdiff_backup(1, 1, selrp.path, outrp.path,
extra_options = ("--include **XX "
"--exclude testfiles/seltest/YYYY"))
outempty = outrp.append('emptydir')
assert outempty.isdir(), outempty
if __name__ == "__main__": unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment