From de92d04dcce8616181623f04b4bce59e568ce73e Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Fri, 1 Aug 2025 15:23:54 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E9=9D=9Egit=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=9A=84=E5=88=9D=E5=A7=8B=E5=8C=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/builtin_plugins/auto_update/_data_source.py | 5 +++-- zhenxun/utils/repo_utils/base_manager.py | 2 +- zhenxun/utils/repo_utils/file_manager.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/zhenxun/builtin_plugins/auto_update/_data_source.py b/zhenxun/builtin_plugins/auto_update/_data_source.py index 86ea3e7e..df0770e9 100644 --- a/zhenxun/builtin_plugins/auto_update/_data_source.py +++ b/zhenxun/builtin_plugins/auto_update/_data_source.py @@ -1,4 +1,5 @@ import os +from pathlib import Path import shutil import tarfile import zipfile @@ -245,14 +246,14 @@ class UpdateManager: elif source == "git": result = await GithubRepoManager.update( GIT_GITHUB_URL, - BASE_PATH, + Path(), use_git=update_type == "git", force=force, ) else: result = await AliyunRepoManager.update( GIT_GITHUB_URL, - BASE_PATH, + Path(), force=force, ) if not result.success: diff --git a/zhenxun/utils/repo_utils/base_manager.py b/zhenxun/utils/repo_utils/base_manager.py index 00100399..c096f222 100644 --- a/zhenxun/utils/repo_utils/base_manager.py +++ b/zhenxun/utils/repo_utils/base_manager.py @@ -376,7 +376,7 @@ class BaseRepoManager(ABC): logger.info("拉取最新代码", LOG_COMMAND) pull_cmd = f"pull origin {branch}" if force: - pull_cmd = f"pull --force origin {branch}" + pull_cmd = f"fetch --all && git reset --hard origin/{branch}" logger.info("使用强制拉取模式", LOG_COMMAND) success, _, stderr = await run_git_command(pull_cmd, cwd=local_path) if not success: diff --git a/zhenxun/utils/repo_utils/file_manager.py b/zhenxun/utils/repo_utils/file_manager.py index 263c296d..67c82192 100644 --- a/zhenxun/utils/repo_utils/file_manager.py +++ b/zhenxun/utils/repo_utils/file_manager.py @@ -154,7 +154,7 @@ class RepoFileManager: ) results.append((f, content)) except Exception as e: - logger.error(f"获取阿里云文件内容失败: {file_path}", LOG_COMMAND, e=e) + logger.warning(f"获取阿里云文件内容失败: {file_path}", LOG_COMMAND, e=e) if not ignore_error: raise logger.debug(f"获取阿里云文件内容: {[r[0] for r in results]}", LOG_COMMAND)