mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-05-06 20:09:06 +08:00
Merge ccc3d8edee0c722106c65d7ee34408d68d25481f into 2174ce5afea90ca489d222f539988dcef59f1027
This commit is contained in:
commit
ee497f31fc
@ -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:
|
||||
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user