~matthew-t-bentley/duplicity/duplicity

« back to all changes in this revision

Viewing changes to duplicity/selection.py

  • Committer: Kenneth Loafman
  • Date: 2016-12-11 16:53:12 UTC
  • Revision ID: kenneth@loafman.com-20161211165312-ccdw48io9eunyxur
* Merged in lp:~aaron-whitehouse/duplicity/Bug_1624725_files_within_folder_slash
  - Fixed Bug #1624725, so that an include glob ending in "/" now includes folder contents (for globs with
    and without special characters). This preserves the behaviour that an expression ending in "/" only
    matches a folder, but now the contents of any matching folder is included.

Show diffs side-by-side

added added

removed removed

Lines of Context:
473
473
 
474
474
        """
475
475
        # Internal. Used by glob_get_sf and unit tests.
 
476
        # ToDo: Make all globbing/non-globbing use same code path
 
477
        # This distinction has bitten us too many times with bugs in one or
 
478
        # the other.
476
479
        match_only_dirs = False
477
480
 
478
481
        if filename != "/" and filename[-1] == "/":
492
495
        # Internal. Used by glob_get_filename_sf.
493
496
 
494
497
        def include_sel_func(path):
495
 
            if match_only_dirs and not path.isdir():
496
 
                # If the glob ended with a /, only match directories
 
498
            if len(tuple) == len(path.index) and match_only_dirs and not path.isdir():
 
499
                # If we are assessing the actual directory (rather than the
 
500
                # contents of the directory) and the glob ended with a /,
 
501
                # only match directories
497
502
                return None
498
503
            elif (path.index == tuple[:len(path.index)] or
499
504
                    path.index[:len(tuple)] == tuple):