From: Rob Browning Date: Mon, 30 Jun 2014 18:33:05 +0000 (-0500) Subject: parse_excludes: drop empty --exclude-from paths X-Git-Tag: 0.26-rc2~3 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=32a49cafbfe03c883e1f45cb5e1324eda68f4638 parse_excludes: drop empty --exclude-from paths Empty paths shouldn't match during drecurse, but there's no point in including them. Signed-off-by: Rob Browning Tested-by: Rob Browning --- diff --git a/Documentation/bup-drecurse.md b/Documentation/bup-drecurse.md index 66683a2..ab97ea2 100644 --- a/Documentation/bup-drecurse.md +++ b/Documentation/bup-drecurse.md @@ -43,7 +43,7 @@ come after its children, making this easy. \--exclude-from=*filename* : read --exclude paths from *filename*, one path per-line (may be - repeated). + repeated). Ignore completely empty lines. \--exclude-rx=*pattern* : exclude any path matching *pattern*. See `bup-index`(1) for diff --git a/Documentation/bup-index.md b/Documentation/bup-index.md index e4dd2ac..c69c2ab 100644 --- a/Documentation/bup-index.md +++ b/Documentation/bup-index.md @@ -152,7 +152,7 @@ does, due to the accommodations described above. \--exclude-from=*filename* : read --exclude paths from *filename*, one path per-line (may be - repeated). + repeated). Ignore completely empty lines. \--exclude-rx=*pattern* : exclude any path matching *pattern*, which must be a Python regular diff --git a/lib/bup/helpers.py b/lib/bup/helpers.py index 93bcc07..b55c4a9 100644 --- a/lib/bup/helpers.py +++ b/lib/bup/helpers.py @@ -812,7 +812,10 @@ def parse_excludes(options, fatal): except IOError, e: raise fatal("couldn't read %s" % parameter) for exclude_path in f.readlines(): - excluded_paths.append(realpath(exclude_path.strip())) + # FIXME: perhaps this should be rstrip('\n') + exclude_path = realpath(exclude_path.strip()) + if exclude_path: + excluded_paths.append(exclude_path) return sorted(frozenset(excluded_paths))