      # We're using Git and sparse checkout to only clone the files we need
      with make_tempdir() as tmp_dir:
          cmd = (
              f"git clone {repo} {tmp_dir} --no-checkout --depth 1 "
              "--filter=blob:none"  # <-- The key bit
          )
          if branch is not None:
 
</s> remove             f"git clone {repo} {tmp_dir} --no-checkout "
            "--depth 1 --config core.sparseCheckout=true"
 </s> add             f"git clone {repo} {tmp_dir} --no-checkout --depth 1 "
            "--filter=blob:none"  # <-- The key bit </s> remove         msg.fail("Parent of destination of checkout must exist", exits=1)
 </s> add         raise IOError("Parent of destination of checkout must exist")
    # We're using Git, partial clone and sparse checkout to
    # only clone the files we need
    # This ends up being RIDICULOUS. omg.
    # So, every tutorial and SO post talks about 'sparse checkout'...But they
    # go and *clone* the whole repo. Worthless. And cloning part of a repo
    # turns out to be completely broken. The only way to specify a "path" is..
    # a path *on the server*? The contents of which, specifies the paths. Wat.
    # Obviously this is hopelessly broken and insecure, because you can query
    # arbitrary paths on the server! So nobody enables this.
    # What we have to do is disable *all* files. We could then just checkout
    # the path, and it'd "work", but be hopelessly slow...Because it goes and
    # transfers every missing object one-by-one. So the final piece is that we
    # need to use some weird git internals to fetch the missings in bulk, and
    # *that* we can do by path. </s> remove         run_command(cmd)
        with (tmp_dir / ".git" / "info" / "sparse-checkout").open("w") as f:
            f.write(subpath)
        run_command(["git", "-C", str(tmp_dir), "fetch"])
        run_command(["git", "-C", str(tmp_dir), "checkout"])
 </s> add         run_command(cmd, capture=True)
        # Now we need to find the missing filenames for the subpath we want.
        # Looking for this 'rev-list' command in the git --help? Hah.
        cmd = f"git -C {tmp_dir} rev-list --objects --all --missing=print -- {subpath}"
        ret = run_command(cmd, capture=True)
        missings = "\n".join([x[1:] for x in ret.stdout.split() if x.startswith("?")])
        # Now pass those missings into another bit of git internals
        run_command(
            f"git -C {tmp_dir} fetch-pack --stdin {repo}", capture=True, stdin=missings
        )
        # And finally, we can checkout our subpath
        run_command(f"git -C {tmp_dir} checkout {branch} {subpath}") </s> remove     if status != 0:
        sys.exit(status)
 </s> add     if ret.returncode != 0:
        sys.exit(ret.returncode)
    return ret </s> remove         status = subprocess.call(command, env=os.environ.copy())
 </s> add         ret = subprocess.run(
            command,
            env=os.environ.copy(),
            capture_output=capture,
            input=stdin,
            text=True,
            check=True,
        )
        # This is the "clone, but don't download anything" part.
      # We're using Git and sparse checkout to only clone the files we need
      with make_tempdir() as tmp_dir:
        # This is the "clone, but don't download anything" part.
          cmd = (
              f"git clone {repo} {tmp_dir} --no-checkout --depth 1 "
              "--filter=blob:none"  # <-- The key bit
          )
          if branch is not None:
keep add keep keep keep keep keep
 Fix the git "sparse checkout" functionality (#5973)

* Fix the git sparse checkout functionality

* Format 
spacy/cli/_util.py