              "--depth 1 --config core.sparseCheckout=true"
          )
          if branch is not None:
              cmd = f"{cmd} -b {branch}"
          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"])
          # We need Path(name) to make sure we also support subdirectories
          shutil.move(str(tmp_dir / Path(subpath)), str(dest))
          print(dest)
          print(list(dest.iterdir()))
 
</s> remove         print(dest)
        print(list(dest.iterdir()))
 </s> add  </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         return (self.tp / (self.tp + self.fn + 1e-100))
 </s> add         return self.tp / (self.tp + self.fn + 1e-100) </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.
        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}")
              "--depth 1 --config core.sparseCheckout=true"
          )
          if branch is not None:
              cmd = f"{cmd} -b {branch}"
        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}")
        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}")
        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}")
        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}")
        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}")
          # We need Path(name) to make sure we also support subdirectories
          shutil.move(str(tmp_dir / Path(subpath)), str(dest))
          print(dest)
          print(list(dest.iterdir()))
keep keep keep keep replace replace replace replace replace keep keep keep keep
 Fix the git "sparse checkout" functionality (#5973)

* Fix the git sparse checkout functionality

* Format 
spacy/cli/_util.py