anchor.diff:            // Skip dot files.
             continue;
           }
  -        final String devicePath =
  -            path.join(prefix, path.relative(file.path, from: directory.path));
  +        final String relativePath =
  +            path.relative(file.path, from: directory.path);
  +        final String devicePath = path.join(prefix, relativePath);
  +        bool filtered = false;
           if ((fileFilter != null) &&
               !fileFilter.contains(devicePath)) {
  +          if (packagesDirectoryName != null) {
  +            // Double check the filter for packages/packagename/
  +            final String packagesDevicePath =
  +                path.join(packagesDirectoryName, relativePath);
  +            if (!fileFilter.contains(packagesDevicePath)) {
  +              // File was not in the filter set.
  +              filtered = true;
  +            }
  +          } else {
  +            // File was not in the filter set.
  +            filtered = true;
  +          }
  +        }
  +        if (filtered) {
             // Skip files that are not included in the filter.
             continue;
           }
  
positive.code: 
        for (String packageName in packageMap.map.keys) {
          Uri uri = packageMap.map[packageName];
          // Ignore self-references.
          if (uri.toString() == 'lib/')
            continue;
          Directory directory = new Directory.fromUri(uri);
          bool packageExists =
              await _scanDirectory(directory,
                                   directoryName: 'packages/$packageName',
                                   recursive: true,
                                   fileFilter: fileFilter);
          if (packageExists) {
            sb ??= new StringBuffer();
            sb.writeln('$packageName:packages/$packageName');
          }
        }
      }
  
negative.code:                               {String directoryName,
                                 bool recursive: false,
                                 bool ignoreDotFiles: true,
                                 String packagesDirectoryName,
                                 Set<String> fileFilter}) async {
      String prefix = directoryName;
      if (prefix == null) {
  