diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-10 14:28:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-10 14:28:29 +0000 |
commit | 9af5cce4c7c6681bd8dd639e5647cc8d0f71cf2c (patch) | |
tree | 79ad9c450eea5bd44fdd2640d02a6ede8653f78f /modules | |
parent | e0906096c57c25c7ecaa583f20af84b1699b8736 (diff) | |
parent | 5a705c246880c26ec4fc940dae0da5ecdd2bff50 (diff) | |
download | stable-diffusion-webui-gfx803-9af5cce4c7c6681bd8dd639e5647cc8d0f71cf2c.tar.gz stable-diffusion-webui-gfx803-9af5cce4c7c6681bd8dd639e5647cc8d0f71cf2c.tar.bz2 stable-diffusion-webui-gfx803-9af5cce4c7c6681bd8dd639e5647cc8d0f71cf2c.zip |
Merge pull request #12454 from wfjsw/no-autofix-on-fetch
rm dir on failed clone, disable autofix for fetch
Diffstat (limited to 'modules')
-rw-r--r-- | modules/launch_utils.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/launch_utils.py b/modules/launch_utils.py index bc5f38cc..2782872e 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -3,6 +3,7 @@ import logging import re
import subprocess
import os
+import shutil
import sys
import importlib.util
import platform
@@ -152,10 +153,8 @@ def run_git(dir, name, command, desc=None, errdesc=None, custom_env=None, live: try:
return run(f'"{git}" -C "{dir}" {command}', desc=desc, errdesc=errdesc, custom_env=custom_env, live=live)
except RuntimeError:
- pass
-
- if not autofix:
- return None
+ if not autofix:
+ raise
print(f"{errdesc}, attempting autofix...")
git_fix_workspace(dir, name)
@@ -174,13 +173,17 @@ def git_clone(url, dir, name, commithash=None): if current_hash == commithash:
return
- run_git('fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}")
+ run_git('fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}", autofix=False)
run_git('checkout', f"Checking out commit for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}", live=True)
return
- run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}", live=True)
+ try:
+ run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}", live=True)
+ except RuntimeError:
+ shutil.rmtree(dir, ignore_errors=True)
+ raise
if commithash is not None:
run(f'"{git}" -C "{dir}" checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")
|