From 06def78f6bb215da56782b6843d10e38173a1e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AF=92=E5=AF=92?= <2596194220@qq.com> Date: Sun, 24 May 2026 22:40:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AE=80=E5=8C=96=E8=BF=9C=E7=A8=8B=20.?= =?UTF-8?q?version=20=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=20OneDev=20=E4=B8=8D=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84=20sparse=20filter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/update.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/update.ts b/lib/update.ts index 8d29b7d..9f05d2e 100644 --- a/lib/update.ts +++ b/lib/update.ts @@ -129,6 +129,7 @@ export function getRemoteVersionFile(): VersionFile | null { /** * 通过浅克隆获取远程 .version 文件(备选方案) + * OneDev 不支持 git archive --remote,改用完整浅克隆 */ function getRemoteVersionByClone(): VersionFile | null { const tmpDir = path.join( @@ -137,18 +138,11 @@ function getRemoteVersionByClone(): VersionFile | null { ); try { const url = getAuthenticatedRemoteUrl(); - execSync( - `git clone --depth 1 --filter=blob:none --sparse "${url}" "${tmpDir}" 2>nul`, - { - encoding: "utf-8", - timeout: 30000, - windowsHide: true, - } - ); - execSync(`cd "${tmpDir}" && git sparse-checkout set .version 2>nul`, { + execSync(`git clone --depth 1 "${url}" "${tmpDir}"`, { encoding: "utf-8", - timeout: 10000, + timeout: 60000, windowsHide: true, + stdio: ["ignore", "pipe", "pipe"], }); const versionPath = path.join(tmpDir, ".version"); if (fs.existsSync(versionPath)) {