Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions modules/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def run_git(dir, name, command, desc=None, errdesc=None, custom_env=None, live:


def git_clone(url, dir, name, commithash=None):
# TODO clone into temporary dir and move if successful
# Clone into a temporary directory
temp_dir = dir + "_temp"

if os.path.exists(dir):
if commithash is None:
Expand All @@ -187,9 +188,10 @@ def git_clone(url, dir, name, commithash=None):
return

try:
run(f'"{git}" clone --config core.filemode=false "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}", live=True)
run(f'"{git}" clone --config core.filemode=false "{url}" "{temp_dir}"', f"Cloning {name} into {temp_dir}...", f"Couldn't clone {name}", live=True)
shutil.move(temp_dir, dir) # Move temp directory to final directory
except RuntimeError:
shutil.rmtree(dir, ignore_errors=True)
shutil.rmtree(temp_dir, ignore_errors=True)
raise

if commithash is not None:
Expand Down
Loading