Handle already-present directories for git assets

This commit is contained in:
Matthew Honnibal 2020-08-24 22:22:47 +02:00
parent 4dae195431
commit a06a7f1f05

View File

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