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)) {