fixed: switch_to_default_branch - robust patch

https://github.com/ltdrdata/ComfyUI-Manager/issues/1392#issuecomment-2569675066
This commit is contained in:
Dr.Lt.Data 2025-01-04 09:48:56 +09:00
parent 4dee009d51
commit faf1209eba
3 changed files with 24 additions and 6 deletions

View File

@ -127,8 +127,17 @@ def gitcheck(path, do_fetch=False):
def switch_to_default_branch(repo):
default_branch = repo.git.symbolic_ref('refs/remotes/origin/HEAD').replace('refs/remotes/origin/', '')
repo.git.checkout(default_branch)
try:
default_branch = repo.git.symbolic_ref('refs/remotes/origin/HEAD').replace('refs/remotes/origin/', '')
repo.git.checkout(default_branch)
except:
try:
repo.git.checkout(repo.heads.master)
except:
try:
repo.git.checkout(repo.heads.main)
except:
print("[ComfyUI Manager] Failed to switch to the default branch (master or main)")
def gitpull(path):

View File

@ -36,7 +36,7 @@ import manager_downloader
from node_package import InstalledNodePackage
version_code = [3, 3, 8]
version_code = [3, 3, 9]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
@ -1510,8 +1510,17 @@ def get_config():
def switch_to_default_branch(repo):
default_branch = repo.git.symbolic_ref('refs/remotes/origin/HEAD').replace('refs/remotes/origin/', '')
repo.git.checkout(default_branch)
try:
default_branch = repo.git.symbolic_ref('refs/remotes/origin/HEAD').replace('refs/remotes/origin/', '')
repo.git.checkout(default_branch)
except:
try:
repo.git.checkout(repo.heads.master)
except:
try:
repo.git.checkout(repo.heads.main)
except:
print("[ComfyUI Manager] Failed to switch to the default branch (master or main)")
def try_install_script(url, repo_path, install_cmd, instant_execution=False):

View File

@ -1,7 +1,7 @@
[project]
name = "comfyui-manager"
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
version = "3.3.8"
version = "3.3.9"
license = { file = "LICENSE.txt" }
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]