Support running as a git submodule. (#5227)

This commit is contained in:
Andrew C. Dvorak 2024-01-27 14:18:50 -06:00 committed by GitHub
parent 69622930c7
commit 5e87678fea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -257,7 +257,7 @@ def install_webui():
def update_requirements(initial_installation=False): def update_requirements(initial_installation=False):
# Create .git directory if missing # Create .git directory if missing
if not os.path.isdir(os.path.join(script_dir, ".git")): if not os.path.exists(os.path.join(script_dir, ".git")):
git_creation_cmd = 'git init -b main && git remote add origin https://github.com/oobabooga/text-generation-webui && git fetch && git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main && git reset --hard origin/main && git branch --set-upstream-to=origin/main' git_creation_cmd = 'git init -b main && git remote add origin https://github.com/oobabooga/text-generation-webui && git fetch && git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main && git reset --hard origin/main && git branch --set-upstream-to=origin/main'
run_cmd(git_creation_cmd, environment=True, assert_success=True) run_cmd(git_creation_cmd, environment=True, assert_success=True)
@ -268,7 +268,7 @@ def update_requirements(initial_installation=False):
] ]
before_pull_hashes = {file_name: calculate_file_hash(file_name) for file_name in files_to_check} before_pull_hashes = {file_name: calculate_file_hash(file_name) for file_name in files_to_check}
run_cmd("git pull --autostash", assert_success=True, environment=True) run_cmd("git pull --autostash origin main", assert_success=True, environment=True)
after_pull_hashes = {file_name: calculate_file_hash(file_name) for file_name in files_to_check} after_pull_hashes = {file_name: calculate_file_hash(file_name) for file_name in files_to_check}
# Check for differences in installation file hashes # Check for differences in installation file hashes