1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 09:47:58 +00:00

fix borgfs patterns/paths processing, fixes #3551

Just checking for None in patterns.py (and removing the set_defaults
calls in archiver.py) did not work as other arg parsing code relies on
having an empty list (in .patterns, .paths) to append to.

Thus I stayed away from pattern.py and rather fixed the defaults for
.paths and .patterns in all parsers.
This commit is contained in:
Thomas Waldmann 2018-03-05 17:02:49 +01:00
parent 35df0ab532
commit df9020389c

View file

@ -2304,7 +2304,9 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups',
add_help=False)
parser.set_defaults(fallback2_func=functools.partial(self.do_maincommand_help, parser))
# paths and patterns must have an empty list as default everywhere
parser.set_defaults(fallback2_func=functools.partial(self.do_maincommand_help, parser),
paths=[], patterns=[])
parser.common_options = self.CommonOptions(define_common_options,
suffix_precedence=('_maincommand', '_midcommand', '_subcommand'))
parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__,
@ -2312,7 +2314,6 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
parser.common_options.add_common_group(parser, '_maincommand', provide_defaults=True)
common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog)
# some empty defaults for all subparsers
common_parser.set_defaults(paths=[], patterns=[])
parser.common_options.add_common_group(common_parser, '_subcommand')