diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-10-06 09:08:06 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-10-06 09:08:58 +0000 |
commit | 6e7057b31b9762a9720282c7da486e4f264dee28 (patch) | |
tree | 9e9e155988bee890864a10a2977e5cdbf8362a13 /launch.py | |
parent | a93c3ffbfd264ed6b5d989922352300c9d3efbe4 (diff) | |
download | stable-diffusion-webui-gfx803-6e7057b31b9762a9720282c7da486e4f264dee28.tar.gz stable-diffusion-webui-gfx803-6e7057b31b9762a9720282c7da486e4f264dee28.tar.bz2 stable-diffusion-webui-gfx803-6e7057b31b9762a9720282c7da486e4f264dee28.zip |
support for downloading new commit hash for git repos
Diffstat (limited to 'launch.py')
-rw-r--r-- | launch.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -86,6 +86,15 @@ def git_clone(url, dir, name, commithash=None): # TODO clone into temporary dir and move if successful
if os.path.exists(dir):
+ if commithash is None:
+ return
+
+ current_hash = run(f'"{git}" -C {dir} rev-parse HEAD', None, "Couldn't determine {name}'s hash: {commithash}").strip()
+ if current_hash == commithash:
+ return
+
+ run(f'"{git}" -C {dir} fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}")
+ run(f'"{git}" -C {dir} checkout {commithash}', f"Checking out commint for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}")
return
run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}")
|