@scolladon/tsgit 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +12 -0
  2. package/dist/cjs/adapters/browser/index.cjs +1 -2
  3. package/dist/cjs/adapters/memory/index.cjs +1 -2
  4. package/dist/cjs/adapters/node/index.cjs +1 -2
  5. package/dist/cjs/chunks/{adapter-detect-D7DFJtuk.cjs → adapter-detect-DW9fsw9d.cjs} +1 -2
  6. package/dist/cjs/chunks/browser-http-transport-DGwW5YL7.cjs +1 -0
  7. package/dist/cjs/chunks/context-BcoAzPuU.cjs +0 -1
  8. package/dist/cjs/chunks/error-CfLWDui_.cjs +1 -0
  9. package/dist/cjs/chunks/index-Cy44GVR6.cjs +1 -0
  10. package/dist/cjs/chunks/inflate-CmCtM4-w.cjs +1 -0
  11. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs +0 -1
  12. package/dist/cjs/chunks/memory-http-transport-CGriODcQ.cjs +1 -0
  13. package/dist/cjs/chunks/node-ssh-transport-PFu3ijfp.cjs +1 -0
  14. package/dist/cjs/chunks/{progress-CjhUeyxd.cjs → progress-D8Dqbftk.cjs} +1 -2
  15. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs +0 -1
  16. package/dist/cjs/chunks/{repository-DJNNrfQr.cjs → repository-Ci-BBxk0.cjs} +1 -2
  17. package/dist/cjs/chunks/write-sparse-checkout-C1dsHCAD.cjs +1 -0
  18. package/dist/cjs/commands/index.cjs +1 -2
  19. package/dist/cjs/index.browser.cjs +1 -2
  20. package/dist/cjs/index.cjs +1 -2
  21. package/dist/cjs/index.default.cjs +1 -2
  22. package/dist/cjs/index.node.cjs +1 -2
  23. package/dist/cjs/operators/index.cjs +0 -1
  24. package/dist/cjs/primitives/index.cjs +1 -2
  25. package/dist/cjs/transport/index.cjs +0 -1
  26. package/dist/esm/adapters/browser/index.js +1 -2
  27. package/dist/esm/adapters/memory/index.js +1 -2
  28. package/dist/esm/adapters/node/index.js +1 -2
  29. package/dist/esm/chunks/{adapter-detect-CTTG6hpk.js → adapter-detect-BkCMnjrI.js} +1 -2
  30. package/dist/esm/chunks/browser-http-transport-CSxAte5h.js +1 -0
  31. package/dist/esm/chunks/context-CumKOV7K.js +0 -1
  32. package/dist/esm/chunks/error-BotOd-nD.js +1 -0
  33. package/dist/esm/chunks/index-DsvINN8n.js +1 -0
  34. package/dist/esm/chunks/inflate-BCIXqeeE.js +1 -0
  35. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js +0 -1
  36. package/dist/esm/chunks/memory-http-transport-caqmMGR1.js +1 -0
  37. package/dist/esm/chunks/node-ssh-transport-BgSv2IhT.js +1 -0
  38. package/dist/esm/chunks/{progress-CLPpgZJ6.js → progress-B_AJnOHx.js} +1 -2
  39. package/dist/esm/chunks/readable-stream-CGuf8k1J.js +0 -1
  40. package/dist/esm/chunks/repository-DyxknzvE.js +1 -0
  41. package/dist/esm/chunks/write-sparse-checkout-BwHbNKNS.js +1 -0
  42. package/dist/esm/commands/index.js +1 -2
  43. package/dist/esm/index.browser.js +1 -2
  44. package/dist/esm/index.default.js +1 -2
  45. package/dist/esm/index.js +1 -2
  46. package/dist/esm/index.node.js +1 -2
  47. package/dist/esm/operators/index.js +0 -1
  48. package/dist/esm/primitives/index.js +1 -2
  49. package/dist/esm/transport/index.js +0 -1
  50. package/dist/types/adapters/browser/index.d.cts +1 -1
  51. package/dist/types/adapters/browser/index.d.ts +1 -1
  52. package/dist/types/adapters/memory/index.d.cts +1 -1
  53. package/dist/types/adapters/memory/index.d.ts +1 -1
  54. package/dist/types/adapters/node/index.d.cts +94 -36
  55. package/dist/types/adapters/node/index.d.ts +94 -36
  56. package/dist/types/chunks/{context-D_A7-uau.d.cts → context-CF1YF2S8.d.cts} +48 -2
  57. package/dist/types/chunks/{context-CNtbFlwI.d.ts → context-sIhhtk2u.d.ts} +48 -2
  58. package/dist/types/chunks/{index-E_KapqW9.d.ts → index-B5Dps3fg.d.ts} +32 -3
  59. package/dist/types/chunks/{index-BJDekgCP.d.ts → index-B_A8VLaf.d.ts} +111 -12
  60. package/dist/types/chunks/{index-wwZiot4c.d.cts → index-Dfh8cvEs.d.cts} +32 -3
  61. package/dist/types/chunks/{index-CMLLVz9B.d.cts → index-Dqxddhav.d.cts} +111 -12
  62. package/dist/types/chunks/{progress-hcn9r2H3.d.ts → progress-BjAKfkam.d.ts} +51 -5
  63. package/dist/types/chunks/{progress-Cp-huK45.d.cts → progress-Ldnfb8st.d.cts} +51 -5
  64. package/dist/types/chunks/{reflog-entry-BGJr9VfU.d.cts → reflog-entry-Cqh3QrPH.d.ts} +12 -3
  65. package/dist/types/chunks/{reflog-entry-DecZqJna.d.ts → reflog-entry-Dy-O27Dd.d.cts} +12 -3
  66. package/dist/types/chunks/{repository-Dxhwpzd6.d.ts → repository-D8QBTkEz.d.ts} +5 -5
  67. package/dist/types/chunks/{repository-DASBgOb9.d.cts → repository-D9YrVhcH.d.cts} +5 -5
  68. package/dist/types/commands/index.d.cts +3 -3
  69. package/dist/types/commands/index.d.ts +3 -3
  70. package/dist/types/index.browser.d.cts +6 -6
  71. package/dist/types/index.browser.d.ts +6 -6
  72. package/dist/types/index.d.cts +8 -8
  73. package/dist/types/index.d.ts +8 -8
  74. package/dist/types/index.default.d.cts +6 -6
  75. package/dist/types/index.default.d.ts +6 -6
  76. package/dist/types/index.node.d.cts +6 -6
  77. package/dist/types/index.node.d.ts +6 -6
  78. package/dist/types/primitives/index.d.cts +3 -3
  79. package/dist/types/primitives/index.d.ts +3 -3
  80. package/package.json +90 -24
  81. package/dist/cjs/adapters/browser/index.cjs.map +0 -1
  82. package/dist/cjs/adapters/memory/index.cjs.map +0 -1
  83. package/dist/cjs/adapters/node/index.cjs.map +0 -1
  84. package/dist/cjs/chunks/adapter-detect-D7DFJtuk.cjs.map +0 -1
  85. package/dist/cjs/chunks/adler32-CrRRuL2P.cjs +0 -2
  86. package/dist/cjs/chunks/adler32-CrRRuL2P.cjs.map +0 -1
  87. package/dist/cjs/chunks/browser-http-transport-nGm6alox.cjs +0 -2
  88. package/dist/cjs/chunks/browser-http-transport-nGm6alox.cjs.map +0 -1
  89. package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +0 -1
  90. package/dist/cjs/chunks/error-CA80UqXF.cjs +0 -2
  91. package/dist/cjs/chunks/error-CA80UqXF.cjs.map +0 -1
  92. package/dist/cjs/chunks/index-01WCH0eg.cjs +0 -2
  93. package/dist/cjs/chunks/index-01WCH0eg.cjs.map +0 -1
  94. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs.map +0 -1
  95. package/dist/cjs/chunks/memory-http-transport-7hpDW8o3.cjs +0 -2
  96. package/dist/cjs/chunks/memory-http-transport-7hpDW8o3.cjs.map +0 -1
  97. package/dist/cjs/chunks/node-http-transport-CoqnAvIL.cjs +0 -2
  98. package/dist/cjs/chunks/node-http-transport-CoqnAvIL.cjs.map +0 -1
  99. package/dist/cjs/chunks/progress-CjhUeyxd.cjs.map +0 -1
  100. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs.map +0 -1
  101. package/dist/cjs/chunks/repository-DJNNrfQr.cjs.map +0 -1
  102. package/dist/cjs/chunks/write-sparse-checkout-DzVubBcI.cjs +0 -2
  103. package/dist/cjs/chunks/write-sparse-checkout-DzVubBcI.cjs.map +0 -1
  104. package/dist/cjs/commands/index.cjs.map +0 -1
  105. package/dist/cjs/index.browser.cjs.map +0 -1
  106. package/dist/cjs/index.cjs.map +0 -1
  107. package/dist/cjs/index.default.cjs.map +0 -1
  108. package/dist/cjs/index.node.cjs.map +0 -1
  109. package/dist/cjs/operators/index.cjs.map +0 -1
  110. package/dist/cjs/primitives/index.cjs.map +0 -1
  111. package/dist/cjs/transport/index.cjs.map +0 -1
  112. package/dist/esm/adapters/browser/index.js.map +0 -1
  113. package/dist/esm/adapters/memory/index.js.map +0 -1
  114. package/dist/esm/adapters/node/index.js.map +0 -1
  115. package/dist/esm/chunks/adapter-detect-CTTG6hpk.js.map +0 -1
  116. package/dist/esm/chunks/adler32-BfvKJOAO.js +0 -2
  117. package/dist/esm/chunks/adler32-BfvKJOAO.js.map +0 -1
  118. package/dist/esm/chunks/browser-http-transport-DD0YKmIW.js +0 -2
  119. package/dist/esm/chunks/browser-http-transport-DD0YKmIW.js.map +0 -1
  120. package/dist/esm/chunks/context-CumKOV7K.js.map +0 -1
  121. package/dist/esm/chunks/error-BD0nFV6t.js +0 -2
  122. package/dist/esm/chunks/error-BD0nFV6t.js.map +0 -1
  123. package/dist/esm/chunks/index-BEI7XKaV.js +0 -2
  124. package/dist/esm/chunks/index-BEI7XKaV.js.map +0 -1
  125. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js.map +0 -1
  126. package/dist/esm/chunks/memory-http-transport-D13LBPvu.js +0 -2
  127. package/dist/esm/chunks/memory-http-transport-D13LBPvu.js.map +0 -1
  128. package/dist/esm/chunks/node-http-transport-doU9Y8WN.js +0 -2
  129. package/dist/esm/chunks/node-http-transport-doU9Y8WN.js.map +0 -1
  130. package/dist/esm/chunks/progress-CLPpgZJ6.js.map +0 -1
  131. package/dist/esm/chunks/readable-stream-CGuf8k1J.js.map +0 -1
  132. package/dist/esm/chunks/repository-dCH3DdLQ.js +0 -2
  133. package/dist/esm/chunks/repository-dCH3DdLQ.js.map +0 -1
  134. package/dist/esm/chunks/write-sparse-checkout-D4tNUXOp.js +0 -2
  135. package/dist/esm/chunks/write-sparse-checkout-D4tNUXOp.js.map +0 -1
  136. package/dist/esm/commands/index.js.map +0 -1
  137. package/dist/esm/index.browser.js.map +0 -1
  138. package/dist/esm/index.default.js.map +0 -1
  139. package/dist/esm/index.js.map +0 -1
  140. package/dist/esm/index.node.js.map +0 -1
  141. package/dist/esm/operators/index.js.map +0 -1
  142. package/dist/esm/primitives/index.js.map +0 -1
  143. package/dist/esm/transport/index.js.map +0 -1
package/dist/esm/index.js CHANGED
@@ -1,2 +1 @@
1
- export{d as detectRuntime,i as isBrowser,a as isNode,n as noopLogger,w as wrapLoggerSanitizer}from"./chunks/adapter-detect-CTTG6hpk.js";import{o as ee,g as te,i as ne}from"./chunks/error-BD0nFV6t.js";export{c as createContext}from"./chunks/context-CumKOV7K.js";export{c as consoleProgress,n as noopProgress}from"./chunks/progress-CLPpgZJ6.js";import{a as re,c as se}from"./chunks/write-sparse-checkout-D4tNUXOp.js";export{F as FilePath,O as ObjectId,R as RefName}from"./chunks/write-sparse-checkout-D4tNUXOp.js";export{a as add,b as archive,c as bindBranchNamespace,d as bindBundleNamespace,e as bindCherryPickNamespace,f as bindConfigNamespace,g as bindMergeNamespace,h as bindNotesNamespace,i as bindRebaseNamespace,j as bindRemoteNamespace,k as bindRevertNamespace,l as bindSparseCheckoutNamespace,m as bindStashNamespace,n as bindSubmoduleNamespace,o as bindTagNamespace,p as bindWorktreeNamespace,q as blame,r as branchCreate,s as branchDelete,t as branchList,u as branchRename,v as bundleCreate,w as bundleListHeads,x as bundleVerify,y as catFile,z as checkout,A as cherryPickAbort,B as cherryPickContinue,C as cherryPickRun,D as cherryPickSkip,E as clone,F as commit,G as configGet,H as configGetAll,I as configGetRegexp,J as configList,K as configRemoveSection,L as configRenameSection,M as configSet,N as configUnset,O as configUnsetAll,P as createPromisorRemote,Q as describe,R as diff,S as fetch,T as fetchMissing,U as fsck,V as grep,W as init,X as log,Y as mergeAbort,Z as mergeContinue,_ as mergeRun,$ as mv,a0 as nameRev,a1 as notesAdd,a2 as notesList,a3 as notesRead,a4 as notesRemove,a5 as pull,a6 as push,a7 as rangeDiff,a8 as readFileAt,a9 as rebaseAbort,aa as rebaseContinue,ab as rebaseRun,ac as rebaseSkip,ad as reflog,ae as remoteAdd,af as remoteList,ag as remoteRemove,ah as remoteRename,ai as remoteSetUrl,aj as remoteShow,ak as reset,al as revParse,am as revertAbort,an as revertContinue,ao as revertRun,ap as revertSkip,aq as rm,ar as shortlog,as as show,at as sparseCheckoutAdd,au as sparseCheckoutDisable,av as sparseCheckoutList,aw as sparseCheckoutReapply,ax as sparseCheckoutSet,ay as stashApply,az as stashDrop,aA as stashList,aB as stashPop,aC as stashPush,aD as status,aE as submoduleAdd,aF as submoduleDeinit,aG as submoduleInit,aH as submoduleList,aI as submoduleSync,aJ as submoduleUpdate,aK as tagCreate,aL as tagDelete,aM as tagList,aN as whatchanged,aO as worktreeAdd,aP as worktreeList,aQ as worktreeMove,aR as worktreeRemove}from"./chunks/index-BEI7XKaV.js";import"./chunks/readable-stream-CGuf8k1J.js";import"./transport/index.js";const oe=new TextEncoder,ie=512,ce=new Uint8Array([117,115,116,97,114,0]),le=new Uint8Array([48,48]),ue=e=>8**(e-1)-1;function de(e,t,n,a){if(a>ue(n))throw new Error(`Value ${a} exceeds the ${n-1}-digit octal field capacity (max ${ue(n)})`);const r=a.toString(8).padStart(n-1,"0");for(let a=0;a<n-1;a++)e[t+a]=r.charCodeAt(a);e[t+n-1]=0}function fe(e,t,n,a){const r=Math.min(a.length,n);for(let n=0;n<r;n++)e[t+n]=a.charCodeAt(n)}function he(e,t,n,a){e.set(a.subarray(0,Math.min(a.length,n)),t)}function me(e){const t=new Uint8Array(512);return function(e,t){he(e,0,100,t.nameBytes),de(e,100,8,t.mode),de(e,108,8,0),de(e,116,8,0),de(e,124,12,t.size),de(e,136,12,t.mtime),e[156]=t.typeflag,he(e,157,100,t.linknameBytes)}(t,e),function(e,t){e.set(ce,257),e.set(le,263),fe(e,265,32,t.uname),fe(e,297,32,t.gname),de(e,329,8,0),de(e,337,8,0),he(e,345,155,t.prefixBytes)}(t,e),function(e){const t=function(e){let t=0;for(const[n,a]of e.entries())t+=n>=148&&n<156?32:a;return t}(e).toString(8).padStart(7,"0");for(let n=0;n<7;n++)e[148+n]=t.charCodeAt(n);e[155]=0}(t),t}function ye(e){const t=oe.encode(e),n=t.length;if(n<=100)return{nameBytes:t,prefixBytes:new Uint8Array(0)};if(n>256)throw new Error(`Path too long for ustar archive (>256 bytes): ${e}`);for(let e=Math.min(n-1,155);e>0;e--){const a=n-e-1;if(47===t[e]&&a>=1&&a<=100)return{nameBytes:t.subarray(e+1),prefixBytes:t.subarray(0,e)}}throw new Error(`Cannot split path into ustar prefix+name: ${e}`)}function pe(e,t){switch(e){case re.REGULAR:return 438&~t;case re.EXECUTABLE:case re.DIRECTORY:case re.GITLINK:return 511&~t;case re.SYMLINK:return 511}}function ge(e){switch(e){case re.REGULAR:case re.EXECUTABLE:return 48;case re.SYMLINK:return 50;case re.DIRECTORY:case re.GITLINK:return 53}}function we(e){return e===re.REGULAR||e===re.EXECUTABLE}function Ae(e){const t=e%ie;return 0===t?0:ie-t}function be(e,t,n,a,r,s){const{nameBytes:o,prefixBytes:i}=ye(t),c=e.mode===re.SYMLINK&&void 0!==e.content?e.content:new Uint8Array(0);if(c.length>100)throw new Error(`Symlink target too long for ustar archive (>100 bytes): ${t}`);const l=we(e.mode)&&void 0!==e.content?e.content.length:0;return me({nameBytes:o,mode:pe(e.mode,a),size:l,mtime:n,typeflag:ge(e.mode),linknameBytes:c,uname:r,gname:s,prefixBytes:i})}function ve(e,t,n){const a=function(e){return e===re.DIRECTORY||e===re.GITLINK}(n)?"/":"";return t+e+a}async function*ke(e,t){const n=t?.prefix??"",a=t?.mtime??e.commitTime??0,r=t?.umask??2,s=t?.uname??"root",o=t?.gname??"root";let i=0;void 0!==e.commit&&(yield function(e,t,n){const{nameBytes:a,prefixBytes:r}=ye("pax_global_header");return me({nameBytes:a,mode:438,size:52,mtime:e,typeflag:103,linknameBytes:new Uint8Array(0),uname:t,gname:n,prefixBytes:r})}(a,s,o),i+=ie,yield function(e){const t=new Uint8Array(ie),n=`52 comment=${e}\n`;for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return t}(e.commit),i+=ie),""!==n&&(yield function(e,t,n,a,r){const{nameBytes:s,prefixBytes:o}=ye(e);return me({nameBytes:s,mode:511&~n,size:0,mtime:t,typeflag:53,linknameBytes:new Uint8Array(0),uname:a,gname:r,prefixBytes:o})}(n,a,r,s,o),i+=ie);for await(const t of e.entries){const e=ve(t.path,n,t.mode);if(yield be(t,e,a,r,s,o),i+=ie,we(t.mode)&&void 0!==t.content&&t.content.length>0){yield t.content,i+=t.content.length;const e=Ae(t.content.length);e>0&&(yield new Uint8Array(e),i+=e)}}yield new Uint8Array(1024),i+=1024;const c=i%10240;0!==c&&(yield new Uint8Array(10240-c))}const xe=new Uint8Array([80,75,3,4]),Re=new Uint8Array([80,75,1,2]),Be=new Uint8Array([80,75,5,6]);function Ce(e,t,n){e[t]=255&n,e[t+1]=n>>>8&255}function Ee(e,t,n){e[t]=255&n,e[t+1]=n>>>8&255,e[t+2]=n>>>16&255,e[t+3]=n>>>24&255}const Ue=new TextEncoder;function Te(e){return Ue.encode(e)}function Le(e,t,n,a,r,s,o,i,c,l,u){const d=e.length,f=u.length,h=new Uint8Array(46+d+f);let m=0;return h.set(Re,m),m+=4,Ce(h,m,c),m+=2,Ce(h,m,10),m+=2,Ce(h,m,0),m+=2,Ce(h,m,t),m+=2,Ce(h,m,n.time),m+=2,Ce(h,m,n.date),m+=2,Ee(h,m,a),m+=4,Ee(h,m,r),m+=4,Ee(h,m,s),m+=4,Ce(h,m,d),m+=2,Ce(h,m,f),m+=2,Ce(h,m,0),m+=2,Ce(h,m,0),m+=2,Ce(h,m,o),m+=2,Ee(h,m,i),m+=4,Ee(h,m,l),m+=4,h.set(e,m),m+=d,h.set(u,m),h}function Se(e){for(let t=0;t<e.length;t++)if(0===e[t])return!1;return!0}const Ie={versionMadeBy:791,internalAttr:1,externalAttr:2717843456},Ne={versionMadeBy:0,internalAttr:0,externalAttr:16};function ze(e){switch(e.mode){case re.REGULAR:return{versionMadeBy:0,internalAttr:void 0!==(t=e.content)&&Se(t)?1:0,externalAttr:0};case re.EXECUTABLE:return function(e){return{versionMadeBy:791,internalAttr:void 0!==e&&Se(e)?1:0,externalAttr:2179792896}}(e.content);case re.SYMLINK:return Ie;case re.DIRECTORY:case re.GITLINK:return Ne}var t}async function Me(e,t,n){if(Oe(e.mode))return{method:0,compressed:new Uint8Array(0),contentCrc:0,usize:0};const a=e.content??new Uint8Array(0),r=se(a),s=a.length;if((o=e.mode)!==re.REGULAR&&o!==re.EXECUTABLE)return{method:0,compressed:a,contentCrc:r,usize:s};var o;const i=await t.deflateRaw(a,n);return i.length<a.length?{method:8,compressed:i,contentCrc:r,usize:s}:{method:0,compressed:a,contentCrc:r,usize:s}}function Oe(e){return e===re.DIRECTORY||e===re.GITLINK}function Pe(e,t,n){return`${t}${e}${Oe(n)?"/":""}`}function De(e){const{nameBytes:t,method:n,dosTime:a,crc:r,csize:s,usize:o,utExtra:i}=e,c=function(e,t,n,a,r,s,o){const i=e.length,c=o.length,l=new Uint8Array(30+i+c);let u=0;return l.set(xe,u),u+=4,Ce(l,u,10),u+=2,Ce(l,u,0),u+=2,Ce(l,u,t),u+=2,Ce(l,u,n.time),u+=2,Ce(l,u,n.date),u+=2,Ee(l,u,a),u+=4,Ee(l,u,r),u+=4,Ee(l,u,s),u+=4,Ce(l,u,i),u+=2,Ce(l,u,c),u+=2,l.set(e,u),u+=i,l.set(o,u),l}(t,n,a,r,s,o,i);return{localHeader:c,record:{name:t,method:n,dosTime:a,crc:r,csize:s,usize:o,internalAttr:e.internalAttr,externalAttr:e.externalAttr,versionMadeBy:e.versionMadeBy,localOffset:e.localOffset,utExtra:i}}}async function*Ge(e,t,n){const a=n?.prefix??"",r=n?.mtime??e.commitTime??0,s=n?.tzOffsetMinutes??0,o=n?.level,i=function(e,t){const n=new Date(1e3*(e+60*t));return{time:n.getUTCHours()<<11|n.getUTCMinutes()<<5|Math.floor(n.getUTCSeconds()/2),date:n.getUTCFullYear()-1980<<9|n.getUTCMonth()+1<<5|n.getUTCDate()}}(r,s),c=function(e){const t=new Uint8Array(9);return Ce(t,0,21589),Ce(t,2,5),t[4]=1,Ee(t,5,e),t}(r),l=[];let u=0;if(""!==a){const e=Te(a),{localHeader:t,record:n}=De({nameBytes:e,method:0,dosTime:i,crc:0,csize:0,usize:0,internalAttr:0,externalAttr:16,versionMadeBy:0,localOffset:u,utExtra:c});yield t,l.push(n),u+=t.length}for await(const n of e.entries){const e=Te(Pe(n.path,a,n.mode)),r=ze(n),{method:s,compressed:d,contentCrc:f,usize:h}=await Me(n,t,o),m=d.length,{localHeader:y,record:p}=De({nameBytes:e,method:s,dosTime:i,crc:f,csize:m,usize:h,internalAttr:r.internalAttr,externalAttr:r.externalAttr,versionMadeBy:r.versionMadeBy,localOffset:u,utExtra:c});yield y,l.push(p),u+=y.length,m>0&&(yield d,u+=m)}const d=u;let f=0;for(const e of l){const t=Le(e.name,e.method,e.dosTime,e.crc,e.csize,e.usize,e.internalAttr,e.externalAttr,e.versionMadeBy,e.localOffset,e.utExtra);yield t,f+=t.length}const h=e.commit??"";yield function(e,t,n,a){const r=Ue.encode(a),s=new Uint8Array(22+r.length);let o=0;return s.set(Be,o),o+=4,Ce(s,o,0),o+=2,Ce(s,o,0),o+=2,Ce(s,o,e),o+=2,Ce(s,o,e),o+=2,Ee(s,o,t),o+=4,Ee(s,o,n),o+=4,Ce(s,o,r.length),o+=2,s.set(r,o),s}(l.length,f,d,h)}const je=new Set,$e=(e,t)=>{if((()=>{const e=globalThis.process;return"1"===e?.env?.TSGIT_SUPPRESS_DEPRECATIONS})())return;if(je.has(e))return;je.add(e);const n=globalThis.console;n?.warn(`[tsgit deprecation] ${e}: ${t}`)},Ke=async(e,t)=>{if(e.current=await e.iter.next(),!e.current.done&&null!==t){const n=e.current.value;if(n.path<t)throw te(t,n.path)}},Ye=e=>{let t=null;for(const n of e){if(n.current.done)continue;const e=n.current.value.path;(null===t||e<t)&&(t=e)}return t},Fe=async(e,t)=>{const n={};let a=0;for(const r of e){if(r.current.done)continue;const e=r.current.value;e.path===t&&(n[r.slot]=e,a+=1,await Ke(r,e.path))}return{populated:a,row:{path:t,...n}}};async function*He(e,t,n,a){const r=await(async(e,t)=>{const n=[];for(const a of t){const t=e[a];if(void 0===t)continue;const r={slot:a,iter:t.entries()[Symbol.asyncIterator](),current:{value:void 0,done:!1}};await Ke(r,null),n.push(r)}return n})(e,t);for(;;){if(!0===n?.aborted)throw ee();const e=Ye(r);if(null===e)return;const s=await Fe(r,e);"inner"===a&&s.populated!==t.length||(yield s.row)}}async function*Xe(e){let t=null;for await(const n of e){if(null!==t&&n.path<t)throw te(t,n.path);t=n.path,yield n}}const _e=(e,t={})=>{const n=Object.keys(e),[a]=n;return 1===n.length&&void 0!==a?async function*(e,t,n){const a=e[t];if(void 0!==a)for await(const e of a.entries()){if(!0===n?.aborted)throw ee();const a={path:e.path,[t]:e};yield a}}(e,a,t.signal):He(e,n,t.signal,"outer")},qe=(e,t={})=>He(e,Object.keys(e),t.signal,"inner"),Ve=async(e,t)=>{const n=await e;if(null===n)throw ne(t);return n},Je=e=>{const t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)},Qe=()=>async function*(e){let t=null,n=[];for await(const a of Xe(e)){const e=Je(a.path);null===t||e!==t?(null!==t&&n.length>0&&(yield{path:t,rows:n}),t=e,n=[a]):n.push(a)}null!==t&&n.length>0&&(yield{path:t,rows:n})},We=(e,t={})=>async function*(n){const a=t.concurrency??4,r=[],s=async()=>{const e=r.shift();if(void 0===e)throw new Error("drainOldest invariant: queue empty");return await e.task,e.row};for await(const o of Xe(n)){if(!0===t.signal?.aborted)throw ee();const n=o[e],i=void 0===n?.hash?Promise.resolve():n.hash();r.push({row:o,task:i}),r.length>=a&&(yield await s())}for(;r.length>0;)yield await s()},Ze=(e={})=>We("workdir",e),et=e=>{const t=e;return t?.stat?.size??0},tt=(e,t)=>{const n=e[t];return{size:et(n),task:void 0===n?.read?Promise.resolve():n.read()}},nt=async e=>{const t=e.inflight.shift();if(void 0===t)throw new Error("drainOldest invariant: queue empty");return await t.task,e.bytes-=t.size,t.row},rt=(e,t={})=>async function*(n){const a=t.concurrency??4,r=t.maxInflightBytes??67108864,s={inflight:[],bytes:0},o=()=>s.inflight.length>=a||s.bytes>=r;for await(const a of Xe(n)){if(!0===t.signal?.aborted)throw ee();const{size:n,task:r}=tt(a,e);for(s.inflight.push({row:a,size:n,task:r}),s.bytes+=n;o()&&s.inflight.length>0;)yield await nt(s)}for(;s.inflight.length>0;)yield await nt(s)},st=async(e,t={})=>{let n=0;for await(const a of e){if(!0===t.signal?.aborted)throw ee();n+=1}return n},ot=async(e,t={})=>{const n=[];for await(const a of e){if(!0===t.signal?.aborted)throw ee();n.push(a)}return n},it=async(e,t={})=>{const n=e[Symbol.asyncIterator]();try{const e=await n.next();if(!0===t.signal?.aborted)throw ee();return!0===e.done?null:e.value}finally{"function"==typeof n.return&&await n.return()}};async function*ct(e,t){const n=(e=>e.workdir)(e);if(void 0!==n?.verify)try{return await n.verify(),void(yield e)}catch(n){if("throw"===t)throw n;if("skip"===t)return;const a={...e,_raced:!0};yield a}else yield e}const lt=(e={})=>async function*(t){const n=e.onRace??"throw";for await(const a of Xe(t)){if(!0===e.signal?.aborted)throw ee();yield*ct(a,n)}};export{st as count,it as first,Qe as groupByDir,We as hashSlot,Ze as hashWorkdir,qe as innerJoin,_e as join,rt as loadBlob,Ve as requireSnapshot,ke as tarArchive,ot as toArray,lt as verifyWorkdir,$e as warnDeprecated,Ge as zipArchive};
2
- //# sourceMappingURL=index.js.map
1
+ export{d as detectRuntime,i as isBrowser,a as isNode,n as noopLogger,w as wrapLoggerSanitizer}from"./chunks/adapter-detect-BkCMnjrI.js";import{o as ee,g as te,i as ne}from"./chunks/error-BotOd-nD.js";export{c as createContext}from"./chunks/context-CumKOV7K.js";export{c as consoleProgress,n as noopProgress}from"./chunks/progress-B_AJnOHx.js";import{a as re,c as se}from"./chunks/write-sparse-checkout-BwHbNKNS.js";export{F as FilePath,O as ObjectId,R as RefName}from"./chunks/write-sparse-checkout-BwHbNKNS.js";export{a as add,b as archive,c as bindBranchNamespace,d as bindBundleNamespace,e as bindCherryPickNamespace,f as bindConfigNamespace,g as bindMergeNamespace,h as bindNotesNamespace,i as bindRebaseNamespace,j as bindRemoteNamespace,k as bindRevertNamespace,l as bindSparseCheckoutNamespace,m as bindStashNamespace,n as bindSubmoduleNamespace,o as bindTagNamespace,p as bindWorktreeNamespace,q as blame,r as branchCreate,s as branchDelete,t as branchList,u as branchRename,v as bundleCreate,w as bundleListHeads,x as bundleVerify,y as catFile,z as checkout,A as cherryPickAbort,B as cherryPickContinue,C as cherryPickRun,D as cherryPickSkip,E as clone,F as commit,G as configGet,H as configGetAll,I as configGetRegexp,J as configList,K as configRemoveSection,L as configRenameSection,M as configSet,N as configUnset,O as configUnsetAll,P as createPromisorRemote,Q as describe,R as diff,S as fetch,T as fetchMissing,U as fsck,V as grep,W as init,X as log,Y as mergeAbort,Z as mergeContinue,_ as mergeRun,$ as mv,a0 as nameRev,a1 as notesAdd,a2 as notesList,a3 as notesRead,a4 as notesRemove,a5 as pull,a6 as push,a7 as rangeDiff,a8 as readFileAt,a9 as rebaseAbort,aa as rebaseContinue,ab as rebaseRun,ac as rebaseSkip,ad as reflog,ae as remoteAdd,af as remoteList,ag as remoteRemove,ah as remoteRename,ai as remoteSetUrl,aj as remoteShow,ak as reset,al as revParse,am as revertAbort,an as revertContinue,ao as revertRun,ap as revertSkip,aq as rm,ar as shortlog,as as show,at as sparseCheckoutAdd,au as sparseCheckoutDisable,av as sparseCheckoutList,aw as sparseCheckoutReapply,ax as sparseCheckoutSet,ay as stashApply,az as stashDrop,aA as stashList,aB as stashPop,aC as stashPush,aD as status,aE as submoduleAdd,aF as submoduleDeinit,aG as submoduleInit,aH as submoduleList,aI as submoduleSync,aJ as submoduleUpdate,aK as tagCreate,aL as tagDelete,aM as tagList,aN as whatchanged,aO as worktreeAdd,aP as worktreeList,aQ as worktreeMove,aR as worktreeRemove}from"./chunks/index-DsvINN8n.js";import"./chunks/readable-stream-CGuf8k1J.js";import"./transport/index.js";const oe=new TextEncoder,ie=512,ce=new Uint8Array([117,115,116,97,114,0]),le=new Uint8Array([48,48]),ue=e=>8**(e-1)-1;function de(e,t,n,a){if(a>ue(n))throw new Error(`Value ${a} exceeds the ${n-1}-digit octal field capacity (max ${ue(n)})`);const r=a.toString(8).padStart(n-1,"0");for(let a=0;a<n-1;a++)e[t+a]=r.charCodeAt(a);e[t+n-1]=0}function fe(e,t,n,a){const r=Math.min(a.length,n);for(let n=0;n<r;n++)e[t+n]=a.charCodeAt(n)}function he(e,t,n,a){e.set(a.subarray(0,Math.min(a.length,n)),t)}function me(e){const t=new Uint8Array(512);return function(e,t){he(e,0,100,t.nameBytes),de(e,100,8,t.mode),de(e,108,8,0),de(e,116,8,0),de(e,124,12,t.size),de(e,136,12,t.mtime),e[156]=t.typeflag,he(e,157,100,t.linknameBytes)}(t,e),function(e,t){e.set(ce,257),e.set(le,263),fe(e,265,32,t.uname),fe(e,297,32,t.gname),de(e,329,8,0),de(e,337,8,0),he(e,345,155,t.prefixBytes)}(t,e),function(e){const t=function(e){let t=0;for(const[n,a]of e.entries())t+=n>=148&&n<156?32:a;return t}(e).toString(8).padStart(7,"0");for(let n=0;n<7;n++)e[148+n]=t.charCodeAt(n);e[155]=0}(t),t}function ye(e){const t=oe.encode(e),n=t.length;if(n<=100)return{nameBytes:t,prefixBytes:new Uint8Array(0)};if(n>256)throw new Error(`Path too long for ustar archive (>256 bytes): ${e}`);for(let e=Math.min(n-1,155);e>0;e--){const a=n-e-1;if(47===t[e]&&a>=1&&a<=100)return{nameBytes:t.subarray(e+1),prefixBytes:t.subarray(0,e)}}throw new Error(`Cannot split path into ustar prefix+name: ${e}`)}function pe(e,t){switch(e){case re.REGULAR:return 438&~t;case re.EXECUTABLE:case re.DIRECTORY:case re.GITLINK:return 511&~t;case re.SYMLINK:return 511}}function ge(e){switch(e){case re.REGULAR:case re.EXECUTABLE:return 48;case re.SYMLINK:return 50;case re.DIRECTORY:case re.GITLINK:return 53}}function we(e){return e===re.REGULAR||e===re.EXECUTABLE}function Ae(e){const t=e%ie;return 0===t?0:ie-t}function be(e,t,n,a,r,s){const{nameBytes:o,prefixBytes:i}=ye(t),c=e.mode===re.SYMLINK&&void 0!==e.content?e.content:new Uint8Array(0);if(c.length>100)throw new Error(`Symlink target too long for ustar archive (>100 bytes): ${t}`);const l=we(e.mode)&&void 0!==e.content?e.content.length:0;return me({nameBytes:o,mode:pe(e.mode,a),size:l,mtime:n,typeflag:ge(e.mode),linknameBytes:c,uname:r,gname:s,prefixBytes:i})}function ve(e,t,n){const a=function(e){return e===re.DIRECTORY||e===re.GITLINK}(n)?"/":"";return t+e+a}async function*ke(e,t){const n=t?.prefix??"",a=t?.mtime??e.commitTime??0,r=t?.umask??2,s=t?.uname??"root",o=t?.gname??"root";let i=0;void 0!==e.commit&&(yield function(e,t,n){const{nameBytes:a,prefixBytes:r}=ye("pax_global_header");return me({nameBytes:a,mode:438,size:52,mtime:e,typeflag:103,linknameBytes:new Uint8Array(0),uname:t,gname:n,prefixBytes:r})}(a,s,o),i+=ie,yield function(e){const t=new Uint8Array(ie),n=`52 comment=${e}\n`;for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return t}(e.commit),i+=ie),""!==n&&(yield function(e,t,n,a,r){const{nameBytes:s,prefixBytes:o}=ye(e);return me({nameBytes:s,mode:511&~n,size:0,mtime:t,typeflag:53,linknameBytes:new Uint8Array(0),uname:a,gname:r,prefixBytes:o})}(n,a,r,s,o),i+=ie);for await(const t of e.entries){const e=ve(t.path,n,t.mode);if(yield be(t,e,a,r,s,o),i+=ie,we(t.mode)&&void 0!==t.content&&t.content.length>0){yield t.content,i+=t.content.length;const e=Ae(t.content.length);e>0&&(yield new Uint8Array(e),i+=e)}}yield new Uint8Array(1024),i+=1024;const c=i%10240;0!==c&&(yield new Uint8Array(10240-c))}const xe=new Uint8Array([80,75,3,4]),Re=new Uint8Array([80,75,1,2]),Be=new Uint8Array([80,75,5,6]);function Ce(e,t,n){e[t]=255&n,e[t+1]=n>>>8&255}function Ee(e,t,n){e[t]=255&n,e[t+1]=n>>>8&255,e[t+2]=n>>>16&255,e[t+3]=n>>>24&255}const Ue=new TextEncoder;function Te(e){return Ue.encode(e)}function Le(e,t,n,a,r,s,o,i,c,l,u){const d=e.length,f=u.length,h=new Uint8Array(46+d+f);let m=0;return h.set(Re,m),m+=4,Ce(h,m,c),m+=2,Ce(h,m,10),m+=2,Ce(h,m,0),m+=2,Ce(h,m,t),m+=2,Ce(h,m,n.time),m+=2,Ce(h,m,n.date),m+=2,Ee(h,m,a),m+=4,Ee(h,m,r),m+=4,Ee(h,m,s),m+=4,Ce(h,m,d),m+=2,Ce(h,m,f),m+=2,Ce(h,m,0),m+=2,Ce(h,m,0),m+=2,Ce(h,m,o),m+=2,Ee(h,m,i),m+=4,Ee(h,m,l),m+=4,h.set(e,m),m+=d,h.set(u,m),h}function Se(e){for(let t=0;t<e.length;t++)if(0===e[t])return!1;return!0}const Ie={versionMadeBy:791,internalAttr:1,externalAttr:2717843456},Ne={versionMadeBy:0,internalAttr:0,externalAttr:16};function ze(e){switch(e.mode){case re.REGULAR:return{versionMadeBy:0,internalAttr:void 0!==(t=e.content)&&Se(t)?1:0,externalAttr:0};case re.EXECUTABLE:return function(e){return{versionMadeBy:791,internalAttr:void 0!==e&&Se(e)?1:0,externalAttr:2179792896}}(e.content);case re.SYMLINK:return Ie;case re.DIRECTORY:case re.GITLINK:return Ne}var t}async function Me(e,t,n){if(Oe(e.mode))return{method:0,compressed:new Uint8Array(0),contentCrc:0,usize:0};const a=e.content??new Uint8Array(0),r=se(a),s=a.length;if((o=e.mode)!==re.REGULAR&&o!==re.EXECUTABLE)return{method:0,compressed:a,contentCrc:r,usize:s};var o;const i=await t.deflateRaw(a,n);return i.length<a.length?{method:8,compressed:i,contentCrc:r,usize:s}:{method:0,compressed:a,contentCrc:r,usize:s}}function Oe(e){return e===re.DIRECTORY||e===re.GITLINK}function Pe(e,t,n){return`${t}${e}${Oe(n)?"/":""}`}function De(e){const{nameBytes:t,method:n,dosTime:a,crc:r,csize:s,usize:o,utExtra:i}=e,c=function(e,t,n,a,r,s,o){const i=e.length,c=o.length,l=new Uint8Array(30+i+c);let u=0;return l.set(xe,u),u+=4,Ce(l,u,10),u+=2,Ce(l,u,0),u+=2,Ce(l,u,t),u+=2,Ce(l,u,n.time),u+=2,Ce(l,u,n.date),u+=2,Ee(l,u,a),u+=4,Ee(l,u,r),u+=4,Ee(l,u,s),u+=4,Ce(l,u,i),u+=2,Ce(l,u,c),u+=2,l.set(e,u),u+=i,l.set(o,u),l}(t,n,a,r,s,o,i);return{localHeader:c,record:{name:t,method:n,dosTime:a,crc:r,csize:s,usize:o,internalAttr:e.internalAttr,externalAttr:e.externalAttr,versionMadeBy:e.versionMadeBy,localOffset:e.localOffset,utExtra:i}}}async function*Ge(e,t,n){const a=n?.prefix??"",r=n?.mtime??e.commitTime??0,s=n?.tzOffsetMinutes??0,o=n?.level,i=function(e,t){const n=new Date(1e3*(e+60*t));return{time:n.getUTCHours()<<11|n.getUTCMinutes()<<5|Math.floor(n.getUTCSeconds()/2),date:n.getUTCFullYear()-1980<<9|n.getUTCMonth()+1<<5|n.getUTCDate()}}(r,s),c=function(e){const t=new Uint8Array(9);return Ce(t,0,21589),Ce(t,2,5),t[4]=1,Ee(t,5,e),t}(r),l=[];let u=0;if(""!==a){const e=Te(a),{localHeader:t,record:n}=De({nameBytes:e,method:0,dosTime:i,crc:0,csize:0,usize:0,internalAttr:0,externalAttr:16,versionMadeBy:0,localOffset:u,utExtra:c});yield t,l.push(n),u+=t.length}for await(const n of e.entries){const e=Te(Pe(n.path,a,n.mode)),r=ze(n),{method:s,compressed:d,contentCrc:f,usize:h}=await Me(n,t,o),m=d.length,{localHeader:y,record:p}=De({nameBytes:e,method:s,dosTime:i,crc:f,csize:m,usize:h,internalAttr:r.internalAttr,externalAttr:r.externalAttr,versionMadeBy:r.versionMadeBy,localOffset:u,utExtra:c});yield y,l.push(p),u+=y.length,m>0&&(yield d,u+=m)}const d=u;let f=0;for(const e of l){const t=Le(e.name,e.method,e.dosTime,e.crc,e.csize,e.usize,e.internalAttr,e.externalAttr,e.versionMadeBy,e.localOffset,e.utExtra);yield t,f+=t.length}const h=e.commit??"";yield function(e,t,n,a){const r=Ue.encode(a),s=new Uint8Array(22+r.length);let o=0;return s.set(Be,o),o+=4,Ce(s,o,0),o+=2,Ce(s,o,0),o+=2,Ce(s,o,e),o+=2,Ce(s,o,e),o+=2,Ee(s,o,t),o+=4,Ee(s,o,n),o+=4,Ce(s,o,r.length),o+=2,s.set(r,o),s}(l.length,f,d,h)}const je=new Set,$e=(e,t)=>{if((()=>{const e=globalThis.process;return"1"===e?.env?.TSGIT_SUPPRESS_DEPRECATIONS})())return;if(je.has(e))return;je.add(e);const n=globalThis.console;n?.warn(`[tsgit deprecation] ${e}: ${t}`)},Ke=async(e,t)=>{if(e.current=await e.iter.next(),!e.current.done&&null!==t){const n=e.current.value;if(n.path<t)throw te(t,n.path)}},Ye=e=>{let t=null;for(const n of e){if(n.current.done)continue;const e=n.current.value.path;(null===t||e<t)&&(t=e)}return t},Fe=async(e,t)=>{const n={};let a=0;for(const r of e){if(r.current.done)continue;const e=r.current.value;e.path===t&&(n[r.slot]=e,a+=1,await Ke(r,e.path))}return{populated:a,row:{path:t,...n}}};async function*He(e,t,n,a){const r=await(async(e,t)=>{const n=[];for(const a of t){const t=e[a];if(void 0===t)continue;const r={slot:a,iter:t.entries()[Symbol.asyncIterator](),current:{value:void 0,done:!1}};await Ke(r,null),n.push(r)}return n})(e,t);for(;;){if(!0===n?.aborted)throw ee();const e=Ye(r);if(null===e)return;const s=await Fe(r,e);"inner"===a&&s.populated!==t.length||(yield s.row)}}async function*Xe(e){let t=null;for await(const n of e){if(null!==t&&n.path<t)throw te(t,n.path);t=n.path,yield n}}const _e=e=>{if(!0===e?.aborted)throw ee()},qe=(e,t={})=>{const n=Object.keys(e),[a]=n;return 1===n.length&&void 0!==a?async function*(e,t,n){_e(n);const a=e[t];if(void 0!==a)for await(const e of a.entries()){_e(n);const a={path:e.path,[t]:e};yield a}}(e,a,t.signal):He(e,n,t.signal,"outer")},Ve=(e,t={})=>He(e,Object.keys(e),t.signal,"inner"),Je=async(e,t)=>{const n=await e;if(null===n)throw ne(t);return n},Qe=e=>{const t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)},We=()=>async function*(e){let t=null,n=[];for await(const a of Xe(e)){const e=Qe(a.path);null===t||e!==t?(null!==t&&n.length>0&&(yield{path:t,rows:n}),t=e,n=[a]):n.push(a)}null!==t&&n.length>0&&(yield{path:t,rows:n})},Ze=(e,t={})=>async function*(n){const a=t.concurrency??4,r=[],s=async()=>{const e=r.shift();if(void 0===e)throw new Error("drainOldest invariant: queue empty");return await e.task,e.row};for await(const o of Xe(n)){if(!0===t.signal?.aborted)throw ee();const n=o[e],i=void 0===n?.hash?Promise.resolve():n.hash();r.push({row:o,task:i}),r.length>=a&&(yield await s())}for(;r.length>0;)yield await s()},et=(e={})=>Ze("workdir",e),tt=e=>{const t=e;return t?.stat?.size??0},nt=(e,t)=>{const n=e[t];return{size:tt(n),task:void 0===n?.read?Promise.resolve():n.read()}},rt=async e=>{const t=e.inflight.shift();if(void 0===t)throw new Error("drainOldest invariant: queue empty");return await t.task,e.bytes-=t.size,t.row},st=(e,t={})=>async function*(n){const a=t.concurrency??4,r=t.maxInflightBytes??67108864,s={inflight:[],bytes:0},o=()=>s.inflight.length>=a||s.bytes>=r;for await(const a of Xe(n)){if(!0===t.signal?.aborted)throw ee();const{size:n,task:r}=nt(a,e);for(s.inflight.push({row:a,size:n,task:r}),s.bytes+=n;o()&&s.inflight.length>0;)yield await rt(s)}for(;s.inflight.length>0;)yield await rt(s)},ot=async(e,t={})=>{let n=0;for await(const a of e){if(!0===t.signal?.aborted)throw ee();n+=1}return n},it=async(e,t={})=>{const n=[];for await(const a of e){if(!0===t.signal?.aborted)throw ee();n.push(a)}return n},ct=async(e,t={})=>{const n=e[Symbol.asyncIterator]();try{const e=await n.next();if(!0===t.signal?.aborted)throw ee();return!0===e.done?null:e.value}finally{"function"==typeof n.return&&await n.return()}};async function*lt(e,t){const n=(e=>e.workdir)(e);if(void 0!==n?.verify)try{return await n.verify(),void(yield e)}catch(n){if("throw"===t)throw n;if("skip"===t)return;const a={...e,_raced:!0};yield a}else yield e}const ut=(e={})=>async function*(t){const n=e.onRace??"throw";for await(const a of Xe(t)){if(!0===e.signal?.aborted)throw ee();yield*lt(a,n)}};export{ot as count,ct as first,We as groupByDir,Ze as hashSlot,et as hashWorkdir,Ve as innerJoin,qe as join,st as loadBlob,Je as requireSnapshot,ke as tarArchive,it as toArray,ut as verifyWorkdir,$e as warnDeprecated,Ge as zipArchive};
@@ -1,2 +1 @@
1
- import{realpath as r,stat as e}from"node:fs/promises";import*as o from"node:path";import{N as s,a as t,e as p,b as m,c as h,d as l}from"./chunks/node-http-transport-doU9Y8WN.js";import{S as w,c as u}from"./chunks/lru-cache-Cy7C7Lx2.js";import{o as f}from"./chunks/repository-dCH3DdLQ.js";export{d as detectRuntime,i as isBrowser,a as isNode}from"./chunks/adapter-detect-CTTG6hpk.js";export{c as consoleProgress,n as noopProgress}from"./chunks/progress-CLPpgZJ6.js";export{F as FilePath,O as ObjectId,R as RefName}from"./chunks/write-sparse-checkout-D4tNUXOp.js";import"node:child_process";import"node:zlib";import"./chunks/error-BD0nFV6t.js";import"node:fs";import"node:os";import"node:stream/promises";import"node:crypto";import"node:http";import"node:https";import"node:stream";import"./chunks/index-BEI7XKaV.js";import"./transport/index.js";import"./chunks/readable-stream-CGuf8k1J.js";import"./primitives/index.js";const k=r=>r.split("/").filter(r=>""!==r),j=async(e={})=>{const a=e.cwd??process.cwd(),i=await r(o.resolve(a)).catch(()=>o.resolve(a)),n=await x(i)??{workDir:i,gitDir:o.join(i,".git"),bare:!1},c={fs:new p(n.workDir),hash:new l,compressor:new h,transport:new m({allowInsecureHttp:e.allowInsecureHttp??!1}),hooks:new t,command:new s,runtime:"node",layout:n,hashConfig:w,deltaCache:u(e.deltaCacheMaxBytes??16777216,e.deltaCacheMaxEntries??65536),makeWorktreeFs:r=>new p((r=>{const[e=[],...o]=r.map(k),s=[];for(const r of e){if(!o.every(e=>e[s.length]===r))break;s.push(r)}return`/${s.join("/")}`})([n.workDir,...r]))},{cwd:d,allowInsecureHttp:j,deltaCacheMaxBytes:g,deltaCacheMaxEntries:y,...b}=e;return f({...b,cwd:i},c)},x=async r=>{let s=r;for(;;){const r=o.join(s,".git"),t=await e(r).catch(()=>{});if(t?.isDirectory())return{workDir:s,gitDir:r,bare:!1};const a=o.dirname(s);if(a===s)return;s=a}};export{j as openRepository};
2
- //# sourceMappingURL=index.node.js.map
1
+ import{realpath as e,stat as r}from"node:fs/promises";import*as o from"node:path";import{N as s,a as t,g as p,c as m,b as h,d as l,e as f,f as w,n as u}from"./chunks/node-ssh-transport-BgSv2IhT.js";import{S as k,c as j}from"./chunks/lru-cache-Cy7C7Lx2.js";import{o as g}from"./chunks/repository-DyxknzvE.js";export{d as detectRuntime,i as isBrowser,a as isNode}from"./chunks/adapter-detect-BkCMnjrI.js";export{c as consoleProgress,n as noopProgress}from"./chunks/progress-B_AJnOHx.js";export{F as FilePath,O as ObjectId,R as RefName}from"./chunks/write-sparse-checkout-BwHbNKNS.js";import"node:child_process";import"node:zlib";import"./chunks/error-BotOd-nD.js";import"node:fs";import"node:os";import"node:stream/promises";import"node:crypto";import"node:http";import"node:https";import"node:stream";import"./chunks/index-DsvINN8n.js";import"./chunks/readable-stream-CGuf8k1J.js";import"./transport/index.js";import"./primitives/index.js";const x=(e,r)=>e.slice(r.rootOf(e).length).split(r.sep).filter(Boolean),y=(e,r,o)=>void 0!==e&&o.normalizeForCompare(e)===o.normalizeForCompare(r),C=async(r={})=>{const a=r.cwd??process.cwd(),n=await e(o.resolve(a)).catch(()=>o.resolve(a)),i=await v(n)??{workDir:n,gitDir:o.join(n,".git"),bare:!1},c={fs:new p(i.workDir),hash:new w,compressor:new f,transport:new l({allowInsecureHttp:r.allowInsecureHttp??!1}),hooks:new t,command:new s,env:new h,ssh:new m,runtime:"node",layout:i,hashConfig:k,deltaCache:j(r.deltaCacheMaxBytes??16777216,r.deltaCacheMaxEntries??65536),makeWorktreeFs:e=>new p(((e,r)=>{const o=e.map(e=>r.resolve(e)),[s,...t]=o;if(void 0===s)return r.sep;const a=r.rootOf(s);if(!o.every(e=>r.normalizeForCompare(r.rootOf(e))===r.normalizeForCompare(a)))return s;const n=t.map(e=>x(e,r)),i=[];for(const e of x(s,r)){if(!n.every(o=>y(o[i.length],e,r)))break;i.push(e)}return a+i.join(r.sep)})([i.workDir,...e],u),u)},{cwd:d,allowInsecureHttp:C,deltaCacheMaxBytes:b,deltaCacheMaxEntries:D,...F}=r;return g({...F,cwd:n},c)},v=async e=>{let s=e;for(;;){const e=o.join(s,".git"),t=await r(e).catch(()=>{});if(t?.isDirectory())return{workDir:s,gitDir:e,bare:!1};const a=o.dirname(s);if(a===s)return;s=a}};export{C as openRepository};
@@ -1,2 +1 @@
1
1
  export{r as readableStreamToAsyncIterable}from"../chunks/readable-stream-CGuf8k1J.js";function n(n){return async function*(t){for await(const r of t)await n(r)&&(yield r)}}function t(n){return async t=>{for await(const r of t)if(await n(r))return r}}function e(n){return async function*(t){for await(const r of t){const t=await n(r);for await(const n of t)yield n}}}function o(n,t=Number.POSITIVE_INFINITY){if(Number.isNaN(t)||t<0)throw new RangeError("groupBy(limit): must be a non-negative number or Infinity");return async r=>{const e=new Map;let o=0;for await(const a of r){if(o>=t)throw new RangeError(`groupBy: exceeded limit of ${t} items`);const r=await n(a),i=e.get(r);i?i.push(a):e.set(r,[a]),o+=1}return e}}function a(n){return async function*(t){for await(const r of t)yield await n(r)}}function i(n,...t){return t.reduce((n,t)=>t(n),n)}function u(n){if(!Number.isInteger(n)||n<0)throw new RangeError("take(count): count must be a non-negative integer");return async function*(t){if(0===n)return;let r=0;for await(const e of t)if(yield e,r+=1,r>=n)return}}async function f(n,t=Number.POSITIVE_INFINITY){if(Number.isNaN(t)||t<0)throw new RangeError("toArray(limit): must be a non-negative number or Infinity");const r=[];for await(const e of n){if(r.length>=t)throw new RangeError(`toArray: exceeded limit of ${t} items`);r.push(e)}return r}export{n as filter,t as find,e as flatMap,o as groupBy,a as map,i as pipe,u as take,f as toArray};
2
- //# sourceMappingURL=index.js.map
@@ -1,2 +1 @@
1
- import{b as a,c8 as i,c9 as c}from"../chunks/write-sparse-checkout-D4tNUXOp.js";export{ca as DEFAULT_NOTES_REF,cb as MAX_SPARSE_PATTERN_FILE_BYTES,bS as appendReflog,bH as applyChangeset,bY as applyConfigOpInText,bV as buildIndexFromTree,az as buildPack,B as catFileBatch,bb as compareWorkingTreeDelta,aL as compareWorkingTreeEntry,cc as computeChangeset,A as createCommit,bQ as deleteReflog,z as diffTrees,bn as enumerateObjects,c4 as enumeratePushObjects,ay as enumerateRefs,aZ as fetchPack,a0 as findFirstValuelessEntry,am as flattenTree,b1 as getAllConfigValues,b0 as getConfigValue,y as getRepoRoot,x as hashBlob,cd as invalidateConfigCache,ce as invalidateScopedConfigCache,bI as isWorkingTreeDirty,bm as listReflogs,bB as loadNotesTree,a3 as loadSparseMatcher,a5 as materializeTree,bX as materializeWorktreeFromHead,v as mergeBase,aQ as parseIniSections,d as readBlob,a2 as readConfig,b2 as readConfigSections,ba as readHeadTree,r as readIndex,g as readReflog,cf as readShallow,bJ as readSparsePatternText,t as readTree,aj as reflogExists,b4 as removeConfigSection,b5 as renameConfigSection,bA as resolveNotesRef,h as resolveRef,bR as resolveReflogIdentity,q as runHook,aE as runInformationalHook,b6 as setConfigEntry,cg as setConfigEntryInText,ch as setCoreConfigEntryInText,ci as sparseCheckoutPath,s as streamBlob,aG as synthesizeTreeFromIndex,b8 as unsetAllConfigEntries,b7 as unsetConfigEntry,a$ as updateConfigEntries,bK as updateCoreConfig,p as updateRef,a_ as updateShallow,o as walkCommits,n as walkCommitsByDate,m as walkSubmodules,e as walkTree,w as walkWorkingTree,bC as writeNotesTree,l as writeObject,ar as writeReflog,bO as writeSparsePatternText,k as writeTree}from"../chunks/write-sparse-checkout-D4tNUXOp.js";import{D as f,o as u}from"../chunks/error-BD0nFV6t.js";import"../chunks/readable-stream-CGuf8k1J.js";const b=e=>{if(e<3)return 0;const t=Math.floor(Math.log2(e)),a=1<<t;return a<3*(e-a)?t:t-1},C=(e,t)=>{const a=new Set,s=[e];for(;s.length>0;){const e=s.pop();if(a.has(e))continue;const n=t.get(e);a.add(e);for(const e of n.parents)a.has(e)||s.push(e)}return a.size},T=(e,t)=>{const a=2*e-t;return a>=-1&&a<=1},S=(e,t,a)=>{if(t.has(e.id)||1!==e.parents.length)return;const s=t.get(e.parents[0]);if(void 0===s)return;const n=s+1;return t.set(e.id,n),T(n,a)?{nextCommit:e.id,candidateCount:a,reaches:n}:null},E=async(e,t)=>{const s=await a(e,t);if("commit"!==s.type)throw f(`bisectMidpoint: ${t} is not a commit`);return{date:s.data.committer.timestamp,parents:s.data.parents}},R=(e,t)=>e.date>t.date||e.date===t.date&&e.ins<t.ins,I=(e,t)=>{let a=0;for(;a<e.length&&!R(t,e[a]);)a+=1;e.splice(a,0,t)},M=async(e,t,a)=>{const s=await(async(e,t)=>{const a=new Map,s=[...t];let n=0;for(;n<s.length;){const t=s[n++];if(a.has(t))continue;const r=await E(e,t);a.set(t,r);for(const e of r.parents)a.has(e)||s.push(e)}return a})(e,t),n=await(async(e,t,a)=>{const s=(e=>{const t=new Map;return async a=>{const s=t.get(a);if(void 0!==s)return s;const n=await E(e,a);return t.set(a,n),n}})(e),n=await s(t);if(a.has(t))return[];const r=await(async(e,t,a,s)=>{let n=0;const r=new Set,o=[],i=[];for(I(i,{id:t,date:a,ins:n++});i.length>0;){const{id:t}=i.shift();if(r.has(t))continue;r.add(t);const a=await e(t);o.push({id:t,date:a.date,parents:a.parents});for(const t of a.parents){if(r.has(t)||s.has(t))continue;const a=await e(t);I(i,{id:t,date:a.date,ins:n++})}}return o})(s,t,n.date,a);return(e=>{const t=new Set;for(const a of e)t.add(a.id);return e.slice().reverse().map(e=>({id:e.id,parents:e.parents.filter(e=>t.has(e)),date:e.date}))})(r)})(e,a,s),r=(e=>{if(0===e.length)return;const t=e.length,a=new Map(e.map(e=>[e.id,e])),s=new Map;((e,t)=>{for(const a of e)0===a.parents.length&&t.set(a.id,1)})(e,s);const n=((e,t,a,s)=>{for(const n of e){if(n.parents.length<2)continue;const e=C(n.id,t);if(a.set(n.id,e),T(e,s))return{nextCommit:n.id,candidateCount:s,reaches:e}}})(e,a,s,t);if(void 0!==n)return n;const r=((e,t,a)=>{let s=!0;for(;s;){s=!1;for(const n of e){const e=S(n,t,a);if(void 0!==e){if(null!==e)return e;s=!0}}}})(e,s,t);if(void 0!==r)return r;const o=((e,t,a)=>{const s=e[0],n=t.get(s.id);let r=s.id,o=Math.min(n,a-n),i=n;for(let s=1;s<e.length;s+=1){const n=e[s],c=t.get(n.id),d=Math.min(c,a-c);d>o&&(o=d,r=n.id,i=c)}return{id:r,weight:i}})(e,s,t);return{nextCommit:o.id,candidateCount:t,reaches:o.weight}})(n);return void 0===r?void 0:(e=>({nextCommit:e.nextCommit,candidateCount:e.candidateCount,remainingIfGood:e.candidateCount-e.reaches-1,remainingIfBad:e.reaches-1,remainingSteps:b(e.candidateCount)}))(r)},j=async(e,t)=>{if(e.signal?.aborted)throw u();if(0===t.length)return[];const a=await i(e),s=[...a.base],n=new Set,r=async e=>{for(const t of(e=>{const t=e.split("/");if(t.length<=1)return[];const a=[];for(let e=1;e<t.length;e+=1)a.push(t.slice(0,e).join("/"));return a})(e)){if(n.has(t))continue;n.add(t);const e=await a.loadDirRules(t);e.length>0&&s.push({basedir:t,rules:e,kind:"gitignore"})}},o=[];for(const a of t){if(e.signal?.aborted)throw u();await r(a.path);const t=c(s,a.path,!0===a.isDirectory);if("ignored"!==t.verdict||void 0===t.level||void 0===t.ruleIndex){o.push({path:a.path,ignored:!1});continue}const n=t.level.rules[t.ruleIndex];o.push(void 0!==n?{path:a.path,ignored:!0,source:{kind:t.level.kind??"gitignore",basedir:t.level.basedir,line:n.lineNumber,pattern:n.pattern}}:{path:a.path,ignored:!1})}return o};export{M as bisectMidpoint,j as isIgnored,a as readObject};
2
- //# sourceMappingURL=index.js.map
1
+ import{b as a,ap as i,cc as c,cd as l}from"../chunks/write-sparse-checkout-BwHbNKNS.js";export{ce as DEFAULT_NOTES_REF,cf as MAX_SPARSE_PATTERN_FILE_BYTES,bW as appendReflog,bL as applyChangeset,c0 as applyConfigOpInText,bZ as buildIndexFromTree,aC as buildPack,E as catFileBatch,bf as compareWorkingTreeDelta,aO as compareWorkingTreeEntry,cg as computeChangeset,D as createCommit,c6 as createTag,bU as deleteReflog,B as diffTrees,bs as enumerateObjects,ca as enumeratePushObjects,aB as enumerateRefs,aZ as fetchPack,a3 as findFirstValuelessEntry,aQ as flattenTree,b5 as getAllConfigValues,b4 as getConfigValue,A as getRepoRoot,bi as hasObject,z as hashBlob,ch as invalidateConfigCache,ci as invalidateScopedConfigCache,bM as isWorkingTreeDirty,br as listReflogs,bG as loadNotesTree,a6 as loadSparseMatcher,a8 as materializeTree,b$ as materializeWorktreeFromHead,y as mergeBase,aU as parseIniSections,d as readBlob,a5 as readConfig,b6 as readConfigSections,be as readHeadTree,r as readIndex,g as readReflog,cj as readShallow,bN as readSparsePatternText,x as readTree,am as reflogExists,b8 as removeConfigSection,b9 as renameConfigSection,bF as resolveNotesRef,h as resolveRef,bV as resolveReflogIdentity,b2 as resolveSigningSelector,v as runHook,aH as runInformationalHook,ba as setConfigEntry,ck as setConfigEntryInText,cl as setCoreConfigEntryInText,b1 as signPayload,cm as sparseCheckoutPath,t as streamBlob,aJ as synthesizeTreeFromIndex,bc as unsetAllConfigEntries,bb as unsetConfigEntry,b0 as updateConfigEntries,bO as updateCoreConfig,s as updateRef,a_ as updateShallow,q as walkCommits,p as walkCommitsByDate,o as walkSubmodules,e as walkTree,w as walkWorkingTree,bH as writeNotesTree,n as writeObject,au as writeReflog,bS as writeSparsePatternText,m as writeTree}from"../chunks/write-sparse-checkout-BwHbNKNS.js";import{D as f,o as u}from"../chunks/error-BotOd-nD.js";import"../chunks/readable-stream-CGuf8k1J.js";const b=e=>{if(e<3)return 0;const a=Math.floor(Math.log2(e)),t=1<<a;return t<3*(e-t)?a:a-1},C=(e,a)=>{const t=new Set,s=[e];for(;s.length>0;){const e=s.pop();if(t.has(e))continue;const n=a.get(e);t.add(e);for(const e of n.parents)t.has(e)||s.push(e)}return t.size},T=(e,a)=>{const t=2*e-a;return t>=-1&&t<=1},k=(e,a,t)=>{if(a.has(e.id)||1!==e.parents.length)return;const s=a.get(e.parents[0]);if(void 0===s)return;const n=s+1;return a.set(e.id,n),T(n,t)?{nextCommit:e.id,candidateCount:t,reaches:n}:null},S=async(e,t)=>{const s=await a(e,t);if("commit"!==s.type)throw f(`bisectMidpoint: ${t} is not a commit`);return{date:s.data.committer.timestamp,parents:s.data.parents}},R=(e,a)=>e.date>a.date||e.date===a.date&&e.ins<a.ins,I=async(e,a,t)=>{const s=await(async(e,a)=>{const t=new Map,s=[...a];let n=0;for(;n<s.length;){const a=s[n++];if(t.has(a))continue;const r=await S(e,a);t.set(a,r);for(const e of r.parents)t.has(e)||s.push(e)}return t})(e,a),n=await(async(e,a,t)=>{const s=(e=>{const a=new Map;return async t=>{const s=a.get(t);if(void 0!==s)return s;const n=await S(e,t);return a.set(t,n),n}})(e),n=await s(a);if(t.has(a))return[];const r=await(async(e,a,t,s)=>{let n=0;const r=new Set,o=[],c=new i(R);for(c.push({id:a,date:t,ins:n++});c.size()>0;){const{id:a}=c.pop();if(r.has(a))continue;r.add(a);const t=await e(a);o.push({id:a,date:t.date,parents:t.parents});for(const a of t.parents){if(r.has(a)||s.has(a))continue;const t=await e(a);c.push({id:a,date:t.date,ins:n++})}}return o})(s,a,n.date,t);return(e=>{const a=new Set;for(const t of e)a.add(t.id);return e.slice().reverse().map(e=>({id:e.id,parents:e.parents.filter(e=>a.has(e)),date:e.date}))})(r)})(e,t,s),r=(e=>{if(0===e.length)return;const a=e.length,t=new Map(e.map(e=>[e.id,e])),s=new Map;((e,a)=>{for(const t of e)0===t.parents.length&&a.set(t.id,1)})(e,s);const n=((e,a,t,s)=>{for(const n of e){if(n.parents.length<2)continue;const e=C(n.id,a);if(t.set(n.id,e),T(e,s))return{nextCommit:n.id,candidateCount:s,reaches:e}}})(e,t,s,a);if(void 0!==n)return n;const r=((e,a,t)=>{let s=!0;for(;s;){s=!1;for(const n of e){const e=k(n,a,t);if(void 0!==e){if(null!==e)return e;s=!0}}}})(e,s,a);if(void 0!==r)return r;const o=((e,a,t)=>{const s=e[0],n=a.get(s.id);let r=s.id,o=Math.min(n,t-n),i=n;for(let s=1;s<e.length;s+=1){const n=e[s],c=a.get(n.id),d=Math.min(c,t-c);d>o&&(o=d,r=n.id,i=c)}return{id:r,weight:i}})(e,s,a);return{nextCommit:o.id,candidateCount:a,reaches:o.weight}})(n);return void 0===r?void 0:(e=>({nextCommit:e.nextCommit,candidateCount:e.candidateCount,remainingIfGood:e.candidateCount-e.reaches-1,remainingIfBad:e.reaches-1,remainingSteps:b(e.candidateCount)}))(r)},M=async(e,a)=>{if(e.signal?.aborted)throw u();if(0===a.length)return[];const t=await c(e),s=[...t.base],n=new Set,r=async e=>{for(const a of(e=>{const a=e.split("/");if(a.length<=1)return[];const t=[];for(let e=1;e<a.length;e+=1)t.push(a.slice(0,e).join("/"));return t})(e)){if(n.has(a))continue;n.add(a);const e=await t.loadDirRules(a);e.length>0&&s.push({basedir:a,rules:e,kind:"gitignore"})}},o=[];for(const t of a){if(e.signal?.aborted)throw u();await r(t.path);const a=l(s,t.path,!0===t.isDirectory);if("ignored"!==a.verdict||void 0===a.level||void 0===a.ruleIndex){o.push({path:t.path,ignored:!1});continue}const n=a.level.rules[a.ruleIndex];o.push(void 0!==n?{path:t.path,ignored:!0,source:{kind:a.level.kind??"gitignore",basedir:a.level.basedir,line:n.lineNumber,pattern:n.pattern}}:{path:t.path,ignored:!1})}return o};export{I as bisectMidpoint,M as isIgnored,a as readObject};
@@ -1,2 +1 @@
1
1
  const e=new TextEncoder,r=r=>((e=>{"bearer"===e.type&&(e=>{if(""===e)throw new TypeError("withAuth: token is empty")})(e.token),"basic"===e.type&&(e=>{if(e.includes(":"))throw new TypeError('withAuth: basic username must not contain ":"')})(e.username)})(r),t=>({request:async o=>{if(Object.keys(o.headers).some(e=>"authorization"===e.toLowerCase()))return t.request(o);const s=await(async(r,t)=>{if("bearer"===r.type)return`Bearer ${r.token}`;if("basic"===r.type)return`Basic ${(r=>{const t=e.encode(r);let o="";for(let e=0;e<t.byteLength;e+=1)o+=String.fromCharCode(t[e]??0);return btoa(o)})(`${r.username}:${r.password}`)}`;const o=await r.header(t);if(""===o||null==o)throw new TypeError("withAuth: custom returned empty value");return o})(r,o);return t.request(((e,r)=>({...e,headers:{...e.headers,authorization:r}}))(o,s))}})),t=new Set(["authorization","cookie","set-cookie","proxy-authorization"]),o=/^(access[_-]?token|api[_-]?key|password|secret|token|sig|signature)$/i,s=(e,r)=>{const o=r.map(e=>e.toLowerCase()),s={};for(const[r,n]of Object.entries(e)){const e=r.toLowerCase();t.has(e)||o.includes(e)||(s[r]=n)}return s},n=(e,r)=>{try{e.log(r)}catch{}},a=e=>e instanceof Error?e.message:String(e),i=e=>{const r=e.now??(()=>performance.now()),t=e.redactHeaders??[];return i=>({request:async c=>{const u=(e=>{let r;try{r=new URL(e)}catch{return e}const t=[];for(const e of r.searchParams.keys())o.test(e)&&t.push(e);for(const e of t)r.searchParams.delete(e);return r.toString()})(c.url),h=s(c.headers,t),m=r();n(e.logger,((e,r,t)=>({kind:"request",method:e.method,url:r,headers:t,bodyBytes:e.body?.byteLength??0}))(c,u,h));try{const o=await i.request(c),a=s(o.headers,t);return n(e.logger,((e,r,t,o)=>({kind:"response",statusCode:e.statusCode,url:r,elapsedMs:t,headers:o}))(o,u,r()-m,a)),o}catch(t){throw n(e.logger,((e,r,t)=>({kind:"error",url:e,elapsedMs:r,errorMessage:a(t)}))(u,r()-m,t)),t}}})},c=({error:e,response:r})=>{return r?!((t=r.statusCode)<429||t>429&&t<500||501===t||t>=600):!(e instanceof DOMException&&"AbortError"===e.name)&&void 0!==e;var t},u=e=>{if(e)try{e.cancel().catch(()=>{})}catch{}},h=(e,r)=>r?.aborted?Promise.reject(r.reason):0===e?Promise.resolve():new Promise((t,o)=>{let s;const n=()=>{void 0!==s&&clearTimeout(s),o(r?.reason)};s=setTimeout(()=>{r?.removeEventListener("abort",n),t()},e),r&&r.addEventListener("abort",n,{once:!0})}),m=(e,r)=>{const t=r.baseMs??250,o=r.jitter??.2,s=Math.min("exponential"===(r.backoff??"fixed")?t*2**(e-1):t,r.maxDelayMs??3e4),n=1-o+2*o*Math.random();return Math.floor(s*n)},d=async(e,r)=>{try{return{response:await e.request(r)}}catch(e){return{error:e}}},w=e=>{if(void 0!==e.response)return e.response;throw e.error},p=(e,r)=>{return void 0!==e.outcome.error&&(t=e.outcome.error)instanceof DOMException&&"AbortError"===t.name||!!e.isLast||!r((o=e.outcome,s=e.attempt,void 0!==o.response?{response:o.response,attempt:s}:{error:o.error,attempt:s}));var t,o,s},y=e=>{(e=>{(e=>{if(!Number.isFinite(e)||!Number.isInteger(e)||e<1||e>10)throw new RangeError("withRetry: attempts must be 1..10")})(e.attempts),(e=>{if(void 0!==e&&(!Number.isFinite(e)||e<0))throw new RangeError("withRetry: baseMs must be ≥ 0")})(e.baseMs),((e,r)=>{if(void 0===r)return;const t=e??250;if(!Number.isFinite(r)||r<t)throw new RangeError("withRetry: maxDelayMs must be ≥ baseMs")})(e.baseMs,e.maxDelayMs),(e=>{if(void 0!==e&&(!Number.isFinite(e)||e<0||e>1))throw new RangeError("withRetry: jitter must be in [0, 1]")})(e.jitter)})(e);const r=e.isRetryable??c,t=e.delay??h;return o=>({request:async s=>{if(s.signal?.aborted)throw s.signal.reason;let n={};for(let a=1;a<=e.attempts;a+=1){if(n=await d(o,s),p({attempt:a,isLast:a===e.attempts,outcome:n},r))return w(n);void 0!==n.response&&u(n.response.body),await t(m(a,e),s.signal)}return w(n)}})};export{r as withAuth,i as withLogging,y as withRetry};
2
- //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { c as Context, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, u as FileHandle, h as HashService, i as Hasher } from '../../chunks/context-D_A7-uau.cjs';
1
+ import { c as Context, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, y as FileHandle, h as HashService, i as Hasher } from '../../chunks/context-CF1YF2S8.cjs';
2
2
  import { b as HttpTransport, H as HttpRequest, a as HttpResponse } from '../../chunks/http-transport-DirKfK2S.cjs';
3
3
 
4
4
  interface BrowserAdapterOptions {
@@ -1,4 +1,4 @@
1
- import { c as Context, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, u as FileHandle, h as HashService, i as Hasher } from '../../chunks/context-CNtbFlwI.js';
1
+ import { c as Context, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, y as FileHandle, h as HashService, i as Hasher } from '../../chunks/context-sIhhtk2u.js';
2
2
  import { b as HttpTransport, H as HttpRequest, a as HttpResponse } from '../../chunks/http-transport-DirKfK2S.js';
3
3
 
4
4
  interface BrowserAdapterOptions {
@@ -1,4 +1,4 @@
1
- import { m as HookRunner, C as CommandRunner, e as EnvReader, c as Context, v as CommandRequest, x as CommandResult, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, u as FileHandle, h as HashService, i as Hasher, j as HookName, l as HookResult, k as HookRequest } from '../../chunks/context-D_A7-uau.cjs';
1
+ import { m as HookRunner, C as CommandRunner, e as EnvReader, c as Context, z as CommandRequest, B as CommandResult, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, y as FileHandle, h as HashService, i as Hasher, j as HookName, l as HookResult, k as HookRequest } from '../../chunks/context-CF1YF2S8.cjs';
2
2
  import { b as HttpTransport, H as HttpRequest, a as HttpResponse } from '../../chunks/http-transport-DirKfK2S.cjs';
3
3
 
4
4
  interface MemoryAdapterOptions {
@@ -1,4 +1,4 @@
1
- import { m as HookRunner, C as CommandRunner, e as EnvReader, c as Context, v as CommandRequest, x as CommandResult, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, u as FileHandle, h as HashService, i as Hasher, j as HookName, l as HookResult, k as HookRequest } from '../../chunks/context-CNtbFlwI.js';
1
+ import { m as HookRunner, C as CommandRunner, e as EnvReader, c as Context, z as CommandRequest, B as CommandResult, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, y as FileHandle, h as HashService, i as Hasher, j as HookName, l as HookResult, k as HookRequest } from '../../chunks/context-sIhhtk2u.js';
2
2
  import { b as HttpTransport, H as HttpRequest, a as HttpResponse } from '../../chunks/http-transport-DirKfK2S.js';
3
3
 
4
4
  interface MemoryAdapterOptions {
@@ -1,4 +1,4 @@
1
- import { c as Context, C as CommandRunner, v as CommandRequest, x as CommandResult, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, u as FileHandle, h as HashService, i as Hasher, m as HookRunner, k as HookRequest, l as HookResult } from '../../chunks/context-D_A7-uau.cjs';
1
+ import { c as Context, C as CommandRunner, z as CommandRequest, B as CommandResult, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, y as FileHandle, h as HashService, i as Hasher, m as HookRunner, k as HookRequest, l as HookResult } from '../../chunks/context-CF1YF2S8.cjs';
2
2
  import { b as HttpTransport, H as HttpRequest, a as HttpResponse } from '../../chunks/http-transport-DirKfK2S.cjs';
3
3
 
4
4
  interface NodeAdapterOptions {
@@ -21,6 +21,13 @@ interface NodeAdapterOptions {
21
21
  * `[merge "<driver>"].driver` shell command with the full `process.env`.
22
22
  */
23
23
  readonly command?: boolean;
24
+ /**
25
+ * Wire the ssh transport (default true). Pass `false` to refuse ssh/scp
26
+ * remotes. A wired transport spawns the resolved ssh command
27
+ * (`GIT_SSH_COMMAND`/`GIT_SSH`/`core.sshCommand`, else `ssh`) inheriting
28
+ * the full `process.env`.
29
+ */
30
+ readonly ssh?: boolean;
24
31
  }
25
32
  declare function createNodeContext(options: NodeAdapterOptions): Context;
26
33
 
@@ -142,57 +149,81 @@ declare class NodeFileSystem implements FileSystem {
142
149
  private readonly fsOps;
143
150
  /**
144
151
  * Memoised realpath of an *existing* parent directory, keyed by the raw
145
- * (pre-realpath) parent path. Populated on every cache-miss inside
146
- * `resolveForCreation` so a clone/checkout that writes N files into the
147
- * same tree pays the realpath walk-up once per parent rather than once
148
- * per file.
152
+ * (pre-realpath) parent path, paired with that parent's containment
153
+ * verdict (`isContainedInEitherRoot(realParent, …)`, computed once right
154
+ * after the realpath resolves). The cached value is mode-independent, so
155
+ * this single cache serves BOTH `resolveForCreation` (creation mode) and
156
+ * `resolveForMode`'s lstat arm (lstat mode): a clone/checkout writing N
157
+ * files into the same tree, or a status walk lstat-ing N entries under
158
+ * the same directory, pays the realpath walk-up — and, for the lstat
159
+ * arm, the containment POST-check — once per parent rather than once per
160
+ * file/entry. The verdict is a per-clean-leaf equivalence
161
+ * (`isContainedInEitherRoot(join(realParent, basename))` ≡
162
+ * `isContainedInEitherRoot(realParent)`, see the design doc's proof) and
163
+ * is consulted ONLY by the lstat arm; `read`/`creation` realpath the full
164
+ * leaf and keep their own per-entry post-check.
149
165
  *
150
166
  * Invariants:
151
167
  * - Only EXISTING parents are cached. ENOENT walks fall back to
152
- * `realpathNearestExisting` and are never recorded.
153
- * - `rmRecursive` and `rename` clear the cache, which is correct (the
154
- * parent realpath may have changed) and cheap (the cache holds at
155
- * most a handful of small strings).
168
+ * `realpathNearestExisting` (creation) or propagate (lstat) and are
169
+ * never recorded.
170
+ * - The realpath and the verdict are set together never divergent.
171
+ * - `rmRecursive` and `rename` clear the cache (invalidating BOTH the
172
+ * realpath and the verdict), which is correct (the parent realpath may
173
+ * have changed) and cheap relative to a re-walk. `rm` clears neither —
174
+ * a leaf removal does not change the parent's realpath or containment.
175
+ * - Sized to exceed the 256 loose-object fanout directories so a
176
+ * full-history walk does not thrash the cache.
156
177
  */
157
- private readonly creationParentCache;
178
+ private readonly parentRealpathCache;
158
179
  /**
159
- * Lazy long-name canonicalisation of `rootDir` for containment checks.
160
- * Promise so concurrent first calls share one `realpath`; cleared on
161
- * rejection so a transient ENOENT can be retried.
180
+ * Lazy long-name canonicalisation of `rootDir` for containment checks,
181
+ * resolving to the canonical root's `RootPrefix`. Promise so concurrent
182
+ * first calls share one `realpath`; cleared on rejection so a transient
183
+ * ENOENT can be retried.
162
184
  */
163
185
  private canonicalRootPromise;
164
186
  /**
165
- * Memoised result of `pathPolicy.normalizeForCompare(rootDir)`. The
166
- * rootDir is `readonly` for the adapter's lifetime, so a single
167
- * normalisation is amortised across every containment check.
187
+ * Synchronous cache of the resolved canonical-root `RootPrefix`, set on
188
+ * `getCanonicalRoot()`'s promise-resolution arm and cleared on its
189
+ * rejection arm always in lockstep with `canonicalRootPromise`. Lets
190
+ * hot-path callers (`checkContainment`, `exists`, `symlink`) read the
191
+ * settled value directly, without an `await` (and its microtask), once
192
+ * the root has resolved at least once.
168
193
  */
169
- private normalizedRootDir;
194
+ private resolvedCanonicalRootPrefix;
170
195
  /**
171
- * Memoised result of `pathPolicy.normalizeForCompare(canonicalRoot)`.
172
- * Tracked alongside the canonical-root promise: when the promise
173
- * resolves we cache the normalised form once. The promise's
174
- * rejection-clears-cache rule means a transient ENOENT also clears
175
- * this field (so the next call re-normalises against the retried
176
- * canonical root).
196
+ * Memoised `{ normalized, withSep }` pair for `pathPolicy.normalizeForCompare(rootDir)`.
197
+ * The rootDir is `readonly` for the adapter's lifetime, so a single
198
+ * normalisation (and its `+sep` prefix) is amortised across every
199
+ * containment check. Bundled in one field never two — so the prefix
200
+ * can never diverge from the root it was derived from.
177
201
  */
178
- private normalizedCanonicalRoot;
202
+ private normalizedRootDirPrefix;
179
203
  constructor(rootDir: string, pathPolicy?: PathPolicy, fsOps?: FsOperations);
204
+ /**
205
+ * Lazily normalises `rootDir` and its `+sep` prefix as one bundled
206
+ * `RootPrefix`, memoised for the adapter's lifetime.
207
+ */
208
+ private getRootDirPrefix;
180
209
  private getNormalizedRootDir;
181
210
  /**
182
- * Returns the cached normalised canonical root. Caller must have
183
- * `await this.getCanonicalRoot()` immediately prior the cache is
184
- * populated by the promise's success arm and cleared on rejection, so
185
- * a successful `await` guarantees the field is set.
186
- *
187
- * Kept synchronous (vs `async` + `await this.getCanonicalRoot()`
188
- * inside) so the hot path doesn't pay an extra microtask suspension
189
- * per containment check on a settled promise. The `!` is the only
190
- * machine-readable form of "trust the post-await invariant"; the
191
- * private `await getCanonicalRoot()` discipline at every call site is
192
- * what makes it safe.
211
+ * Resolves and memoises the canonical-root `RootPrefix`. Returns the
212
+ * bundled `{ normalized, withSep }` value directly from the promise
213
+ * chain callers thread the returned value onward, so there is no
214
+ * synchronous "trust it's been set" field read: the type system proves
215
+ * the value is defined via the `await`'s return, not a nullable field.
193
216
  */
194
- private getResolvedNormalizedCanonicalRoot;
195
217
  private getCanonicalRoot;
218
+ /**
219
+ * Synchronous-first-path accessor for the canonical root: returns the
220
+ * already-settled `resolvedCanonicalRootPrefix` field when populated (no
221
+ * `await`, no microtask), falling back to `getCanonicalRoot()` only on
222
+ * the first call or after a rejection cleared the field. Used by every
223
+ * hot-path call site (`checkContainment`, `exists`, `symlink`) instead of
224
+ * an unconditional `await this.getCanonicalRoot()`.
225
+ */
226
+ private resolveCanonicalRoot;
196
227
  read: (path: string) => Promise<Uint8Array>;
197
228
  readSlice: (path: string, offset: number, length: number) => Promise<Uint8Array>;
198
229
  readUtf8: (path: string) => Promise<string>;
@@ -216,8 +247,35 @@ declare class NodeFileSystem implements FileSystem {
216
247
  private isSymlinkLeaf;
217
248
  private removeTree;
218
249
  private resolveForCreation;
250
+ private cachedParentRealpath;
219
251
  private realpathForCreation;
252
+ /**
253
+ * Resolves `resolved` to its real, containment-checkable form. `contained`
254
+ * is `undefined` for `read`/`creation` — those arms realpath a full leaf,
255
+ * so `checkContainment` still runs its own per-entry POST-check on the
256
+ * returned `real`. For `lstat`, `contained` carries the per-parent
257
+ * verdict `cachedParentRealpath` already computed (once per parent,
258
+ * proven verdict-identical to a per-entry check for a single clean leaf)
259
+ * — `checkContainment` consults it directly instead of re-normalising.
260
+ */
220
261
  private resolveForMode;
262
+ /**
263
+ * `abs` is normalised ONCE (not once per root) and compared against
264
+ * both roots' precomputed `+sep` prefixes. Both the `=== root` equality
265
+ * arm and the `startsWith(root + sep)` prefix arm are retained per
266
+ * root — dropping either changes the verdict (a bare `startsWith(root)`
267
+ * would admit the prefix-only sibling `root-evil`). Both roots are
268
+ * passed in as already-resolved `RootPrefix` values — no field read-back.
269
+ */
270
+ private isContainedInEitherRoot;
271
+ /**
272
+ * Single source of truth for the two-root, two-arm containment test —
273
+ * `isContainedInEitherRoot` and the lstat arm's PRE-check both delegate
274
+ * here so the "is `abs` exactly one of the roots" fact (needed by the
275
+ * lstat arm's exact-root shortcut) is derived from the SAME normalise
276
+ * call as the containment verdict, not a second one.
277
+ */
278
+ private containmentVerdict;
221
279
  private checkContainment;
222
280
  homedir(): string;
223
281
  xdgConfigHome(): string;
@@ -1,4 +1,4 @@
1
- import { c as Context, C as CommandRunner, v as CommandRequest, x as CommandResult, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, u as FileHandle, h as HashService, i as Hasher, m as HookRunner, k as HookRequest, l as HookResult } from '../../chunks/context-CNtbFlwI.js';
1
+ import { c as Context, C as CommandRunner, z as CommandRequest, B as CommandResult, a as Compressor, I as InflateStreamResult, g as FileSystem, f as FileStat, D as DirEntry, y as FileHandle, h as HashService, i as Hasher, m as HookRunner, k as HookRequest, l as HookResult } from '../../chunks/context-sIhhtk2u.js';
2
2
  import { b as HttpTransport, H as HttpRequest, a as HttpResponse } from '../../chunks/http-transport-DirKfK2S.js';
3
3
 
4
4
  interface NodeAdapterOptions {
@@ -21,6 +21,13 @@ interface NodeAdapterOptions {
21
21
  * `[merge "<driver>"].driver` shell command with the full `process.env`.
22
22
  */
23
23
  readonly command?: boolean;
24
+ /**
25
+ * Wire the ssh transport (default true). Pass `false` to refuse ssh/scp
26
+ * remotes. A wired transport spawns the resolved ssh command
27
+ * (`GIT_SSH_COMMAND`/`GIT_SSH`/`core.sshCommand`, else `ssh`) inheriting
28
+ * the full `process.env`.
29
+ */
30
+ readonly ssh?: boolean;
24
31
  }
25
32
  declare function createNodeContext(options: NodeAdapterOptions): Context;
26
33
 
@@ -142,57 +149,81 @@ declare class NodeFileSystem implements FileSystem {
142
149
  private readonly fsOps;
143
150
  /**
144
151
  * Memoised realpath of an *existing* parent directory, keyed by the raw
145
- * (pre-realpath) parent path. Populated on every cache-miss inside
146
- * `resolveForCreation` so a clone/checkout that writes N files into the
147
- * same tree pays the realpath walk-up once per parent rather than once
148
- * per file.
152
+ * (pre-realpath) parent path, paired with that parent's containment
153
+ * verdict (`isContainedInEitherRoot(realParent, …)`, computed once right
154
+ * after the realpath resolves). The cached value is mode-independent, so
155
+ * this single cache serves BOTH `resolveForCreation` (creation mode) and
156
+ * `resolveForMode`'s lstat arm (lstat mode): a clone/checkout writing N
157
+ * files into the same tree, or a status walk lstat-ing N entries under
158
+ * the same directory, pays the realpath walk-up — and, for the lstat
159
+ * arm, the containment POST-check — once per parent rather than once per
160
+ * file/entry. The verdict is a per-clean-leaf equivalence
161
+ * (`isContainedInEitherRoot(join(realParent, basename))` ≡
162
+ * `isContainedInEitherRoot(realParent)`, see the design doc's proof) and
163
+ * is consulted ONLY by the lstat arm; `read`/`creation` realpath the full
164
+ * leaf and keep their own per-entry post-check.
149
165
  *
150
166
  * Invariants:
151
167
  * - Only EXISTING parents are cached. ENOENT walks fall back to
152
- * `realpathNearestExisting` and are never recorded.
153
- * - `rmRecursive` and `rename` clear the cache, which is correct (the
154
- * parent realpath may have changed) and cheap (the cache holds at
155
- * most a handful of small strings).
168
+ * `realpathNearestExisting` (creation) or propagate (lstat) and are
169
+ * never recorded.
170
+ * - The realpath and the verdict are set together never divergent.
171
+ * - `rmRecursive` and `rename` clear the cache (invalidating BOTH the
172
+ * realpath and the verdict), which is correct (the parent realpath may
173
+ * have changed) and cheap relative to a re-walk. `rm` clears neither —
174
+ * a leaf removal does not change the parent's realpath or containment.
175
+ * - Sized to exceed the 256 loose-object fanout directories so a
176
+ * full-history walk does not thrash the cache.
156
177
  */
157
- private readonly creationParentCache;
178
+ private readonly parentRealpathCache;
158
179
  /**
159
- * Lazy long-name canonicalisation of `rootDir` for containment checks.
160
- * Promise so concurrent first calls share one `realpath`; cleared on
161
- * rejection so a transient ENOENT can be retried.
180
+ * Lazy long-name canonicalisation of `rootDir` for containment checks,
181
+ * resolving to the canonical root's `RootPrefix`. Promise so concurrent
182
+ * first calls share one `realpath`; cleared on rejection so a transient
183
+ * ENOENT can be retried.
162
184
  */
163
185
  private canonicalRootPromise;
164
186
  /**
165
- * Memoised result of `pathPolicy.normalizeForCompare(rootDir)`. The
166
- * rootDir is `readonly` for the adapter's lifetime, so a single
167
- * normalisation is amortised across every containment check.
187
+ * Synchronous cache of the resolved canonical-root `RootPrefix`, set on
188
+ * `getCanonicalRoot()`'s promise-resolution arm and cleared on its
189
+ * rejection arm always in lockstep with `canonicalRootPromise`. Lets
190
+ * hot-path callers (`checkContainment`, `exists`, `symlink`) read the
191
+ * settled value directly, without an `await` (and its microtask), once
192
+ * the root has resolved at least once.
168
193
  */
169
- private normalizedRootDir;
194
+ private resolvedCanonicalRootPrefix;
170
195
  /**
171
- * Memoised result of `pathPolicy.normalizeForCompare(canonicalRoot)`.
172
- * Tracked alongside the canonical-root promise: when the promise
173
- * resolves we cache the normalised form once. The promise's
174
- * rejection-clears-cache rule means a transient ENOENT also clears
175
- * this field (so the next call re-normalises against the retried
176
- * canonical root).
196
+ * Memoised `{ normalized, withSep }` pair for `pathPolicy.normalizeForCompare(rootDir)`.
197
+ * The rootDir is `readonly` for the adapter's lifetime, so a single
198
+ * normalisation (and its `+sep` prefix) is amortised across every
199
+ * containment check. Bundled in one field never two — so the prefix
200
+ * can never diverge from the root it was derived from.
177
201
  */
178
- private normalizedCanonicalRoot;
202
+ private normalizedRootDirPrefix;
179
203
  constructor(rootDir: string, pathPolicy?: PathPolicy, fsOps?: FsOperations);
204
+ /**
205
+ * Lazily normalises `rootDir` and its `+sep` prefix as one bundled
206
+ * `RootPrefix`, memoised for the adapter's lifetime.
207
+ */
208
+ private getRootDirPrefix;
180
209
  private getNormalizedRootDir;
181
210
  /**
182
- * Returns the cached normalised canonical root. Caller must have
183
- * `await this.getCanonicalRoot()` immediately prior the cache is
184
- * populated by the promise's success arm and cleared on rejection, so
185
- * a successful `await` guarantees the field is set.
186
- *
187
- * Kept synchronous (vs `async` + `await this.getCanonicalRoot()`
188
- * inside) so the hot path doesn't pay an extra microtask suspension
189
- * per containment check on a settled promise. The `!` is the only
190
- * machine-readable form of "trust the post-await invariant"; the
191
- * private `await getCanonicalRoot()` discipline at every call site is
192
- * what makes it safe.
211
+ * Resolves and memoises the canonical-root `RootPrefix`. Returns the
212
+ * bundled `{ normalized, withSep }` value directly from the promise
213
+ * chain callers thread the returned value onward, so there is no
214
+ * synchronous "trust it's been set" field read: the type system proves
215
+ * the value is defined via the `await`'s return, not a nullable field.
193
216
  */
194
- private getResolvedNormalizedCanonicalRoot;
195
217
  private getCanonicalRoot;
218
+ /**
219
+ * Synchronous-first-path accessor for the canonical root: returns the
220
+ * already-settled `resolvedCanonicalRootPrefix` field when populated (no
221
+ * `await`, no microtask), falling back to `getCanonicalRoot()` only on
222
+ * the first call or after a rejection cleared the field. Used by every
223
+ * hot-path call site (`checkContainment`, `exists`, `symlink`) instead of
224
+ * an unconditional `await this.getCanonicalRoot()`.
225
+ */
226
+ private resolveCanonicalRoot;
196
227
  read: (path: string) => Promise<Uint8Array>;
197
228
  readSlice: (path: string, offset: number, length: number) => Promise<Uint8Array>;
198
229
  readUtf8: (path: string) => Promise<string>;
@@ -216,8 +247,35 @@ declare class NodeFileSystem implements FileSystem {
216
247
  private isSymlinkLeaf;
217
248
  private removeTree;
218
249
  private resolveForCreation;
250
+ private cachedParentRealpath;
219
251
  private realpathForCreation;
252
+ /**
253
+ * Resolves `resolved` to its real, containment-checkable form. `contained`
254
+ * is `undefined` for `read`/`creation` — those arms realpath a full leaf,
255
+ * so `checkContainment` still runs its own per-entry POST-check on the
256
+ * returned `real`. For `lstat`, `contained` carries the per-parent
257
+ * verdict `cachedParentRealpath` already computed (once per parent,
258
+ * proven verdict-identical to a per-entry check for a single clean leaf)
259
+ * — `checkContainment` consults it directly instead of re-normalising.
260
+ */
220
261
  private resolveForMode;
262
+ /**
263
+ * `abs` is normalised ONCE (not once per root) and compared against
264
+ * both roots' precomputed `+sep` prefixes. Both the `=== root` equality
265
+ * arm and the `startsWith(root + sep)` prefix arm are retained per
266
+ * root — dropping either changes the verdict (a bare `startsWith(root)`
267
+ * would admit the prefix-only sibling `root-evil`). Both roots are
268
+ * passed in as already-resolved `RootPrefix` values — no field read-back.
269
+ */
270
+ private isContainedInEitherRoot;
271
+ /**
272
+ * Single source of truth for the two-root, two-arm containment test —
273
+ * `isContainedInEitherRoot` and the lstat arm's PRE-check both delegate
274
+ * here so the "is `abs` exactly one of the roots" fact (needed by the
275
+ * lstat arm's exact-root shortcut) is derived from the SAME normalise
276
+ * call as the containment verdict, not a second one.
277
+ */
278
+ private containmentVerdict;
221
279
  private checkContainment;
222
280
  homedir(): string;
223
281
  xdgConfigHome(): string;
@@ -448,6 +448,43 @@ interface PromisorRemote {
448
448
  fetch(oids: ReadonlyArray<ObjectId>): Promise<PromisorFetchOutcome>;
449
449
  }
450
450
 
451
+ /**
452
+ * Request to open one SSH duplex channel. `command`/`args` are the fully
453
+ * resolved ssh program and argv (host token, `-p` flag, sq-quoted remote
454
+ * command) — the adapter performs no faithfulness logic of its own.
455
+ */
456
+ interface SshSpawnRequest {
457
+ /** Resolved ssh program (e.g. `ssh`, or a `GIT_SSH`/`core.sshCommand` override). */
458
+ readonly command: string;
459
+ /** Full argv, incl. host token and remote-command token. */
460
+ readonly args: ReadonlyArray<string>;
461
+ /** Additions merged OVER the parent process environment by the adapter. */
462
+ readonly env: Readonly<Record<string, string>>;
463
+ readonly signal?: AbortSignal;
464
+ }
465
+ /**
466
+ * One live SSH duplex channel — a thin process bridge. Stream shapes mirror
467
+ * `HttpTransport`: web streams in, web streams out.
468
+ */
469
+ interface SshChannel {
470
+ /** Request bytes written to the server. */
471
+ readonly stdin: WritableStream<Uint8Array>;
472
+ /** Advertisement + response bytes read from the server. */
473
+ readonly stdout: ReadableStream<Uint8Array>;
474
+ /** Resolves with the ssh process's exit code. */
475
+ readonly exit: Promise<number>;
476
+ /** Idempotent teardown — kills the child process. */
477
+ readonly close: () => Promise<void>;
478
+ }
479
+ /**
480
+ * Thin duplex process spawner. Knows nothing about git — argv building,
481
+ * quoting, and command resolution are pure application-tier concerns tested
482
+ * independently of this port.
483
+ */
484
+ interface SshTransport {
485
+ readonly open: (req: SshSpawnRequest) => Promise<SshChannel>;
486
+ }
487
+
451
488
  /**
452
489
  * Repository physical layout — where the working tree and.git directory live.
453
490
  * Renamed in from the previous `RepositoryConfig` (port-tier) to free that
@@ -544,6 +581,8 @@ interface Context {
544
581
  readonly layout: RepositoryLayout;
545
582
  /** User-supplied working directory (may be a sub-path of layout.workDir). Defaults to layout.workDir when not set by the facade. */
546
583
  readonly cwd: string;
584
+ /** The runtime this context was built for — names the adapter set in refusal messages. */
585
+ readonly runtime: 'node' | 'browser' | 'memory';
547
586
  /** Object serialization parameters (sha1 vs sha256 digest+hex sizes). */
548
587
  readonly hashConfig: HashConfig;
549
588
  /** Shared delta-base LRU cache; consumed by primitives' iterative delta walker. */
@@ -567,6 +606,11 @@ interface Context {
567
606
  * memory, where there is no process env). Notes-ref selection reads GIT_NOTES_REF through it.
568
607
  */
569
608
  readonly env?: EnvReader;
609
+ /**
610
+ * Optional SSH transport. Absent ⇒ ssh/scp remotes refuse — browser/memory
611
+ * cannot spawn a process.
612
+ */
613
+ readonly ssh?: SshTransport;
570
614
  /**
571
615
  * Optional promisor-remote capability. Populated by `openRepository`;
572
616
  * `readObject` consults it to lazy-fetch an object a partial clone omitted.
@@ -590,6 +634,7 @@ interface CreateContextParts {
590
634
  readonly progress: ProgressReporter;
591
635
  readonly layout: RepositoryLayout;
592
636
  readonly cwd?: string;
637
+ readonly runtime: 'node' | 'browser' | 'memory';
593
638
  readonly hashConfig: HashConfig;
594
639
  readonly deltaCache: LruCache<Uint8Array>;
595
640
  readonly config?: RepositoryConfig;
@@ -598,9 +643,10 @@ interface CreateContextParts {
598
643
  readonly hooks?: HookRunner;
599
644
  readonly command?: CommandRunner;
600
645
  readonly env?: EnvReader;
646
+ readonly ssh?: SshTransport;
601
647
  }
602
648
  /** Assemble a frozen Context from its constituent ports + layout. */
603
649
  declare function createContext(parts: CreateContextParts): Context;
604
650
 
605
- export { EMPTY_TREE_OID as E, FilePath as F, ObjectId as O, RefName as R, SHA1_CONFIG as S, ZERO_OID as Z, SHA256_CONFIG as r, createContext as s, noopLogger as t, wrapLoggerSanitizer as w };
606
- export type { AuthStrategy as A, CommandRunner as C, DirEntry as D, HashConfig as H, InflateStreamResult as I, Logger as L, ProgressReporter as P, Compressor as a, AuthorIdentity as b, Context as c, CreateContextParts as d, EnvReader as e, FileStat as f, FileSystem as g, HashService as h, Hasher as i, HookName as j, HookRequest as k, HookResult as l, HookRunner as m, PromisorFetchOutcome as n, PromisorRemote as o, RepositoryConfig as p, RepositoryLayout as q, FileHandle as u, CommandRequest as v, CommandResult as x };
651
+ export { EMPTY_TREE_OID as E, FilePath as F, ObjectId as O, RefName as R, SHA1_CONFIG as S, ZERO_OID as Z, SHA256_CONFIG as r, createContext as v, noopLogger as w, wrapLoggerSanitizer as x };
652
+ export type { AuthStrategy as A, CommandResult as B, CommandRunner as C, DirEntry as D, HashConfig as H, InflateStreamResult as I, Logger as L, ProgressReporter as P, Compressor as a, AuthorIdentity as b, Context as c, CreateContextParts as d, EnvReader as e, FileStat as f, FileSystem as g, HashService as h, Hasher as i, HookName as j, HookRequest as k, HookResult as l, HookRunner as m, PromisorFetchOutcome as n, PromisorRemote as o, RepositoryConfig as p, RepositoryLayout as q, SshChannel as s, SshSpawnRequest as t, SshTransport as u, FileHandle as y, CommandRequest as z };