Merge pull request #280 from mortael/patch-1

Fix for adding ComfyUI path to Git safe.directory
This commit is contained in:
Dr.Lt.Data 2024-01-01 09:57:09 +09:00 committed by GitHub
commit 9557a24409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -317,8 +317,9 @@ def __win_check_git_update(path, do_fetch=False, do_update=False):
if 'detected dubious' in output: if 'detected dubious' in output:
try: try:
# fix and try again # fix and try again
print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on '{path}' repo") safedir_path = path.replace('\\', '/')
process = subprocess.Popen(['git', 'config', '--global', '--add', 'safe.directory', path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on '{safedir_path}' repo")
process = subprocess.Popen(['git', 'config', '--global', '--add', 'safe.directory', safedir_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, _ = process.communicate() output, _ = process.communicate()
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@ -330,7 +331,7 @@ def __win_check_git_update(path, do_fetch=False, do_update=False):
if 'detected dubious' in output: if 'detected dubious' in output:
print(f'\n[ComfyUI-Manager] Failed to fixing repository setup. Please execute this command on cmd: \n' print(f'\n[ComfyUI-Manager] Failed to fixing repository setup. Please execute this command on cmd: \n'
f'-----------------------------------------------------------------------------------------\n' f'-----------------------------------------------------------------------------------------\n'
f'git config --global --add safe.directory "{path}"\n' f'git config --global --add safe.directory "{safedir_path}"\n'
f'-----------------------------------------------------------------------------------------\n') f'-----------------------------------------------------------------------------------------\n')
if do_update: if do_update:
@ -1517,15 +1518,16 @@ async def update_comfyui(request):
try: try:
remote.fetch() remote.fetch()
except Exception as e: except Exception as e:
if 'detected dubious' in e: if 'detected dubious' in str(e):
print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on 'ComfyUI' repository") print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on 'ComfyUI' repository")
subprocess.run(['git', 'config', '--global', '--add', 'safe.directory', comfy_path]) safedir_path = comfy_path.replace('\\', '/')
subprocess.run(['git', 'config', '--global', '--add', 'safe.directory', safedir_path])
try: try:
remote.fetch() remote.fetch()
except Exception: except Exception:
print(f"\n[ComfyUI-Manager] Failed to fixing repository setup. Please execute this command on cmd: \n" print(f"\n[ComfyUI-Manager] Failed to fixing repository setup. Please execute this command on cmd: \n"
f"-----------------------------------------------------------------------------------------\n" f"-----------------------------------------------------------------------------------------\n"
f'git config --global --add safe.directory "{comfy_path}"\n' f'git config --global --add safe.directory "{safedir_path}"\n'
f"-----------------------------------------------------------------------------------------\n") f"-----------------------------------------------------------------------------------------\n")
commit_hash = repo.head.commit.hexsha commit_hash = repo.head.commit.hexsha