mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
🐛 修复非git仓库的初始化更新
This commit is contained in:
parent
fd47ca3ce8
commit
de92d04dcc
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user