1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 02:08:54 +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.

(cherry picked from commit df9020389c)
This commit is contained in:
Thomas Waldmann 2018-03-05 17:02:49 +01:00
parent 996a3dc2be
commit d5917204c3

View file

@ -2562,7 +2562,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__,
@ -2570,7 +2572,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')