@amalgm/shell 0.1.164-main.40070365614 → 0.1.164-main.40795482467

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 (319) hide show
  1. package/dist/accepted-fold.d.ts +24 -46
  2. package/dist/accepted-fold.js +62 -140
  3. package/dist/accepted-fold.js.map +1 -1
  4. package/dist/accepted-tail.d.ts +3 -3
  5. package/dist/accepted-tail.js +6 -6
  6. package/dist/accepted-tail.js.map +1 -1
  7. package/dist/apply-control.d.ts +9 -4
  8. package/dist/apply-control.js +18 -5
  9. package/dist/apply-control.js.map +1 -1
  10. package/dist/apply-enter-build.d.ts +6 -7
  11. package/dist/apply-enter-build.js +4 -10
  12. package/dist/apply-enter-build.js.map +1 -1
  13. package/dist/apply-enter-plan.d.ts +9 -7
  14. package/dist/apply-enter-plan.js +40 -27
  15. package/dist/apply-enter-plan.js.map +1 -1
  16. package/dist/apply-local-work.d.ts +8 -20
  17. package/dist/apply-local-work.js +18 -95
  18. package/dist/apply-local-work.js.map +1 -1
  19. package/dist/apply-showing.d.ts +15 -1
  20. package/dist/apply-showing.js +26 -4
  21. package/dist/apply-showing.js.map +1 -1
  22. package/dist/apply-window-ground.d.ts +7 -9
  23. package/dist/apply-window-ground.js +16 -11
  24. package/dist/apply-window-ground.js.map +1 -1
  25. package/dist/apply-window-host.d.ts +29 -4
  26. package/dist/apply-window-host.js +212 -280
  27. package/dist/apply-window-host.js.map +1 -1
  28. package/dist/apply-window-line.d.ts +2 -1
  29. package/dist/apply-window-line.js +5 -4
  30. package/dist/apply-window-line.js.map +1 -1
  31. package/dist/apply-window-recovery.js +18 -30
  32. package/dist/apply-window-recovery.js.map +1 -1
  33. package/dist/apply-window-reveal.d.ts +0 -7
  34. package/dist/apply-window-reveal.js +5 -48
  35. package/dist/apply-window-reveal.js.map +1 -1
  36. package/dist/apply-window-rows.d.ts +1 -24
  37. package/dist/apply-window-rows.js.map +1 -1
  38. package/dist/apply-window-saves.d.ts +16 -9
  39. package/dist/apply-window-saves.js +65 -19
  40. package/dist/apply-window-saves.js.map +1 -1
  41. package/dist/apply-window-store.d.ts +6 -6
  42. package/dist/apply-window-store.js +7 -4
  43. package/dist/apply-window-store.js.map +1 -1
  44. package/dist/apply-window-verify.d.ts +4 -7
  45. package/dist/apply-window-verify.js +4 -23
  46. package/dist/apply-window-verify.js.map +1 -1
  47. package/dist/baseline-content.d.ts +3 -5
  48. package/dist/baseline-content.js +7 -44
  49. package/dist/baseline-content.js.map +1 -1
  50. package/dist/content-cache-retention.d.ts +3 -2
  51. package/dist/content-cache-retention.js +11 -11
  52. package/dist/content-cache-retention.js.map +1 -1
  53. package/dist/content-capture-pool.d.ts +4 -47
  54. package/dist/content-capture-pool.js +3 -42
  55. package/dist/content-capture-pool.js.map +1 -1
  56. package/dist/content-capture-worker.d.ts +2 -3
  57. package/dist/content-capture-worker.js +2 -19
  58. package/dist/content-capture-worker.js.map +1 -1
  59. package/dist/declaration-absorption.d.ts +9 -15
  60. package/dist/declaration-absorption.js +14 -32
  61. package/dist/declaration-absorption.js.map +1 -1
  62. package/dist/declaration-commit.d.ts +0 -5
  63. package/dist/declaration-commit.js +1 -6
  64. package/dist/declaration-commit.js.map +1 -1
  65. package/dist/declaration-save.d.ts +0 -4
  66. package/dist/declaration-save.js +0 -4
  67. package/dist/declaration-save.js.map +1 -1
  68. package/dist/detection/accepted-result.js +1 -1
  69. package/dist/detection/accepted-result.js.map +1 -1
  70. package/dist/detection/admission-save.d.ts +7 -17
  71. package/dist/detection/admission-save.js +4 -11
  72. package/dist/detection/admission-save.js.map +1 -1
  73. package/dist/detection/admission-units.d.ts +10 -26
  74. package/dist/detection/admission-units.js +12 -50
  75. package/dist/detection/admission-units.js.map +1 -1
  76. package/dist/detection/apply-ownership.d.ts +2 -2
  77. package/dist/detection/apply-ownership.js +2 -7
  78. package/dist/detection/apply-ownership.js.map +1 -1
  79. package/dist/detection/capture-outcome.js +12 -19
  80. package/dist/detection/capture-outcome.js.map +1 -1
  81. package/dist/detection/dispositions.d.ts +1 -1
  82. package/dist/detection/dispositions.js +3 -4
  83. package/dist/detection/dispositions.js.map +1 -1
  84. package/dist/detection/ground-proof.d.ts +1 -3
  85. package/dist/detection/ground-proof.js +0 -9
  86. package/dist/detection/ground-proof.js.map +1 -1
  87. package/dist/detection/ground-reader.d.ts +1 -5
  88. package/dist/detection/ground-reader.js +1 -31
  89. package/dist/detection/ground-reader.js.map +1 -1
  90. package/dist/detection/notebook-basis.d.ts +1 -2
  91. package/dist/detection/notebook-basis.js +2 -4
  92. package/dist/detection/notebook-basis.js.map +1 -1
  93. package/dist/detection/owed-selection.d.ts +2 -3
  94. package/dist/detection/owed-selection.js +3 -6
  95. package/dist/detection/owed-selection.js.map +1 -1
  96. package/dist/detection/portable.d.ts +7 -48
  97. package/dist/detection/portable.js +46 -155
  98. package/dist/detection/portable.js.map +1 -1
  99. package/dist/detection/repository-state.d.ts +35 -0
  100. package/dist/detection/repository-state.js +51 -0
  101. package/dist/detection/repository-state.js.map +1 -0
  102. package/dist/detection/root-examination.d.ts +1 -11
  103. package/dist/detection/root-examination.js +69 -127
  104. package/dist/detection/root-examination.js.map +1 -1
  105. package/dist/detection/runtime.d.ts +8 -32
  106. package/dist/detection/runtime.js +36 -140
  107. package/dist/detection/runtime.js.map +1 -1
  108. package/dist/detection/scope-frame.d.ts +32 -62
  109. package/dist/detection/scope-frame.js +139 -214
  110. package/dist/detection/scope-frame.js.map +1 -1
  111. package/dist/detection/scoped-identity-port.d.ts +1 -1
  112. package/dist/detection/scoped-identity-port.js +3 -4
  113. package/dist/detection/scoped-identity-port.js.map +1 -1
  114. package/dist/detection/walk-law.d.ts +3 -11
  115. package/dist/detection/walk-law.js +5 -9
  116. package/dist/detection/walk-law.js.map +1 -1
  117. package/dist/git/ground-owners.d.ts +8 -0
  118. package/dist/git/ground-owners.js +25 -0
  119. package/dist/git/ground-owners.js.map +1 -0
  120. package/dist/git/home.d.ts +39 -0
  121. package/dist/git/home.js +81 -0
  122. package/dist/git/home.js.map +1 -0
  123. package/dist/git/marker.d.ts +21 -0
  124. package/dist/git/marker.js +30 -0
  125. package/dist/git/marker.js.map +1 -0
  126. package/dist/git/objects.d.ts +42 -0
  127. package/dist/git/objects.js +144 -0
  128. package/dist/git/objects.js.map +1 -0
  129. package/dist/git/rail.d.ts +90 -0
  130. package/dist/git/rail.js +341 -0
  131. package/dist/git/rail.js.map +1 -0
  132. package/dist/git/read-state.d.ts +21 -0
  133. package/dist/git/read-state.js +143 -0
  134. package/dist/git/read-state.js.map +1 -0
  135. package/dist/git/repository.d.ts +48 -0
  136. package/dist/git/repository.js +110 -0
  137. package/dist/git/repository.js.map +1 -0
  138. package/dist/git/write-files.d.ts +9 -0
  139. package/dist/git/write-files.js +125 -0
  140. package/dist/git/write-files.js.map +1 -0
  141. package/dist/git-binding.d.ts +0 -53
  142. package/dist/git-binding.js +3 -114
  143. package/dist/git-binding.js.map +1 -1
  144. package/dist/git-command.js +11 -2
  145. package/dist/git-command.js.map +1 -1
  146. package/dist/git-index-entries.d.ts +7 -15
  147. package/dist/git-index-entries.js +3 -41
  148. package/dist/git-index-entries.js.map +1 -1
  149. package/dist/git-index-format.d.ts +4 -7
  150. package/dist/git-index-format.js +41 -106
  151. package/dist/git-index-format.js.map +1 -1
  152. package/dist/graph-publication.d.ts +6 -7
  153. package/dist/graph-publication.js +9 -21
  154. package/dist/graph-publication.js.map +1 -1
  155. package/dist/ground-basis.d.ts +1 -37
  156. package/dist/ground-basis.js +5 -162
  157. package/dist/ground-basis.js.map +1 -1
  158. package/dist/ground-database.js +0 -22
  159. package/dist/ground-database.js.map +1 -1
  160. package/dist/ground-install-saves.d.ts +0 -4
  161. package/dist/ground-install-saves.js +0 -4
  162. package/dist/ground-install-saves.js.map +1 -1
  163. package/dist/ground-inventory-schema.js +0 -3
  164. package/dist/ground-inventory-schema.js.map +1 -1
  165. package/dist/ground-marks.d.ts +7 -33
  166. package/dist/ground-marks.js +8 -55
  167. package/dist/ground-marks.js.map +1 -1
  168. package/dist/ground-relations.d.ts +2 -2
  169. package/dist/ground-relations.js +5 -10
  170. package/dist/ground-relations.js.map +1 -1
  171. package/dist/ground-row.d.ts +0 -7
  172. package/dist/ground-row.js +7 -12
  173. package/dist/ground-row.js.map +1 -1
  174. package/dist/ground-save-ops.d.ts +2 -1
  175. package/dist/ground-save-ops.js +2 -1
  176. package/dist/ground-save-ops.js.map +1 -1
  177. package/dist/ground-store.d.ts +0 -10
  178. package/dist/ground-store.js +19 -131
  179. package/dist/ground-store.js.map +1 -1
  180. package/dist/materialize-records.d.ts +19 -20
  181. package/dist/materialize-records.js +123 -244
  182. package/dist/materialize-records.js.map +1 -1
  183. package/dist/materialized-graph.d.ts +3 -22
  184. package/dist/materialized-graph.js +1 -142
  185. package/dist/materialized-graph.js.map +1 -1
  186. package/dist/received-state.d.ts +4 -6
  187. package/dist/received-state.js +6 -11
  188. package/dist/received-state.js.map +1 -1
  189. package/dist/root-install.d.ts +1 -2
  190. package/dist/root-install.js +2 -11
  191. package/dist/root-install.js.map +1 -1
  192. package/dist/sharing-admission.d.ts +1 -2
  193. package/dist/sharing-admission.js +8 -77
  194. package/dist/sharing-admission.js.map +1 -1
  195. package/dist/source-witness.d.ts +1 -7
  196. package/dist/source-witness.js +0 -12
  197. package/dist/source-witness.js.map +1 -1
  198. package/dist/user-ground-host.d.ts +21 -35
  199. package/dist/user-ground-host.js +423 -1484
  200. package/dist/user-ground-host.js.map +1 -1
  201. package/npm-shrinkwrap.json +24 -24
  202. package/package.json +5 -5
  203. package/dist/apply-window-repository.d.ts +0 -97
  204. package/dist/apply-window-repository.js +0 -464
  205. package/dist/apply-window-repository.js.map +0 -1
  206. package/dist/detection/codec-standing.d.ts +0 -27
  207. package/dist/detection/codec-standing.js +0 -86
  208. package/dist/detection/codec-standing.js.map +0 -1
  209. package/dist/detection/git-notice.d.ts +0 -104
  210. package/dist/detection/git-notice.js +0 -483
  211. package/dist/detection/git-notice.js.map +0 -1
  212. package/dist/detection/held-survey.d.ts +0 -39
  213. package/dist/detection/held-survey.js +0 -105
  214. package/dist/detection/held-survey.js.map +0 -1
  215. package/dist/detection/held-territory.d.ts +0 -73
  216. package/dist/detection/held-territory.js +0 -266
  217. package/dist/detection/held-territory.js.map +0 -1
  218. package/dist/detection/name-reach.d.ts +0 -12
  219. package/dist/detection/name-reach.js +0 -28
  220. package/dist/detection/name-reach.js.map +0 -1
  221. package/dist/detection/own-channel.d.ts +0 -17
  222. package/dist/detection/own-channel.js +0 -31
  223. package/dist/detection/own-channel.js.map +0 -1
  224. package/dist/detection/repository-publication.d.ts +0 -22
  225. package/dist/detection/repository-publication.js +0 -81
  226. package/dist/detection/repository-publication.js.map +0 -1
  227. package/dist/detection/repository-routes.d.ts +0 -50
  228. package/dist/detection/repository-routes.js +0 -118
  229. package/dist/detection/repository-routes.js.map +0 -1
  230. package/dist/detection/repository-seals.d.ts +0 -98
  231. package/dist/detection/repository-seals.js +0 -145
  232. package/dist/detection/repository-seals.js.map +0 -1
  233. package/dist/detection/seal-law.d.ts +0 -59
  234. package/dist/detection/seal-law.js +0 -103
  235. package/dist/detection/seal-law.js.map +0 -1
  236. package/dist/git-capture.d.ts +0 -47
  237. package/dist/git-capture.js +0 -153
  238. package/dist/git-capture.js.map +0 -1
  239. package/dist/git-card.d.ts +0 -30
  240. package/dist/git-card.js +0 -136
  241. package/dist/git-card.js.map +0 -1
  242. package/dist/git-checkpoint-construction.d.ts +0 -54
  243. package/dist/git-checkpoint-construction.js +0 -126
  244. package/dist/git-checkpoint-construction.js.map +0 -1
  245. package/dist/git-checkpoint-preparation.d.ts +0 -47
  246. package/dist/git-checkpoint-preparation.js +0 -201
  247. package/dist/git-checkpoint-preparation.js.map +0 -1
  248. package/dist/git-configuration.d.ts +0 -53
  249. package/dist/git-configuration.js +0 -238
  250. package/dist/git-configuration.js.map +0 -1
  251. package/dist/git-evidence.d.ts +0 -50
  252. package/dist/git-evidence.js +0 -114
  253. package/dist/git-evidence.js.map +0 -1
  254. package/dist/git-facts.d.ts +0 -2
  255. package/dist/git-facts.js +0 -35
  256. package/dist/git-facts.js.map +0 -1
  257. package/dist/git-index-witness.d.ts +0 -34
  258. package/dist/git-index-witness.js +0 -85
  259. package/dist/git-index-witness.js.map +0 -1
  260. package/dist/git-literal-batch.d.ts +0 -82
  261. package/dist/git-literal-batch.js +0 -152
  262. package/dist/git-literal-batch.js.map +0 -1
  263. package/dist/git-literal-host.d.ts +0 -76
  264. package/dist/git-literal-host.js +0 -185
  265. package/dist/git-literal-host.js.map +0 -1
  266. package/dist/git-literal-read.d.ts +0 -74
  267. package/dist/git-literal-read.js +0 -186
  268. package/dist/git-literal-read.js.map +0 -1
  269. package/dist/git-literal-replay.d.ts +0 -83
  270. package/dist/git-literal-replay.js +0 -393
  271. package/dist/git-literal-replay.js.map +0 -1
  272. package/dist/git-native-file.d.ts +0 -42
  273. package/dist/git-native-file.js +0 -145
  274. package/dist/git-native-file.js.map +0 -1
  275. package/dist/git-native-index.d.ts +0 -27
  276. package/dist/git-native-index.js +0 -44
  277. package/dist/git-native-index.js.map +0 -1
  278. package/dist/git-operation-host.d.ts +0 -42
  279. package/dist/git-operation-host.js +0 -115
  280. package/dist/git-operation-host.js.map +0 -1
  281. package/dist/git-private-repository.d.ts +0 -4
  282. package/dist/git-private-repository.js +0 -66
  283. package/dist/git-private-repository.js.map +0 -1
  284. package/dist/git-private-view.d.ts +0 -72
  285. package/dist/git-private-view.js +0 -318
  286. package/dist/git-private-view.js.map +0 -1
  287. package/dist/git-records.d.ts +0 -29
  288. package/dist/git-records.js +0 -119
  289. package/dist/git-records.js.map +0 -1
  290. package/dist/git-ref-store.d.ts +0 -12
  291. package/dist/git-ref-store.js +0 -68
  292. package/dist/git-ref-store.js.map +0 -1
  293. package/dist/git-registration-host.d.ts +0 -42
  294. package/dist/git-registration-host.js +0 -98
  295. package/dist/git-registration-host.js.map +0 -1
  296. package/dist/git-repository-host.d.ts +0 -291
  297. package/dist/git-repository-host.js +0 -1291
  298. package/dist/git-repository-host.js.map +0 -1
  299. package/dist/git-spelling.d.ts +0 -41
  300. package/dist/git-spelling.js +0 -233
  301. package/dist/git-spelling.js.map +0 -1
  302. package/dist/git-tree-objects.d.ts +0 -22
  303. package/dist/git-tree-objects.js +0 -205
  304. package/dist/git-tree-objects.js.map +0 -1
  305. package/dist/git-worktree-host.d.ts +0 -2
  306. package/dist/git-worktree-host.js +0 -16
  307. package/dist/git-worktree-host.js.map +0 -1
  308. package/dist/ground-territory.d.ts +0 -106
  309. package/dist/ground-territory.js +0 -340
  310. package/dist/ground-territory.js.map +0 -1
  311. package/dist/repository-checkpoint-file.d.ts +0 -20
  312. package/dist/repository-checkpoint-file.js +0 -129
  313. package/dist/repository-checkpoint-file.js.map +0 -1
  314. package/dist/repository-statement.d.ts +0 -21
  315. package/dist/repository-statement.js +0 -33
  316. package/dist/repository-statement.js.map +0 -1
  317. package/dist/reveal-owner.d.ts +0 -16
  318. package/dist/reveal-owner.js +0 -74
  319. package/dist/reveal-owner.js.map +0 -1
@@ -1,318 +0,0 @@
1
- /** Private Git object/index effects, with borrowed source objects only for readers. */
2
- import { existsSync } from "node:fs";
3
- import { mkdir, rm, writeFile } from "node:fs/promises";
4
- import { join } from "node:path";
5
- import { ITEMS_PER_BOUNDARY } from "@amalgm/live";
6
- import { runGit, runGitToFile } from "./git-command.js";
7
- import { assertGitPath, parseGitIndex, parseGitIndexEntry } from "./git-index-entries.js";
8
- import { createPrivateRepository } from "./git-private-repository.js";
9
- import { gitTreePackSteps, gitTreeSteps } from "./git-tree-objects.js";
10
- import { finishStepsInTurns, turnBoundary } from "./turns.js";
11
- const DIFF_OPTIONS = ["diff-tree", "-r", "--no-commit-id", "--binary", "--full-index",
12
- "--no-renames", "--no-ext-diff", "--no-textconv", "--no-color", "--submodule=short",
13
- "--src-prefix=a/", "--dst-prefix=b/", "--diff-algorithm=myers", "--no-indent-heuristic",
14
- "--unified=3", "--inter-hunk-context=0"];
15
- /** Entries as `update-index --index-info` reads them, a bounded slice at a
16
- * time, so a large index is never written out in one long step. */
17
- async function* indexInfo(entries) {
18
- for (let start = 0; start < entries.length; start += ITEMS_PER_BOUNDARY) {
19
- await turnBoundary();
20
- yield Buffer.from(entries.slice(start, start + ITEMS_PER_BOUNDARY)
21
- .map(entry => `${entry.mode} ${entry.objectId} ${entry.stage}\t${entry.path}\0`).join(""));
22
- }
23
- }
24
- const SPARSE_FOLDER = "040000";
25
- /** What Git marks each file it expands a sparse folder into (ensure_full_index). */
26
- const EXPANDED_FLAGS = Object.freeze(["skip-worktree"]);
27
- /** The tree with no entries, which Git knows without storing it. */
28
- const EMPTY_TREE = { sha1: "4b825dc642cb6eb9a060e54bf8d69288fbee4904",
29
- sha256: "6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321" };
30
- const RECORD = 0x3a; // ":" opens each raw diff record.
31
- /** A sparse listing as Git expands it: each folder's place holds, as stage-0
32
- * entries marked skip-worktree, the files diff-tree named for it after that
33
- * folder's own header. Every other entry passes through as decoded. */
34
- function* expandedListing(listing, headers, output) {
35
- const entries = [];
36
- let cursor = 0, folder = 0;
37
- for (let index = 0; index < listing.length; index += 1) {
38
- if (index % ITEMS_PER_BOUNDARY === ITEMS_PER_BOUNDARY - 1)
39
- yield;
40
- const entry = listing[index];
41
- if (entry.mode !== SPARSE_FOLDER) {
42
- entries.push(entry);
43
- continue;
44
- }
45
- const header = headers[folder++];
46
- if (!output.subarray(cursor, cursor + header.length).equals(header)) {
47
- throw new Error("Git diff-tree did not answer each sparse folder in order");
48
- }
49
- cursor += header.length;
50
- for (let files = 0; output[cursor] === RECORD; files += 1) {
51
- if (files % ITEMS_PER_BOUNDARY === ITEMS_PER_BOUNDARY - 1)
52
- yield;
53
- const meta = output.indexOf(0, cursor), end = meta < 0 ? -1 : output.indexOf(0, meta + 1);
54
- if (end < 0)
55
- throw new Error("invalid Git diff-tree record");
56
- const [before, mode, , objectId, status] = output.toString("latin1", cursor + 1, meta).split(" ");
57
- if (before !== "000000" || status !== "A")
58
- throw new Error("invalid Git diff-tree record");
59
- entries.push({ ...parseGitIndexEntry(`${mode} ${objectId} 0\t${entry.path}${output.toString("utf8", meta + 1, end)}`),
60
- flags: EXPANDED_FLAGS });
61
- cursor = end + 1;
62
- }
63
- }
64
- if (cursor !== output.length)
65
- throw new Error("Git diff-tree answered more than each sparse folder");
66
- return entries;
67
- }
68
- /** Source alternates are used only by readers. Git object writers can refresh
69
- * an existing alternate object's timestamp, so they run without alternates.
70
- * Required patch bases are copied into private storage before a writer runs.
71
- *
72
- * A view is disposable: nothing it writes is ever kept, so its writers never
73
- * wait for the disk. Durability belongs to the writers of a real repository
74
- * and to the barrier before Add's rows. */
75
- export class PrivateGitView {
76
- directory;
77
- format;
78
- #profile;
79
- /** Trees this view holds. */
80
- #trees = new Set();
81
- /** Blobs this view wrote into its own pack. */
82
- #written = new Set();
83
- constructor(directory, format, profile) {
84
- this.directory = directory;
85
- this.format = format;
86
- this.#profile = profile;
87
- }
88
- /** The binding names the source's object format and store, so opening a
89
- * view asks Git nothing. */
90
- static async open(binding, shallow = []) {
91
- const view = new PrivateGitView(await createPrivateRepository("amalgm-git-view-", binding.format), binding.format, Object.freeze({ GIT_ALTERNATE_OBJECT_DIRECTORIES: JSON.stringify(binding.objects), GIT_NO_REPLACE_OBJECTS: "1",
92
- LC_ALL: "C" }));
93
- try {
94
- // Only history traversal needs a horizon, supplied by its captured Card.
95
- // Index/tree/blob readers never reread an unrelated live shallow file.
96
- if (shallow.length)
97
- await writeFile(join(view.directory, "shallow"), `${shallow.join("\n")}\n`);
98
- await mkdir(join(view.directory, "info"), { recursive: true });
99
- await writeFile(join(view.directory, "info", "attributes"), "* -diff\n");
100
- return view;
101
- }
102
- catch (error) {
103
- await view.close();
104
- throw error;
105
- }
106
- }
107
- read(args, input, purpose = "checkpoint", silent = false) {
108
- return runGit(this.directory, ["-c", "core.quotePath=true", "-c", "core.autocrlf=false", ...args], { input, profile: this.#profile, purpose, silent });
109
- }
110
- write(args, input) {
111
- const { GIT_ALTERNATE_OBJECT_DIRECTORIES: _alternates, ...profile } = this.#profile;
112
- return runGit(this.directory, ["-c", "core.fsync=none", "-c", "core.quotePath=true", "-c", "core.autocrlf=false", ...args], { input, profile, purpose: "checkpoint" });
113
- }
114
- /** The root tree of one listing and of each variant of it
115
- * (git-tree-objects.ts). Every tree this view does not yet hold arrives in
116
- * one pack, from one Git process; a tree the view already holds is never
117
- * written again. */
118
- async trees(entries, variants = []) {
119
- const { roots, objects } = await finishStepsInTurns(gitTreeSteps(entries, this.format, variants));
120
- const unheld = new Map();
121
- for (const object of objects)
122
- if (!this.#trees.has(object.objectId))
123
- unheld.set(object.objectId, object);
124
- if (unheld.size > 0) {
125
- const pack = await finishStepsInTurns(gitTreePackSteps([...unheld.values()], this.format));
126
- await this.write(["index-pack", "--stdin", "--fsck-objects"], pack);
127
- for (const objectId of unheld.keys())
128
- this.#trees.add(objectId);
129
- }
130
- return roots;
131
- }
132
- async tree(entries) { return (await this.trees(entries))[0]; }
133
- /** Literal blobs whose identity Git must confirm, written together. */
134
- async rawBlobs(leaves) {
135
- const oids = await this.writeBlobs(leaves.length, index => leaves[index].content);
136
- if (oids.some((oid, index) => oid !== leaves[index].objectId))
137
- throw new Error("Git disagrees with literal blob identity");
138
- }
139
- /** Exact bytes as blobs, from one Git process however many there are, each
140
- * named by Git in order. Each blob's bytes are asked for only as Git takes
141
- * them, so a lazy source never holds them all at once. fast-import applies
142
- * no filters and keeps its one pack: loosening it would start another
143
- * process. */
144
- async writeBlobs(count, content) {
145
- if (count === 0)
146
- return [];
147
- // A source's own refusal is the answer, not the Git process it stopped.
148
- const refused = [];
149
- async function* stream() {
150
- for (let index = 0; index < count; index += 1) {
151
- let bytes;
152
- try {
153
- bytes = await content(index);
154
- }
155
- catch (error) {
156
- refused.push(error);
157
- throw error;
158
- }
159
- yield Buffer.from(`blob\nmark :${index + 1}\ndata ${bytes.length}\n`);
160
- yield bytes;
161
- yield Buffer.from("\n");
162
- }
163
- let marks = "";
164
- for (let index = 1; index <= count; index += 1)
165
- marks += `get-mark :${index}\n`;
166
- yield Buffer.from(`${marks}done\n`);
167
- }
168
- let named;
169
- try {
170
- named = await this.write(["-c", "fastimport.unpackLimit=0", "fast-import", "--quiet", "--done"], stream());
171
- }
172
- catch (error) {
173
- throw refused.length ? refused[0] : error;
174
- }
175
- const oids = named.toString("ascii").split("\n").slice(0, -1);
176
- if (oids.length !== count)
177
- throw new Error("Git did not name every written blob");
178
- oids.forEach(oid => this.#written.add(oid));
179
- return oids;
180
- }
181
- blobSizes(objects) {
182
- return this.read(["cat-file", "--batch-check=%(objectsize)"], Buffer.from(objects.join("\n") + "\n"));
183
- }
184
- blobs(objects) {
185
- return this.read(["cat-file", "--batch"], Buffer.from(objects.join("\n") + "\n"));
186
- }
187
- pack(objects) {
188
- return this.read(["pack-objects", "--stdout"], Buffer.from(objects.join("\n") + "\n"), "transport");
189
- }
190
- /** The objects this view holds, asked once. */
191
- async present(objects) {
192
- if (!objects.length)
193
- return [];
194
- const held = new Set((await this.read(["cat-file", "--batch-check=%(objectname)"], Buffer.from(`${objects.join("\n")}\n`), "transport")).toString("ascii").split("\n"));
195
- return objects.filter(object => held.has(object));
196
- }
197
- /** Those of these commits the tips reach under this view's horizon, each
198
- * with the parents that horizon gives it. */
199
- async reached(tips, commits) {
200
- const found = new Map();
201
- if (!tips.length || !commits.length)
202
- return found;
203
- const wanted = new Set(commits);
204
- const ancestry = await this.read(["rev-list", "--parents", "--stdin"], Buffer.from(`${tips.join("\n")}\n`), "transport");
205
- for (const line of ancestry.toString("ascii").split("\n")) {
206
- const [commit, ...parents] = line.split(" ");
207
- if (wanted.has(commit))
208
- found.set(commit, parents);
209
- }
210
- return found;
211
- }
212
- /** A shallow receiver's haves may reach no wanted commit through their
213
- * parents, so, as upload-pack does, each have's own tree is its edge. */
214
- exportPack(revisions, file, shallowReceiver) {
215
- // With no remotes in this private repository, a missing borrowed object
216
- // cannot trigger a lazy fetch into the source repository.
217
- return runGitToFile(this.directory, ["pack-objects", "--stdout", "--revs", "--thin", "--delta-base-offset",
218
- ...shallowReceiver ? ["--shallow"] : []], file, { input: revisions, profile: this.#profile, purpose: "transport" });
219
- }
220
- /** Each pair's patch between two trees, from one diff-tree. Git heads each
221
- * stdin pair's patch with that pair's own line, which no patch line can
222
- * equal, so the answer divides exactly there. A pair error leaves Git's
223
- * exit status clean, so every header must be present and in order. An
224
- * identical pair has no patch and is not asked. */
225
- async diffs(pairs) {
226
- const headers = pairs.filter(([before, after]) => before !== after).map(([before, after]) => `${before} ${after}\n`);
227
- const output = headers.length ? await this.read([...DIFF_OPTIONS, "--stdin"], Buffer.from(headers.join(""))) : Buffer.alloc(0);
228
- const patches = [];
229
- let cursor = 0;
230
- headers.forEach((header, index) => {
231
- if (!output.subarray(cursor, cursor + header.length).equals(Buffer.from(header))) {
232
- throw new Error("Git diff-tree did not answer each tree pair in order");
233
- }
234
- cursor += header.length;
235
- const next = headers[index + 1];
236
- const end = next === undefined ? output.length : output.indexOf(`\n${next}`, cursor - 1) + 1;
237
- if (end < cursor)
238
- throw new Error("Git diff-tree did not answer each tree pair in order");
239
- patches.push(output.subarray(cursor, end));
240
- cursor = end;
241
- });
242
- return pairs.map(([before, after]) => before === after ? Buffer.alloc(0) : patches.shift());
243
- }
244
- async apply(base, patch) {
245
- // Enumerate the source tree without letting an index writer see source
246
- // storage. Even index-only commands may generate cached tree objects.
247
- const entries = (await this.read(["ls-tree", "-r", "-z", "--full-tree", base]))
248
- .toString("utf8").split("\0").filter(Boolean).map(record => {
249
- const separator = record.indexOf("\t");
250
- const [mode, , objectId] = record.slice(0, separator).split(" ");
251
- if (separator < 0)
252
- throw new Error("invalid Git tree entry");
253
- return `${mode} ${objectId} 0\t${record.slice(separator + 1)}\0`;
254
- });
255
- await this.replaceIndex(await parseGitIndex(Buffer.from(entries.join(""))));
256
- if (patch.length) {
257
- // Extended headers are unprefixed; text hunks prefix each content line
258
- // and binary hunks use space-free base85. Human-readable --summary
259
- // cannot enforce this rule because it prints embedded filename newlines.
260
- const bytes = Buffer.from(patch.buffer, patch.byteOffset, patch.byteLength);
261
- for (const header of ["rename from ", "rename to ", "rename old ", "rename new ", "copy from ", "copy to "]) {
262
- if (bytes.subarray(0, header.length).equals(Buffer.from(header)) || bytes.includes(Buffer.from(`\n${header}`))) {
263
- throw new Error("repository patch must not contain rename/copy instructions");
264
- }
265
- }
266
- // Let Git parse its patch path grammar, including tabs and newlines.
267
- // The canonical profile emits no rename records. Only changed base
268
- // blobs need copying; unrelated history stays in the read-only view.
269
- const changed = new Set((await this.write(["apply", "--numstat", "-z"], patch))
270
- .toString("utf8").split("\0").filter(Boolean).map(record => {
271
- const first = record.indexOf("\t"), second = record.indexOf("\t", first + 1);
272
- if (first < 0 || second < 0)
273
- throw new Error("invalid Git patch path inventory");
274
- const path = record.slice(second + 1);
275
- assertGitPath(path);
276
- return path;
277
- }));
278
- const current = await parseGitIndex(await this.write(["ls-files", "--stage", "-z"]));
279
- const bases = [...new Set(current.filter(entry => changed.has(entry.path) && entry.mode !== "160000"
280
- && !this.ownsObject(entry.objectId)).map(entry => entry.objectId))];
281
- // One base is held at a time, and each copy must be its source object.
282
- const copied = await this.writeBlobs(bases.length, index => this.read(["cat-file", "blob", bases[index]]));
283
- if (copied.some((oid, index) => oid !== bases[index]))
284
- throw new Error("private Git patch base failed verification");
285
- await this.write(["apply", "--cached", "--binary", "--whitespace=nowarn"], patch);
286
- }
287
- return parseGitIndex(await this.write(["ls-files", "--stage", "-z"]));
288
- }
289
- /** Whether this view wrote the object: into its pack, or loose through Git's
290
- * own index and patch writers. */
291
- ownsObject(oid) {
292
- return this.#written.has(oid) || existsSync(join(this.directory, "objects", oid.slice(0, 2), oid.slice(2)));
293
- }
294
- /** A fresh index holding exactly these entries, so Git carries none of a
295
- * replaced index's caches. An empty index is no file: index readers treat
296
- * a missing index as empty. */
297
- async replaceIndex(entries) {
298
- await rm(join(this.directory, "index"), { force: true });
299
- if (entries.length)
300
- await this.write(["update-index", "--force-write-index", "-z", "--index-info"], indexInfo(entries));
301
- }
302
- /** A sparse listing with each folder replaced, where it stands, by the
303
- * files its tree holds: Git's order keeps a folder's files together at the
304
- * folder's own place. One diff-tree from the empty tree names them all. It
305
- * reads trees alone, and any index this view holds is a full one it wrote,
306
- * so nothing here expands an index. Git reports a tree it cannot read on
307
- * stderr and still exits 0, so the read is silent (git-command.ts). */
308
- async expand(listing) {
309
- const headers = listing.filter(entry => entry.mode === SPARSE_FOLDER)
310
- .map(folder => Buffer.from(`${EMPTY_TREE[this.format]} ${folder.objectId}\n`));
311
- if (!headers.length)
312
- return listing;
313
- const output = await this.read(["diff-tree", "-r", "-z", "--raw", "--no-abbrev", "--no-renames", "--stdin"], Buffer.concat(headers), "checkpoint", true);
314
- return finishStepsInTurns(expandedListing(listing, headers, output));
315
- }
316
- close() { return rm(this.directory, { recursive: true, force: true }); }
317
- }
318
- //# sourceMappingURL=git-private-view.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-private-view.js","sourceRoot":"","sources":["../src/git-private-view.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAc,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAoC,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAsB,MAAM,wBAAwB,CAAC;AAE9G,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAA2C,MAAM,uBAAuB,CAAC;AAChH,OAAO,EAAE,kBAAkB,E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AAC;IACvE,CAAC;IAED,KAAK,KAAoB,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;CACxF"}
@@ -1,29 +0,0 @@
1
- import { type SourceProof } from "./source-proof.js";
2
- /** Why a repository's Git state cannot be certified by its records. Every
3
- * refusal means Git is asked in full; the reason is evidence, never a
4
- * different answer. */
5
- export type GitSealRefusalReason = "marker" | "storage-layout" | "worktree" | "unsupported-storage" | "config-include" | "operation" | "result-mismatch" | "changed" | "unreadable";
6
- export interface GitSealRefusal {
7
- readonly refused: GitSealRefusalReason;
8
- readonly detail?: string;
9
- }
10
- export declare const refuse: (refused: GitSealRefusalReason, detail?: string) => GitSealRefusal;
11
- export declare const failureRefusal: (error: unknown) => GitSealRefusal;
12
- export declare const recordsRefused: <T extends object>(records: T | GitSealRefusal) => records is GitSealRefusal;
13
- export interface GitRecords {
14
- /** Content only: equal keys mean Git answers the same. */
15
- readonly key: string;
16
- /** Unclosed: the records' native witnesses as read. */
17
- readonly proof: SourceProof;
18
- /** Physical keys of the files read. */
19
- readonly physical: readonly string[];
20
- }
21
- /** Storage records, with the storage they predict Git binds: the checkout as
22
- * its own worktree over one private storage directory. */
23
- export interface StorageRecords extends GitRecords {
24
- readonly repository: string;
25
- readonly gitDir: string;
26
- }
27
- export declare function storageRecords(repository: string): StorageRecords | GitSealRefusal;
28
- /** A symbolic `refs/stash` would lead Git's stash list to another reflog. */
29
- export declare function refsRecords(gitDir: string): GitRecords | GitSealRefusal;
@@ -1,119 +0,0 @@
1
- /** The native records a repository's Git answers are a function of. The host
2
- * pins Git's system and global configuration to nothing and strips inherited
3
- * GIT_* variables (git-command.ts), so inside the supported profile — one
4
- * private storage directory, no include, no split or linked storage — Git
5
- * answers from these records and immutable objects alone:
6
- * - the binding and effective configuration from the storage records: the
7
- * route from checkout to storage, `config`, and the absence of
8
- * `commondir`, `config.worktree` and `reftable`;
9
- * - HEAD, the refs, the shallow boundary and the stash from those and the
10
- * refs records: HEAD, packed-refs, every loose ref, `shallow` and the
11
- * stash reflog.
12
- * A record set's key digests its content only (names, presence, bytes and
13
- * the route's association), so equal keys mean Git answers the same and an
14
- * answer taken under one key stands for every later read of equal records
15
- * (git-facts.ts). Its proof is the records' native witnesses: a capture
16
- * closes them natively, never by asking Git again. Objects are immutable; an
17
- * answer names what Git read from them, and objects lost under unchanged
18
- * records change no captured meaning (detection.md). Anything outside the
19
- * profile is a typed refusal, and Git is asked as the full reader asks it. */
20
- import { createHash } from "node:crypto";
21
- import { lstatSync, realpathSync } from "node:fs";
22
- import { join } from "node:path";
23
- import { CaptureSourceChangedError } from "./content-cache-host.js";
24
- import { gitRouteWitness, gitStorageDirectory } from "./git-binding.js";
25
- import { gitHost } from "./git-command.js";
26
- import { observeNativeGitFile } from "./git-native-file.js";
27
- import { observeNamespace } from "./physical-path-witness.js";
28
- import { witnessProof } from "./source-proof.js";
29
- export const refuse = (refused, detail) => Object.freeze(detail === undefined ? { refused } : { refused, detail });
30
- export const failureRefusal = (error) => error instanceof CaptureSourceChangedError
31
- || ["ENOENT", "ENOTDIR"].includes(error.code ?? "")
32
- ? refuse("changed", error.message) : refuse("unreadable", error.message);
33
- export const recordsRefused = (records) => "refused" in records;
34
- class RecordReader {
35
- #digest = createHash("sha256");
36
- #witnesses = [];
37
- #physical = [];
38
- constructor(version) { this.text(version); this.text(gitHost().key); }
39
- text(value) { this.#digest.update(value + "\0"); }
40
- witness(witness) { this.#witnesses.push(witness); }
41
- /** Presence and length are explicit: present bytes spelling "absent"
42
- * cannot impersonate a missing record. */
43
- file(name, path) {
44
- const observed = observeNativeGitFile(path);
45
- this.#witnesses.push(observed.witness);
46
- if (observed.physical)
47
- this.#physical.push(observed.physical);
48
- this.text(JSON.stringify([name, observed.bytes !== null, observed.bytes?.length ?? 0]));
49
- if (observed.bytes)
50
- this.#digest.update(observed.bytes);
51
- return observed.bytes;
52
- }
53
- names(path) {
54
- const namespace = observeNamespace(path);
55
- this.#witnesses.push(namespace);
56
- return namespace.names;
57
- }
58
- done() {
59
- return Object.freeze({ key: this.#digest.digest("hex"), proof: witnessProof(this.#witnesses),
60
- physical: Object.freeze(this.#physical) });
61
- }
62
- }
63
- export function storageRecords(repository) {
64
- try {
65
- const marker = lstatSync(join(repository, ".git"));
66
- if (!marker.isDirectory() && !marker.isFile())
67
- return refuse("marker");
68
- const real = realpathSync.native(repository);
69
- const gitDir = realpathSync.native(gitStorageDirectory(repository).directory);
70
- if (marker.isDirectory() && gitDir !== join(real, ".git"))
71
- return refuse("storage-layout");
72
- const route = gitRouteWitness(repository, { repository: real, gitDir, common: gitDir, index: join(gitDir, "index"), worktree: real });
73
- const records = new RecordReader("amalgm.git-storage@1");
74
- records.text(JSON.stringify([real, gitDir, route.association]));
75
- records.witness(route);
76
- for (const refused of ["commondir", "config.worktree", "reftable"]) {
77
- if (records.file(refused, join(gitDir, refused)) !== null)
78
- return refuse("unsupported-storage", refused);
79
- }
80
- const config = records.file("config", join(gitDir, "config"));
81
- if (config !== null && /^\s*\[include/im.test(config.toString("utf8")))
82
- return refuse("config-include");
83
- return Object.freeze({ ...records.done(), repository: real, gitDir });
84
- }
85
- catch (error) {
86
- return failureRefusal(error);
87
- }
88
- }
89
- /** A symbolic `refs/stash` would lead Git's stash list to another reflog. */
90
- export function refsRecords(gitDir) {
91
- try {
92
- const records = new RecordReader("amalgm.git-refs@1");
93
- records.file("HEAD", join(gitDir, "HEAD"));
94
- records.file("packed-refs", join(gitDir, "packed-refs"));
95
- records.file("shallow", join(gitDir, "shallow"));
96
- let symbolicStash = false;
97
- const walk = (relative) => {
98
- for (const name of records.names(join(gitDir, relative))) {
99
- const child = `${relative}/${name}`;
100
- if (lstatSync(join(gitDir, child)).isDirectory()) {
101
- walk(child);
102
- continue;
103
- }
104
- const bytes = records.file(child, join(gitDir, child));
105
- if (child === "refs/stash" && bytes?.toString("latin1").startsWith("ref:"))
106
- symbolicStash = true;
107
- }
108
- };
109
- walk("refs");
110
- if (symbolicStash)
111
- return refuse("unsupported-storage", "symbolic refs/stash");
112
- records.file("logs/refs/stash", join(gitDir, "logs", "refs", "stash"));
113
- return records.done();
114
- }
115
- catch (error) {
116
- return failureRefusal(error);
117
- }
118
- }
119
- //# sourceMappingURL=git-records.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-records.js","sourceRoot":"","sources":["../src/git-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;8EAkB8E;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AAUnE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAA6B,EAAE,MAAe,EAAkB,EAAE,CACvF,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAc,EAAkB,EAAE,CAAC,KAAK,YAAY,yBAAyB;OACvG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAE,KAA+B,CAAC,IAAI,IAAI,EAAE,CAAC;IAC9E,CAA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AAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC"}
@@ -1,12 +0,0 @@
1
- export type LooseRef = {
2
- readonly kind: "direct";
3
- readonly commit: string;
4
- } | {
5
- readonly kind: "symbolic";
6
- readonly target: string;
7
- } | {
8
- readonly kind: "unreadable";
9
- };
10
- /** Every loose ref this checkout sees, by full name, read on demand. Git
11
- * ignores its own `.lock` files, and so does this reader. */
12
- export declare function looseRefs(repository: string): Map<string, () => LooseRef>;
@@ -1,68 +0,0 @@
1
- /** Git's loose ref store, read natively for the two facts for-each-ref
2
- * cannot give. The files backend keeps every symbolic ref as one loose file
3
- * (pack-refs never packs one), and `%(symref)` follows a chain to its end, so
4
- * only the loose file names a symbolic ref's immediate target. for-each-ref
5
- * also silently omits every stored ref it cannot read — a dangling or cyclic
6
- * symbolic ref, unreadable content, a malformed name — so its output alone
7
- * never proves the ref set complete. */
8
- import { readdirSync, readFileSync } from "node:fs";
9
- import { join } from "node:path";
10
- import { refusal } from "@amalgm/live";
11
- import { CaptureSourceChangedError } from "./content-cache-host.js";
12
- import { gitCommonDirectory, gitStorageDirectory } from "./git-binding.js";
13
- /** Git's per-worktree namespaces; every other ref lives in the common directory. */
14
- const PER_WORKTREE = ["refs/bisect/", "refs/worktree/", "refs/rewritten/"];
15
- /** Every loose ref this checkout sees, by full name, read on demand. Git
16
- * ignores its own `.lock` files, and so does this reader. */
17
- export function looseRefs(repository) {
18
- const gitDir = gitStorageDirectory(repository).directory;
19
- const common = gitCommonDirectory(gitDir);
20
- const found = new Map();
21
- const walk = (store, relative, admit) => {
22
- let entries;
23
- try {
24
- entries = readdirSync(join(store, relative), { withFileTypes: true });
25
- }
26
- catch (error) {
27
- if (missing(error))
28
- return;
29
- throw error;
30
- }
31
- for (const entry of entries) {
32
- const name = `${relative}/${entry.name}`;
33
- if (entry.isDirectory())
34
- walk(store, name, admit);
35
- else if (entry.isSymbolicLink())
36
- throw refusal(`repository stores a symbolic-link ref: ${name}`);
37
- else if (!entry.name.endsWith(".lock") && admit(name))
38
- found.set(name, () => readLoose(join(store, name)));
39
- }
40
- };
41
- const perWorktree = (name) => PER_WORKTREE.some(prefix => name.startsWith(prefix));
42
- if (common === gitDir)
43
- walk(gitDir, "refs", () => true);
44
- else {
45
- walk(common, "refs", name => !perWorktree(name));
46
- walk(gitDir, "refs", perWorktree);
47
- }
48
- return found;
49
- }
50
- /** Git's loose-ref grammar: `ref:` and a target, or one object ID. */
51
- function readLoose(path) {
52
- let content;
53
- try {
54
- content = readFileSync(path, "utf8");
55
- }
56
- catch (error) {
57
- if (missing(error))
58
- throw new CaptureSourceChangedError("repository ref store changed", { cause: error });
59
- throw error;
60
- }
61
- const symbolic = /^ref:[ \t]*(\S+)\s*$/.exec(content);
62
- if (symbolic)
63
- return { kind: "symbolic", target: symbolic[1] };
64
- const direct = /^([0-9a-f]{40}|[0-9a-f]{64})\s*$/.exec(content);
65
- return direct ? { kind: "direct", commit: direct[1] } : { kind: "unreadable" };
66
- }
67
- const missing = (error) => ["ENOENT", "ENOTDIR"].includes(error.code ?? "");
68
- //# sourceMappingURL=git-ref-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-ref-store.js","sourceRoot":"","sources":["../src/git-ref-store.ts"],"names":[],"mappings":"AAAA;;;;;;wCAMwC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAO3E,oFAAoF;AACpF,MAAM,YAAY,GAAG,CAAC,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;AAE3E;6DAC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AAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAE,KAA+B,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC"}
@@ -1,42 +0,0 @@
1
- import type { EntityType, PortableFileMode } from "@amalgm/live";
2
- import { type GitCapture } from "./git-capture.js";
3
- import { type ProvenMembers } from "./git-literal-host.js";
4
- import type { LiteralLane } from "./content-capture-pool.js";
5
- import { type RetainedPathWitness } from "./physical-path-witness.js";
6
- import { type SourceProof } from "./source-proof.js";
7
- export interface GitRegisteredLeaf {
8
- readonly type: Extract<EntityType, "file.text" | "file.binary" | "link">;
9
- /** The literal read proved equality with this indexed blob. */
10
- readonly payloadVersion: string;
11
- /** The SHA-256 of those bytes, where that read read them rather than
12
- * standing on an earlier proof. */
13
- readonly digest: string | null;
14
- readonly fileMode: PortableFileMode | null;
15
- /** The stat that bracketed that read: the payload describes only the
16
- * object this signature names. */
17
- readonly witness: RetainedPathWitness;
18
- }
19
- export interface GitRegistrationEvidence {
20
- /** Unclosed: the caller retains it, and its admission closes it once. */
21
- readonly proof: SourceProof;
22
- /** Stage-zero paths presently owned by the index. */
23
- readonly trackedPaths: ReadonlySet<string>;
24
- /** Physical content proved byte-equal to the captured indexed blob. */
25
- readonly cleanLeaves: ReadonlyMap<string, GitRegisteredLeaf>;
26
- /** Tracked paths whose worktree bytes do not agree with the index. These
27
- * paths belong to the Checkpoint and must be read even when Watch named
28
- * only repository metadata. */
29
- readonly dirtyPaths: ReadonlySet<string>;
30
- /** Whether a worktree path in this evidence's scope is one the index
31
- * accounts no blob for. Such a path belongs to the Checkpoint and must use
32
- * the same fresh bytes in repository identity even when Watch first named
33
- * only repository metadata. */
34
- untracked(path: string): boolean;
35
- }
36
- /** Git enumerates index facts; literal physical reads prove worktree content.
37
- * Suppression flags and diff attributes cannot hide bytes or choose a type.
38
- * A path is owned unless an ancestor directory holds its own `.git`. Parents
39
- * are read one depth at a time, never beneath an independent boundary; then
40
- * every owned tracked leaf is read, or stands on its still-holding proof, in
41
- * one pooled pass. */
42
- export declare function inspectGitRegistration(capture: GitCapture, paths: readonly string[] | null, lane: LiteralLane, proven: ProvenMembers | null): Promise<GitRegistrationEvidence>;