This commit is contained in:
孙小云 2026-02-05 16:57:46 +08:00
parent d305ee72b8
commit 54fded65d0
1 changed files with 9 additions and 7 deletions

View File

@ -321,13 +321,7 @@ class GitMonitor:
if result.returncode != 0:
Logger.warning(f"清理子模块失败,继续执行: {result.stderr}")
# 拉取所有子模块的最新代码
Logger.info("拉取子模块最新代码...")
cmd = "git submodule foreach 'git fetch origin && git checkout {branch} && git pull origin {branch}'".format(branch=self.global_branch)
result = subprocess.run(cmd, shell=True, cwd=repo_path, capture_output=True, text=True)
if result.returncode != 0:
Logger.warning(f"拉取子模块失败,继续执行: {result.stderr}")
# 初始化和更新所有子模块到主仓库记录的版本
Logger.info("更新子模块到主仓库记录的版本...")
cmd = "git submodule update --init --recursive --force"
@ -336,6 +330,14 @@ class GitMonitor:
Logger.error(f"更新子模块失败: {result.stderr}")
return False
# 拉取所有子模块的最新代码
Logger.info("拉取子模块最新代码...")
cmd = "git submodule foreach 'git checkout {branch} && git pull'".format(branch=self.global_branch)
result = subprocess.run(cmd, shell=True, cwd=repo_path, capture_output=True, text=True)
if result.returncode != 0:
Logger.warning(f"拉取子模块失败,继续执行: {result.stderr}")
Logger.info("主仓库和子模块更新成功")
return True