docs: def extract(repository, destination, version, debug=False):
      """
      Extract the specified repository/version into the given directory and
      return None.
  
      :param repository: A string containing the path to the repository to be
       extracted.
      :param destination: A string containing the directory to clone the
       repository into.  Relative to the directory ``gilt`` is running
       in. Must end with a '/'.
      :param version: A string containing the branch/tag/sha to be exported.
      :param debug: An optional bool to toggle debug output.
      :return: None
      """
      with util.saved_cwd():
          if os.path.isdir(destination):
              shutil.rmtree(destination)
  
          os.chdir(repository)
          _get_version(version, debug)
          cmd = sh.git.bake(
              'checkout-index', force=True, all=True, prefix=destination)
          util.run_command(cmd, debug=debug)
          msg = '  - extracting ({}) {} to {}'.format(version, repository,
                                                      destination)
          util.print_info(msg)