Fix support for existant files in git assets

This commit is contained in:
Matthew Honnibal 2020-08-24 22:35:02 +02:00
parent 3d7cd79f2d
commit 31004fc46a

View File

@ -50,12 +50,17 @@ def project_assets(project_dir: Path) -> None:
if "git" in asset: if "git" in asset:
if dest.exists(): if dest.exists():
# If there's already a file, check for checksum # If there's already a file, check for checksum
if checksum and checksum == get_checksum(dest_path): if checksum and checksum == get_checksum(dest):
msg.good(f"Skipping download with matching checksum: {dest}") msg.good(f"Skipping download with matching checksum: {dest}")
continue continue
else: else:
shutil.rmtree(dest) shutil.rmtree(dest)
git_sparse_checkout(asset["git"]["repo"], asset["git"]["path"], dest) git_sparse_checkout(
asset["git"]["repo"],
asset["git"]["path"],
dest,
branch=asset["git"].get("branch", "HEAD"),
)
else: else:
url = asset.get("url") url = asset.get("url")
if not url: if not url: