UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

4 lines • 1.05 kB
import{n as ignoreMissingPath}from"./errno-DUBt6SQQ.mjs";import{a as hasCommandProcessCleanupError,u as readCommandProcessFailure}from"./exec-result-TD4w1Z1i.mjs";import path from"node:path";import fs from"node:fs/promises";import os from"node:os"; //!src/infra/git-object-store-transport.ts async function withGitObjectStoreTransport(e,t,n){const[r,i]=await Promise.all([t(e,[`rev-parse`,`--path-format=absolute`,`--git-path`,`objects`]),t(e,[`rev-parse`,`--show-object-format`,`--path-format=absolute`,`--git-path`,`shallow`])]);const a=i.indexOf(` `);const o=i.slice(0,a);const s=i.slice(a+1);const c=await fs.mkdtemp(path.join(os.tmpdir(),`openclaw-project-fetch-`));let l=false;try{await t(c,[`init`,`--bare`,`--template=`,`--object-format=${o}`]);await fs.copyFile(s,path.join(c,`shallow`)).catch(ignoreMissingPath);return await n(c,r)}catch(e){l=hasCommandProcessCleanupError(e)||readCommandProcessFailure(e)?.cleanup===`uncertain`;throw e}finally{if(!l)await fs.rm(c,{recursive:true,force:true})}}export{withGitObjectStoreTransport as t};