修改脚本

This commit is contained in:
孙小云 2026-01-24 11:34:59 +08:00
parent ed58b65d76
commit 25075805f2
1 changed files with 8 additions and 1 deletions

View File

@ -160,7 +160,14 @@ class GitMonitor:
Logger.error("拉取主仓库失败") Logger.error("拉取主仓库失败")
return False return False
# 更新所有子模块 # 初始化和更新所有子模块(包括新增的子模块)
cmd = "git submodule update --init --recursive"
result = subprocess.run(cmd, shell=True, cwd=repo_path, capture_output=True, text=True)
if result.returncode != 0:
Logger.error("初始化子模块失败")
return False
# 更新所有子模块到最新代码
cmd = f"git submodule foreach 'git checkout {self.global_branch} && git pull'" cmd = f"git submodule foreach 'git checkout {self.global_branch} && git pull'"
result = subprocess.run(cmd, shell=True, cwd=repo_path, capture_output=True, text=True) result = subprocess.run(cmd, shell=True, cwd=repo_path, capture_output=True, text=True)
if result.returncode != 0: if result.returncode != 0: