docs: def sync(sourcedir=None, exclude_gitignore_entries=None, exclude_regex_list=None):
      """ Create and populate workdir.options.path, memoized so that it only runs once """
      _set_log_level()
      sourcedir = sourcedir or options.sync_sourcedir or os.getcwd()
      if exclude_gitignore_entries is None:
          exclude_gitignore_entries = options.sync_exclude_gitignore_entries
      exclude_regex_list = exclude_regex_list or copy.copy(options.sync_exclude_regex_list)
      gitignore_path = os.path.join(sourcedir, '.gitignore')
      if exclude_gitignore_entries and os.path.isfile(gitignore_path):
          gitignore_lines = []
          with open(gitignore_path) as gitignore:
              for line in gitignore.readlines():
                  line = line.strip()
                  if line and not line.startswith('#'):
                      gitignore_lines.append(_gitignore_entry_to_regex(line))
          exclude_regex_list += gitignore_lines
      dirsync_logger = logging.getLogger('dirsync')
      dirsync_logger.setLevel(logging.INFO if options.debug else logging.FATAL)
      logger.info('syncing {} to {}'.format(sourcedir, options.path))
      logger.debug('excluding {} from sync'.format(exclude_regex_list))
      dirsync.sync(
          sourcedir=sourcedir,
          targetdir=options.path,
          action='sync',
          create=True,
          exclude=exclude_regex_list,
          logger=dirsync_logger
      )