@ref0/git 0.7.0 → 0.9.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 (245) hide show
  1. package/dist/access/private-refs.mjs +0 -2
  2. package/dist/auth/authorize.mjs +31 -24
  3. package/dist/auth/bridge.mjs +8 -8
  4. package/dist/auth/fences.d.mts +0 -1
  5. package/dist/auth/fences.mjs +1 -1
  6. package/dist/auth/grants.d.mts +0 -1
  7. package/dist/auth/grants.mjs +2 -2
  8. package/dist/auth/host-function.d.mts +1 -7
  9. package/dist/auth/host-function.mjs +38 -38
  10. package/dist/auth/identify.d.mts +0 -1
  11. package/dist/auth/identify.mjs +1 -1
  12. package/dist/auth/policy.d.mts +7 -4
  13. package/dist/auth/policy.mjs +13 -10
  14. package/dist/auth/token-rows.mjs +2 -5
  15. package/dist/auth/tokens-layer.d.mts +0 -2
  16. package/dist/auth/tokens-public.d.mts +3 -3
  17. package/dist/auth/tokens-public.mjs +4 -2
  18. package/dist/auth/tokens.d.mts +6 -1
  19. package/dist/auth/tokens.mjs +7 -1
  20. package/dist/client/client.d.mts +22 -15
  21. package/dist/client/client.mjs +31 -27
  22. package/dist/client/git-http.mjs +22 -5
  23. package/dist/client/local.mjs +1 -1
  24. package/dist/client/namespace.d.mts +2 -0
  25. package/dist/client/push-upload.d.mts +1 -0
  26. package/dist/client/push-upload.mjs +169 -2
  27. package/dist/client/remote-helper.mjs +2 -4
  28. package/dist/client/remote.mjs +37 -15
  29. package/dist/client/run-remote-helper.mjs +4 -4
  30. package/dist/client/transport.mjs +26 -19
  31. package/dist/contracts/actors.d.mts +57 -28
  32. package/dist/contracts/actors.mjs +38 -2
  33. package/dist/contracts/authorize.d.mts +21 -15
  34. package/dist/contracts/callers.mjs +40 -0
  35. package/dist/contracts/calls-spent.d.mts +2 -12
  36. package/dist/contracts/calls-spent.mjs +4 -5
  37. package/dist/contracts/client.d.mts +16 -9
  38. package/dist/contracts/events.d.mts +82 -14
  39. package/dist/contracts/events.mjs +35 -9
  40. package/dist/contracts/files.d.mts +42 -42
  41. package/dist/contracts/forks.d.mts +0 -24
  42. package/dist/contracts/git-hooks.d.mts +217 -0
  43. package/dist/contracts/git-hooks.mjs +3 -1
  44. package/dist/contracts/git.d.mts +13 -3
  45. package/dist/contracts/grants.d.mts +46 -27
  46. package/dist/contracts/lfs.d.mts +17 -4
  47. package/dist/contracts/merges.d.mts +7 -7
  48. package/dist/contracts/objects.d.mts +38 -4
  49. package/dist/contracts/opaque.mjs +19 -1
  50. package/dist/contracts/operations.d.mts +8 -1
  51. package/dist/contracts/operations.mjs +209 -0
  52. package/dist/contracts/queue.d.mts +6 -5
  53. package/dist/contracts/queue.mjs +9 -20
  54. package/dist/contracts/remote.d.mts +13 -4
  55. package/dist/contracts/remote.mjs +3 -3
  56. package/dist/contracts/repos.d.mts +11 -40
  57. package/dist/contracts/repos.mjs +11 -10
  58. package/dist/contracts/result.d.mts +28 -11
  59. package/dist/contracts/result.mjs +32 -2
  60. package/dist/contracts/rules.d.mts +706 -46
  61. package/dist/contracts/rules.mjs +81 -2
  62. package/dist/contracts/server.d.mts +5 -275
  63. package/dist/contracts/services.d.mts +0 -3
  64. package/dist/contracts/services.mjs +1 -3
  65. package/dist/contracts/signin.d.mts +2 -2
  66. package/dist/contracts/signin.mjs +4 -5
  67. package/dist/contracts/sync.d.mts +1 -4
  68. package/dist/contracts/tokens.d.mts +29 -17
  69. package/dist/contracts/tokens.mjs +14 -3
  70. package/dist/contracts/topics.d.mts +38 -11
  71. package/dist/contracts/topics.mjs +8 -2
  72. package/dist/core/access.d.mts +0 -2
  73. package/dist/core/access.mjs +15 -4
  74. package/dist/core/ancestry.mjs +5 -4
  75. package/dist/core/events/deliver.mjs +19 -1
  76. package/dist/core/forks.mjs +30 -11
  77. package/dist/core/hooks/groups.d.mts +0 -1
  78. package/dist/core/hooks/groups.mjs +8 -9
  79. package/dist/core/index-job.mjs +23 -1
  80. package/dist/core/index-lost.d.mts +11 -0
  81. package/dist/core/index-lost.mjs +55 -0
  82. package/dist/core/loose-tally.mjs +46 -0
  83. package/dist/core/objects/commit-writes.mjs +1 -1
  84. package/dist/core/objects/commits.mjs +10 -9
  85. package/dist/core/objects/merges.mjs +1 -1
  86. package/dist/core/objects/reading.mjs +28 -13
  87. package/dist/core/objects/trees.mjs +1 -1
  88. package/dist/core/objects/writing.mjs +1 -0
  89. package/dist/core/parts.d.mts +7 -0
  90. package/dist/core/promise.mjs +1 -15
  91. package/dist/core/publish.mjs +9 -5
  92. package/dist/core/purge.mjs +30 -12
  93. package/dist/core/push.mjs +39 -16
  94. package/dist/core/ref-view.mjs +14 -6
  95. package/dist/core/repack.mjs +54 -27
  96. package/dist/core/repo-info.mjs +8 -6
  97. package/dist/core/repos.mjs +1 -0
  98. package/dist/core/rules/check.mjs +10 -10
  99. package/dist/core/rules/context.d.mts +3 -1
  100. package/dist/core/rules/context.mjs +16 -13
  101. package/dist/core/rules/fetch.mjs +17 -23
  102. package/dist/core/tokens.mjs +2 -1
  103. package/dist/core/view.d.mts +10 -1
  104. package/dist/core/view.mjs +15 -6
  105. package/dist/effect.d.mts +3 -6
  106. package/dist/effect.mjs +3 -6
  107. package/dist/engine/commits.mjs +23 -50
  108. package/dist/engine/failures.d.mts +1 -2
  109. package/dist/engine/failures.mjs +1 -3
  110. package/dist/engine/merge-base-walk.mjs +57 -142
  111. package/dist/engine/merge-bases.mjs +9 -7
  112. package/dist/engine/merge.mjs +20 -17
  113. package/dist/engine/parts.d.mts +1 -0
  114. package/dist/engine/parts.mjs +1 -1
  115. package/dist/engine/walk.mjs +15 -11
  116. package/dist/extend.d.mts +1 -2
  117. package/dist/extend.mjs +1 -2
  118. package/dist/http/core-parts.mjs +18 -10
  119. package/dist/http/handler.mjs +11 -31
  120. package/dist/http/parts.d.mts +0 -1
  121. package/dist/index.d.mts +29 -22
  122. package/dist/index.mjs +5 -2
  123. package/dist/lfs/base.d.mts +6 -3
  124. package/dist/lfs/base.mjs +2 -1
  125. package/dist/lfs/layer.d.mts +4 -3
  126. package/dist/lfs/layer.mjs +23 -9
  127. package/dist/lfs/objects.mjs +93 -41
  128. package/dist/lfs/pointers.mjs +69 -18
  129. package/dist/lfs/purge.mjs +6 -2
  130. package/dist/lfs/rows.mjs +24 -7
  131. package/dist/lfs/service.d.mts +6 -3
  132. package/dist/lfs/service.mjs +8 -2
  133. package/dist/lfs/upkeep.mjs +47 -28
  134. package/dist/lfs/upload-most.mjs +47 -0
  135. package/dist/lfs/uploaded.mjs +59 -0
  136. package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
  137. package/dist/protocol/bytes/streams.mjs +84 -2
  138. package/dist/protocol/bytes/text.mjs +6 -1
  139. package/dist/protocol/diff/read.d.mts +1 -0
  140. package/dist/protocol/diff/read.mjs +5 -2
  141. package/dist/protocol/objects/commit.d.mts +7 -0
  142. package/dist/protocol/objects/commit.mjs +5 -1
  143. package/dist/protocol/objects/fsck.mjs +6 -3
  144. package/dist/queue/advance.mjs +77 -18
  145. package/dist/queue/calls.mjs +4 -14
  146. package/dist/queue/host.d.mts +4 -0
  147. package/dist/queue/lanes.mjs +1 -1
  148. package/dist/queue/layer.mjs +4 -2
  149. package/dist/queue/limits.mjs +18 -2
  150. package/dist/queue/rows.mjs +10 -1
  151. package/dist/queue/schedule.mjs +1 -1
  152. package/dist/queue/search.mjs +3 -4
  153. package/dist/queue/trim.mjs +2 -2
  154. package/dist/rest/client-namespace.d.mts +2 -0
  155. package/dist/rest/client.d.mts +32 -8
  156. package/dist/rest/client.mjs +308 -382
  157. package/dist/rest/commits.d.mts +150 -150
  158. package/dist/rest/files.d.mts +18 -18
  159. package/dist/rest/forks.d.mts +77 -89
  160. package/dist/rest/handlers.mjs +2 -1
  161. package/dist/rest/listen.d.mts +8 -6
  162. package/dist/rest/listen.mjs +31 -75
  163. package/dist/rest/me.d.mts +2 -2
  164. package/dist/rest/merges.d.mts +7 -7
  165. package/dist/rest/refs.d.mts +27 -27
  166. package/dist/rest/repos.d.mts +40 -52
  167. package/dist/rest/tokens.d.mts +12 -12
  168. package/dist/rest/topics.d.mts +13 -13
  169. package/dist/rest/trees.d.mts +66 -66
  170. package/dist/rest/wire.d.mts +20 -2
  171. package/dist/rest/work.d.mts +39 -39
  172. package/dist/rest.d.mts +1 -7
  173. package/dist/rest.mjs +1 -5
  174. package/dist/server/git-layer.d.mts +10 -2
  175. package/dist/server/git-layer.mjs +29 -10
  176. package/dist/server/joined.d.mts +12 -6
  177. package/dist/server/joined.mjs +3 -2
  178. package/dist/server/registry.mjs +11 -5
  179. package/dist/server/server.d.mts +0 -1
  180. package/dist/server/server.mjs +42 -49
  181. package/dist/signin/context.d.mts +0 -1
  182. package/dist/signin/context.mjs +5 -9
  183. package/dist/storage/clean-up.mjs +3 -1
  184. package/dist/storage/fsck.mjs +12 -2
  185. package/dist/storage/graph-rebuild.mjs +262 -0
  186. package/dist/storage/index-bitmaps.mjs +16 -10
  187. package/dist/storage/index-build.mjs +160 -24
  188. package/dist/storage/index-graph.d.mts +1 -0
  189. package/dist/storage/index-graph.mjs +29 -5
  190. package/dist/storage/index-layers.d.mts +1 -0
  191. package/dist/storage/index-layers.mjs +5 -2
  192. package/dist/storage/index-reach.mjs +7 -5
  193. package/dist/storage/index-remap.mjs +5 -5
  194. package/dist/storage/index-visible.mjs +16 -5
  195. package/dist/storage/lfs-pointers.d.mts +5 -5
  196. package/dist/storage/lfs-pointers.mjs +37 -11
  197. package/dist/storage/links.mjs +3 -3
  198. package/dist/storage/loose.mjs +4 -1
  199. package/dist/storage/memory-budget.mjs +1 -1
  200. package/dist/storage/merge-fence.mjs +81 -19
  201. package/dist/storage/merge-most.mjs +1 -0
  202. package/dist/storage/merge-row.mjs +16 -4
  203. package/dist/storage/merge-stream.mjs +9 -6
  204. package/dist/storage/object-rows.mjs +17 -1
  205. package/dist/storage/pack-order.d.mts +1 -0
  206. package/dist/storage/pack-order.mjs +18 -1
  207. package/dist/storage/pack-receive.mjs +10 -6
  208. package/dist/storage/packs.mjs +58 -27
  209. package/dist/storage/prune-walk.mjs +5 -2
  210. package/dist/storage/prune.mjs +168 -70
  211. package/dist/storage/ready.d.mts +1 -1
  212. package/dist/storage/ready.mjs +12 -3
  213. package/dist/storage/receive-bounds.mjs +3 -2
  214. package/dist/storage/receive-state.mjs +1 -1
  215. package/dist/storage/repack-contained.mjs +22 -14
  216. package/dist/storage/repack.d.mts +1 -1
  217. package/dist/storage/repack.mjs +3 -2
  218. package/dist/storage/unpack.mjs +7 -0
  219. package/dist/storage/visible.mjs +3 -2
  220. package/dist/storage/walk.d.mts +1 -0
  221. package/dist/storage/walk.mjs +9 -5
  222. package/dist/storage/wants.mjs +17 -11
  223. package/dist/store/call-count.d.mts +31 -3
  224. package/dist/store/call-count.mjs +51 -20
  225. package/dist/store/errors.d.mts +7 -1
  226. package/dist/store/errors.mjs +7 -1
  227. package/dist/store/job-try.mjs +3 -1
  228. package/dist/store/records.mjs +26 -5
  229. package/dist/store/repo-record.mjs +36 -12
  230. package/dist/store/scopes.mjs +15 -2
  231. package/dist/sync/bound.d.mts +1 -1
  232. package/dist/sync/import.mjs +15 -3
  233. package/dist/sync/layer.d.mts +5 -1
  234. package/dist/sync/layer.mjs +11 -9
  235. package/dist/sync/mirror.mjs +1 -1
  236. package/dist/sync/step.mjs +15 -15
  237. package/dist/topics/advance.mjs +11 -10
  238. package/dist/topics/layer.mjs +1 -1
  239. package/dist/topics/members.mjs +38 -9
  240. package/package.json +3 -3
  241. package/dist/engine/merge-base-walk.d.mts +0 -3
  242. package/dist/server/routes.d.mts +0 -32
  243. package/dist/server/routes.mjs +0 -69
  244. package/dist/sync/bridge.d.mts +0 -6
  245. package/dist/sync/bridge.mjs +0 -29
@@ -37,16 +37,17 @@ const commitCalls = (bound) => {
37
37
  const tips = opened.oids;
38
38
  const [tip = ""] = tips;
39
39
  const page = innerPage(input.page, held);
40
- const listing = input.path === void 0 ? yield* walkHistory(opened.read, {
40
+ const { read, roots } = opened;
41
+ const listing = input.path === void 0 ? yield* walkHistory(read, {
41
42
  ...input,
42
43
  wants: [tip],
43
44
  page
44
- }) : yield* walkPath(opened.read, {
45
+ }, void 0, roots) : yield* walkPath(read, {
45
46
  ...input,
46
47
  want: tip,
47
48
  path: input.path,
48
49
  page
49
- });
50
+ }, roots);
50
51
  return yield* withinResponse(heldListing(listing, digest, tips), "The commit page");
51
52
  }, Effect.scoped),
52
53
  mergeBase: Effect.fnUntraced(function* (repo, input) {
@@ -54,7 +55,7 @@ const commitCalls = (bound) => {
54
55
  return yield* mergeBases(opened.read, {
55
56
  ...input,
56
57
  commits: opened.oids
57
- });
58
+ }, void 0, opened.roots);
58
59
  }, Effect.scoped),
59
60
  diff: Effect.fnUntraced(function* (repo, input) {
60
61
  const renames = input.renames !== false;
@@ -93,7 +94,7 @@ const commitCalls = (bound) => {
93
94
  if (commitsHeld !== void 0 && filesHeld !== void 0 && commitsHeld.oids.join() !== filesHeld.oids.join()) return yield* badCursor();
94
95
  const opened = yield* openRead(callerOf(input), repo, held?.oids ?? [input.base, input.head], input.internalId);
95
96
  const [base = "", head = ""] = opened.oids;
96
- const { read } = opened;
97
+ const { read, roots } = opened;
97
98
  const deadline = yield* deadlineOf(limits.milliseconds, "diff-limit");
98
99
  const call = {
99
100
  tally: new ReadTally(limits.reads),
@@ -107,17 +108,17 @@ const commitCalls = (bound) => {
107
108
  const { bases } = yield* mergeBases(read, {
108
109
  ...input,
109
110
  commits: [base, head]
110
- }, call);
111
+ }, call, roots);
111
112
  const ahead = yield* countHistory(read, {
112
113
  ...input,
113
114
  wants: [head],
114
115
  haves: [base]
115
- }, call);
116
+ }, call, roots);
116
117
  const behind = yield* countHistory(read, {
117
118
  ...input,
118
119
  wants: [base],
119
120
  haves: [head]
120
- }, call);
121
+ }, call, roots);
121
122
  const page = innerPage(input.commits, commitsHeld);
122
123
  const listed = {
123
124
  ...input,
@@ -125,7 +126,7 @@ const commitCalls = (bound) => {
125
126
  haves: [base],
126
127
  page
127
128
  };
128
- const commits = input.commits?.limit === 0 ? { items: [] } : yield* walkHistory(read, listed, call);
129
+ const commits = input.commits?.limit === 0 ? { items: [] } : yield* walkHistory(read, listed, call, roots);
129
130
  return {
130
131
  first: bases[0],
131
132
  ahead,
@@ -41,7 +41,7 @@ const mergeCalls = (bound) => {
41
41
  const { bases } = yield* mergeBases(opened.read, {
42
42
  ...input,
43
43
  commits
44
- }, call);
44
+ }, call, opened.roots);
45
45
  if (bases.includes(theirs)) return { oid: tip };
46
46
  const [base] = bases;
47
47
  if (base === void 0) return yield* fail("FAILED_PRECONDITION", "refusing to merge unrelated histories", { hint: `${input.theirs} shares no history with ${ours}` });
@@ -3,9 +3,9 @@ import { isOid } from "../../protocol/bytes/text.mjs";
3
3
  import { badCursor, deadlineOf, inputDigest, readThrough } from "../../engine/reads.mjs";
4
4
  import { DiffReader, ReadTally } from "../../protocol/diff/read.mjs";
5
5
  import { decodePacks } from "../../store/git-store.mjs";
6
- import { readRecord } from "../../store/repo-record.mjs";
6
+ import { readRecord, rootsOf } from "../../store/repo-record.mjs";
7
7
  import { WholeRepo } from "../../store/ref-rows.mjs";
8
- import { collections } from "../../store/scopes.mjs";
8
+ import { collections, repoRootsKey } from "../../store/scopes.mjs";
9
9
  import { indexRowKey } from "../../storage/layout.mjs";
10
10
  import { isVisibleTooLong } from "../../storage/visible.mjs";
11
11
  import { heldOf as heldOf$1 } from "../../storage/wants.mjs";
@@ -54,6 +54,8 @@ const refReads = (names) => names.map((id) => ({
54
54
  }));
55
55
  const packsRead = { collection: collections.packs };
56
56
  const everyRef = { collection: collections.refs };
57
+ /** The reads every open makes first, at fixed places: the packs, then the repo's roots. */
58
+ const openReads = [packsRead, repoRootsKey];
57
59
  /**
58
60
  * The repo `repo` names, opened for `caller` to read, with `revisions` resolved: each a full ID as
59
61
  * it is, `HEAD` the default branch's tip, and a ref name the first of its refs held. A revision
@@ -88,10 +90,10 @@ const openKeyedRead = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo,
88
90
  reads
89
91
  }, opened);
90
92
  });
91
- /** The refs each revision may name, and the reads of them and the packs a repo opens with. */
93
+ /** The refs each revision may name, and the reads of them, the packs and roots a repo opens with. */
92
94
  const readsOf = (revisions) => Effect.map(askedOf(revisions), (asked) => ({
93
95
  asked,
94
- reads: [packsRead, ...refReads([...new Set(asked.flat())])]
96
+ reads: [...openReads, ...refReads([...new Set(asked.flat())])]
95
97
  }));
96
98
  /** `listed`'s objects a batch at a time, with no walk: each batch `objectsOnce`, in `scope`. */
97
99
  const oneShotObjects = (seen, listed, scope) => {
@@ -112,23 +114,30 @@ const readOpened = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, re
112
114
  let index;
113
115
  const view = yield* viewOf(caller, opened);
114
116
  const every = yield* view.narrowed;
117
+ const roots = yield* rootsOf(results[1]);
118
+ let refsAt = openReads.length;
115
119
  if (revisions.includes("HEAD") || every) {
116
120
  const again = yield* readRecord(core.store, opened.internalId, every ? [
117
121
  packsRead,
118
122
  everyRef,
119
123
  indexRowKey
120
- ] : [...reads, ...refReads([record.defaultBranch])]);
124
+ ] : [
125
+ packsRead,
126
+ ...reads.slice(openReads.length),
127
+ ...refReads([record.defaultBranch])
128
+ ]);
121
129
  if (again.record === void 0 || again.record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${repo}'`);
122
130
  record = again.record;
123
131
  results = again.snapshot.results.slice(1);
124
132
  version = again.snapshot.version;
133
+ refsAt = 1;
125
134
  if (every) {
126
135
  index = results[2]?.[0]?.value;
127
136
  results = results.slice(0, 2);
128
137
  }
129
138
  }
130
139
  const packs = yield* decodePacks(results[0] ?? []);
131
- const held = yield* view.refs(results.slice(1).flat());
140
+ const held = yield* view.refs(results.slice(refsAt).flat());
132
141
  const listed = {
133
142
  repo: opened.internalId,
134
143
  version,
@@ -139,7 +148,8 @@ const readOpened = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, re
139
148
  at: {
140
149
  listed,
141
150
  refs: held,
142
- index
151
+ index,
152
+ roots
143
153
  }
144
154
  });
145
155
  const starting = (prefix) => startingOnce(objectsFace(objects), listed, {
@@ -180,7 +190,8 @@ const readOpened = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, re
180
190
  allotment,
181
191
  scoped: reader !== void 0,
182
192
  oids,
183
- objects
193
+ objects,
194
+ roots
184
195
  };
185
196
  });
186
197
  /** A short ID, as `git rev-parse` reads one: 4 hex digits, Git's least, up to one short of whole. */
@@ -228,7 +239,8 @@ const noObject = "0".repeat(40);
228
239
  /**
229
240
  * Which of `oids` the refs `caller` sees of `resolved` reach, or `undefined` when its view isn't
230
241
  * narrowed, so it reads every object and nothing is read here. Else one read of the repo's packs,
231
- * every ref and its `index` row at one version, as `readOpened` makes for a narrowed view, and
242
+ * every ref, its `index` row and its roots at one version, as `readOpened` makes for a narrowed
243
+ * view, and
232
244
  * one lookup of them all beside `noObject`, so where an index covers the listing the lookup's reads
233
245
  * are the same whichever of them the repo holds. Where none does, as with Git's reads by ID, an ID
234
246
  * the repo holds walks the caller's history and a missing one doesn't, so the reads differ, and
@@ -244,11 +256,13 @@ const seenIn = /* @__PURE__ */ Effect.fnUntraced(function* (caller, resolved, oi
244
256
  const { record, snapshot } = yield* readRecord(core.store, resolved.internalId, [
245
257
  packsRead,
246
258
  everyRef,
247
- indexRowKey
259
+ indexRowKey,
260
+ repoRootsKey
248
261
  ]);
249
262
  if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${resolved.name}'`);
250
- const [, packRows = [], refRows = [], indexRows = []] = snapshot.results;
263
+ const [, packRows = [], refRows = [], indexRows = [], rootRows] = snapshot.results;
251
264
  const packs = yield* decodePacks(packRows);
265
+ const roots = yield* rootsOf(rootRows);
252
266
  const listed = {
253
267
  repo: resolved.internalId,
254
268
  version: snapshot.version,
@@ -258,7 +272,8 @@ const seenIn = /* @__PURE__ */ Effect.fnUntraced(function* (caller, resolved, oi
258
272
  listed,
259
273
  refs: yield* view.refs(refRows),
260
274
  refRows,
261
- index: indexRows[0]?.value
275
+ index: indexRows[0]?.value,
276
+ roots
262
277
  };
263
278
  const objects = yield* read({
264
279
  view,
@@ -416,7 +431,7 @@ const readerOf = (opened, limits, reason) => Effect.map(deadlineOf(limits.millis
416
431
  deadline
417
432
  };
418
433
  return {
419
- reader: new DiffReader(readThrough(opened.read, deadline), limits.reads, call.tally),
434
+ reader: new DiffReader(readThrough(opened.read, deadline), limits.reads, call.tally, void 0, opened.roots),
420
435
  deadline,
421
436
  call
422
437
  };
@@ -186,7 +186,7 @@ const treeCalls = (bound) => {
186
186
  theirs
187
187
  ],
188
188
  make: Effect.fnUntraced(function* (opened, made) {
189
- const merged = yield* (yield* mergePartsOrOff).mergeTrees(opened.read, mergeInput(input), callAllot(opened));
189
+ const merged = yield* (yield* mergePartsOrOff).mergeTrees(opened.read, mergeInput(input), callAllot(opened), void 0, opened.roots);
190
190
  yield* takeWrites(made, merged.objects);
191
191
  const { renamesSkipped } = merged;
192
192
  return renamesSkipped === void 0 ? { oid: merged.tree } : {
@@ -200,6 +200,7 @@ const objectWrite = (write) => Effect.scoped(Effect.gen(function* () {
200
200
  },
201
201
  repo: access
202
202
  })), input.internalId);
203
+ if (keyed?.kind === "answered" && keyed.deleted) return yield* fail("NOT_FOUND", `No repo '${repo}'`);
203
204
  if (keyed?.kind === "answered") {
204
205
  const { oid, published, renamesSkipped } = yield* objectAnswer(keyed.receipt);
205
206
  const object = () => readMade(keyed.repo, oid);
@@ -8,6 +8,7 @@ import { HeldGrants } from "../auth/grants.mjs";
8
8
  import { CursorSeal } from "../store/cursor-seal.mjs";
9
9
  import { EventLog } from "../contracts/events.mjs";
10
10
  import { HiddenRefs } from "../protocol/wire/lines.mjs";
11
+ import { IndexLost } from "./index-lost.mjs";
11
12
  import { PushChecks } from "./access.mjs";
12
13
  import { RefIndex } from "./ref-index.mjs";
13
14
  import { SealedObjects } from "./view.mjs";
@@ -76,6 +77,12 @@ export interface CoreFields {
76
77
  * objects keep no index, as `loose()`'s don't.
77
78
  */
78
79
  readonly indexJobRow?: (round: number | 'deleted') => JobInput;
80
+ /**
81
+ * A read's ask for the rebuild of an `index` row whose files fail their own checks: the row's
82
+ * `git.index` round, added once a row while the server runs (`indexLostAsk`). None where the
83
+ * objects keep no index.
84
+ */
85
+ readonly indexLost?: IndexLost;
79
86
  /**
80
87
  * The repo's `git.purge` row for its delete at `at` to save, due once a fetch begun before it has
81
88
  * had its `fetchLimits` time, as a `leaving` row waits (Q265). None on a client, which runs no jobs.
@@ -1,4 +1,3 @@
1
- import { noScope } from "../store/call-count.mjs";
2
1
  import { answerSpent } from "../store/errors.mjs";
3
2
  import * as Effect from "effect/Effect";
4
3
  import * as Schema from "effect/Schema";
@@ -36,19 +35,6 @@ const guardedCall = (through) => (effect) => through(answerSpent(effect));
36
35
  /** `calls`, each a seam's call that `guardedCall` runs `through` the server's door. */
37
36
  const guardedCalls = (calls, through) => aroundCalls(calls, guardedCall(through));
38
37
  /**
39
- * The Promise surface over `calls` for a host's code, each call its Effect twin run by `run` with
40
- * the input's `signal`, in no request's scope: a host's own calls count into none. Every call here
41
- * answers a `Result`, which `EffectCalls` turns into the error channel.
42
- */
43
- const promiseCalls = (calls, run) => {
44
- const entries = Object.entries(calls).map(([name, value]) => {
45
- if (!isCall(value)) return [name, promiseCalls(value, run)];
46
- const call = (...args) => run(value(...args), noScope, signalOf(args));
47
- return [name, call];
48
- });
49
- return Object.fromEntries(entries);
50
- };
51
- /**
52
38
  * Each group `names` holds, each call in it answering `call` with the group's name, its own and its
53
39
  * arguments: a server's calls, made before its runtime is built.
54
40
  */
@@ -85,4 +71,4 @@ const callOf = (calls, group, name) => {
85
71
  if (!isCall(found)) throw new TypeError(`The server has no call ${group}.${name}`);
86
72
  return found;
87
73
  };
88
- export { aroundCalls, callOf, callOrMissing, guardedCall, guardedCalls, heldGroup, lazyGroups, noDoor, promiseCalls, providedCalls, signalOf };
74
+ export { aroundCalls, callOf, callOrMissing, guardedCall, guardedCalls, heldGroup, lazyGroups, noDoor, providedCalls, signalOf };
@@ -38,9 +38,10 @@ const publishesRead = (ref, count, from, pattern) => gitError("NOT_ALLOWED", `Mo
38
38
  const publishesUnread = (ref) => gitError("NOT_ALLOWED", `Moving ${shortRef(ref)} would publish commits you may not publish`, { hint: "Ask the repo's owner" });
39
39
  /**
40
40
  * The commits `tip` reaches that `audience` doesn't, read through `objects`: a walk from the tip
41
- * down to the first commits the audience reaches, the push's own new commits among them.
41
+ * down to the first commits the audience reaches, the push's own new commits among them, and
42
+ * through no parent of `roots`.
42
43
  */
43
- const exposedFrom = /* @__PURE__ */ Effect.fnUntraced(function* (objects, listed, tip, audience, signal) {
44
+ const exposedFrom = /* @__PURE__ */ Effect.fnUntraced(function* (objects, listed, tip, audience, roots, signal) {
44
45
  const call = signal === void 0 ? {} : { signal };
45
46
  const exposed = [];
46
47
  const passed = /* @__PURE__ */ new Set([tip]);
@@ -58,7 +59,7 @@ const exposedFrom = /* @__PURE__ */ Effect.fnUntraced(function* (objects, listed
58
59
  for (const object of found) {
59
60
  if (object === void 0) continue;
60
61
  if (object.type === "commit") exposed.push(object.oid);
61
- const steps = yield* stepsOf(object, false);
62
+ const steps = yield* stepsOf(object, false, roots);
62
63
  for (const oid of onward(steps)) {
63
64
  if (passed.has(oid)) continue;
64
65
  passed.add(oid);
@@ -108,7 +109,10 @@ const unpublished = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
108
109
  most: ancestryLimit,
109
110
  commits: true
110
111
  };
111
- const walkOf = (tips) => walkedVisible(input.objects, input.listed, { tips }, bound);
112
+ const walkOf = (tips) => walkedVisible(input.objects, input.listed, {
113
+ tips,
114
+ roots: input.roots
115
+ }, bound);
112
116
  const reach = (tips) => input.visible === void 0 ? walkOf(tips) : input.visible(tips, () => walkOf(tips));
113
117
  const named = [...refs].toSorted(([one], [other]) => one < other ? -1 : 1);
114
118
  const tipsOf = (keep) => named.flatMap(([ref, oid]) => keep(access.patternOf(ref)) ? [oid] : []);
@@ -123,7 +127,7 @@ const unpublished = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
123
127
  const own = access.patternOf(edit.ref);
124
128
  const audience = audiences.get(own) ?? reach(tipsOf((one) => one === void 0 || one === own));
125
129
  audiences.set(own, audience);
126
- let left = yield* exposedFrom(input.pushed, input.pushedListed, to, audience, input.signal);
130
+ let left = yield* exposedFrom(input.pushed, input.pushedListed, to, audience, input.roots, input.signal);
127
131
  for (const [pattern, set] of walked) {
128
132
  if (left.length === 0) break;
129
133
  if (pattern === own || !publishable(refView, pattern)) continue;
@@ -5,9 +5,10 @@ import { forkedFrom, reconcile, releaseHold } from "../store/catalogue.mjs";
5
5
  import { storeCall } from "../store/errors.mjs";
6
6
  import { gitJob, repoTry } from "../store/job-try.mjs";
7
7
  import { outboxCollections } from "../store/outbox.mjs";
8
+ import { keyKept } from "../store/records.mjs";
8
9
  import { readRecord } from "../store/repo-record.mjs";
9
10
  import { collections, newChangeId, repoScope } from "../store/scopes.mjs";
10
- import { isDeliverJob } from "./events/deliver.mjs";
11
+ import { isDeliverJob, sentThrough } from "./events/deliver.mjs";
11
12
  import { indexJobName } from "./index-job.mjs";
12
13
  import * as Effect from "effect/Effect";
13
14
  import * as Schema from "effect/Schema";
@@ -46,10 +47,11 @@ const purgeLargePage = /* @__PURE__ */ Math.floor(limits.answerBytes / limits.va
46
47
  * The jobs whose work a purge waits for, while one is waiting, running or failed in the repo's
47
48
  * scope: git.repack's moves its packs' bytes out and runs its upkeep's, git.index's deleted round
48
49
  * deletes its index's files, and each delivery's, `git.deliver.<name>`, sends `repo.deleted`. A
49
- * failed one holds the purge until a host retries or discards it. A new job that deletes a repo's
50
- * bytes joins this list, or its check below. Every
51
- * other job ends on the record the purge deletes last: git.list's projection the purge runs itself
52
- * before it.
50
+ * failed one holds the purge until a host retries or discards it. A delivery's waiting job that
51
+ * has sent `repo.deleted` holds it no longer, since it waits only to trim events the purge
52
+ * deletes itself. A new job that deletes a repo's bytes joins this list, or its check below.
53
+ * Every other job ends on the record the purge deletes last: git.list's projection the purge runs
54
+ * itself before it.
53
55
  */
54
56
  const drainJobs = /* @__PURE__ */ new Set([repackJobName, indexJobName]);
55
57
  /**
@@ -121,16 +123,19 @@ const relookFor = (item, at) => {
121
123
  };
122
124
  /**
123
125
  * When a purge at `at` looks again for the drain jobs and deliveries waiting, running or failed in
124
- * `scope`, the soonest of theirs: none when none is left. A page of its jobs at a time.
126
+ * `scope`, the soonest of theirs: none when none is left. A page of its jobs at a time. `deleted`
127
+ * is `repo.deleted`'s `seq`, past which a waiting delivery holds nothing; with none, each holds.
125
128
  */
126
- const draining = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope, at) {
129
+ const draining = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope, at, deleted) {
127
130
  let after;
128
131
  let soonest;
129
132
  for (;;) {
130
133
  const page = after === void 0 ? {} : { page: { after } };
131
134
  const listing = yield* storeCall(() => store.list(scope, page));
132
135
  for (const item of listing.items) {
133
- if (!drainJobs.has(item.name) && !isDeliverJob(item)) continue;
136
+ const delivery = isDeliverJob(item);
137
+ if (!drainJobs.has(item.name) && !delivery) continue;
138
+ if (delivery && item.state === "waiting" && deleted !== void 0 && (yield* sentThrough(store, scope, item, deleted))) continue;
134
139
  const relook = relookFor(item, at);
135
140
  soonest = soonest === void 0 ? relook : Math.min(soonest, relook);
136
141
  }
@@ -212,7 +217,8 @@ const dropScopes = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
212
217
  });
213
218
  /**
214
219
  * One step in the repo's scope: none for a repo that isn't deleted. It waits until its delete's
215
- * `fetchLimits` has passed, then while a drain job or a drained row stands, or a fork holds the
220
+ * `fetchLimits` has passed, nor while a receipt it holds still answers, `keyKept` past the delete;
221
+ * then while a drain job or a drained row stands, or a fork holds the
216
222
  * repo, each wait till its own time to look again; else each part's step, then a page of
217
223
  * `purgeCollections`, then the fork's hold on its source, then the record, then the drops. A repo
218
224
  * with no record is one whose record this purge deleted, since only a delete queues it: its
@@ -224,7 +230,11 @@ const purgeStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, int
224
230
  collection,
225
231
  limit: 1
226
232
  }));
227
- const { record, snapshot } = yield* readRecord(store, internalId, drainedReads);
233
+ const receiptRead = {
234
+ collection: collections.receiptIndex,
235
+ limit: 1
236
+ };
237
+ const { record, snapshot } = yield* readRecord(store, internalId, [...drainedReads, receiptRead]);
228
238
  if (record === void 0) return yield* dropScopes(parts, store, internalId);
229
239
  if (record.deleted !== true) return void 0;
230
240
  const at = yield* parts.now;
@@ -233,16 +243,24 @@ const purgeStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, int
233
243
  ...again,
234
244
  at: guard
235
245
  };
246
+ const drained = snapshot.results.slice(1, 1 + drainedReads.length);
247
+ const receipts = snapshot.results[1 + drainedReads.length] ?? [];
248
+ const answering = record.changedAt + keyKept;
249
+ if (receipts.length > 0 && at < answering) return {
250
+ ...again,
251
+ at: answering
252
+ };
236
253
  const backstop = {
237
254
  ...again,
238
255
  at: at + purgeBackstop
239
256
  };
240
- const drain = yield* draining(store, scope, at);
257
+ const deleted = record.nextSeq === void 0 ? void 0 : record.nextSeq - 1;
258
+ const drain = yield* draining(store, scope, at, deleted);
241
259
  if (drain !== void 0) return {
242
260
  ...again,
243
261
  at: drain
244
262
  };
245
- if (snapshot.results.slice(1).some((rows) => rows.length > 0)) return backstop;
263
+ if (drained.some((rows) => rows.length > 0)) return backstop;
246
264
  if (yield* forkedFrom(store, internalId)) return backstop;
247
265
  for (const part of parts.parts) {
248
266
  const step = yield* part(store, internalId);
@@ -10,9 +10,10 @@ import { noLfsPointers } from "../storage/lfs-pointers.mjs";
10
10
  import { isShallowRoot } from "../storage/links.mjs";
11
11
  import { isAwaitingRepack } from "../storage/repack-backlog.mjs";
12
12
  import { allottedRows } from "../storage/allotted.mjs";
13
- import { gitObjectOf, objectOfRow, receivedRows } from "../storage/object-rows.mjs";
13
+ import { gitObjectOf, noRows, objectOfRow, receivedRows } from "../storage/object-rows.mjs";
14
14
  import { pruneClearedKey } from "../storage/prune.mjs";
15
15
  import { abandonOwn } from "../storage/quarantine.mjs";
16
+ import { readyBytesOf, readyKey } from "../storage/ready.mjs";
16
17
  import { QuarantineRow, decodeHeld } from "../storage/rows.mjs";
17
18
  import { bestEffort, decodeRow, fromInfra, storeCall } from "../store/errors.mjs";
18
19
  import { callScope } from "../store/call-count.mjs";
@@ -23,13 +24,14 @@ import { sliceOf } from "../protocol/wire/push-limits.mjs";
23
24
  import { pushCounts } from "./events/seen.mjs";
24
25
  import { refViewIn } from "./ref-view.mjs";
25
26
  import { appendEvents, decodeOutbox, firstSeq, outboxReads, repoEnvelope } from "../store/outbox.mjs";
27
+ import { rowsAtCommit } from "./loose-tally.mjs";
26
28
  import { MirrorRow } from "./mirror-rows.mjs";
27
29
  import { PrunedMark, mirrorJobName } from "../store/records.mjs";
28
- import { decodeTimes, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
30
+ import { decodeStats, looseRows, readRecord, repoStats, rootsOf, timeRow } from "../store/repo-record.mjs";
29
31
  import { advanceRow } from "../store/queue-jobs.mjs";
30
32
  import { liveReservations, reservedTarget } from "../store/reservations.mjs";
31
33
  import { settleName } from "../store/settle.mjs";
32
- import { collections, newChangeId, prunedKey, pushedKey, pushedUnder, reachedKey, repoScope } from "../store/scopes.mjs";
34
+ import { collections, newChangeId, prunedKey, pushedKey, pushedUnder, reachedKey, repoRootsKey, repoScope } from "../store/scopes.mjs";
33
35
  import { headOf, indexJobs, openKeyed, openRepo, refIndexJobs, repoAccess } from "./access.mjs";
34
36
  import { kindsOf } from "./ancestry.mjs";
35
37
  import { isRefName } from "./names.mjs";
@@ -195,12 +197,20 @@ const markOf = (rows) => {
195
197
  const firstRead = (caller, operation, internalId) => openRepo(caller, {
196
198
  kind: "read",
197
199
  repo: operation.repo
198
- }, [packsRead, prunedKey], internalId, "skip");
200
+ }, [
201
+ packsRead,
202
+ prunedKey,
203
+ repoRootsKey
204
+ ], internalId, "skip");
199
205
  /** `firstRead` for a keyed push: `undefined` once `missed`'s repo moved, as `openKeyed` says. */
200
206
  const keyedRead = (caller, operation, missed, internalId) => openKeyed(caller, {
201
207
  kind: "read",
202
208
  repo: operation.repo
203
- }, [packsRead, prunedKey], missed, internalId, "skip");
209
+ }, [
210
+ packsRead,
211
+ prunedKey,
212
+ repoRootsKey
213
+ ], missed, internalId, "skip");
204
214
  /**
205
215
  * The first read's repo once `authorize` lets the caller push to it: its list, for the pack to be
206
216
  * received against, its default branch, whose move rebuilds the ready shallow pack, and its
@@ -221,12 +231,14 @@ const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operatio
221
231
  packs
222
232
  };
223
233
  const mark = yield* markOf(resolved.snapshot.results[2] ?? []);
234
+ const roots = yield* rootsOf(resolved.snapshot.results[3]);
224
235
  const views = yield* Effect.forEach(decidingFor(request), (one) => viewOf(one, resolved, request.as));
225
236
  const [view = yield* viewOf(caller, resolved, request.as)] = views;
226
237
  return {
227
238
  listed,
228
239
  defaultBranch: headOf(resolved.record.defaultBranch),
229
240
  mark,
241
+ roots,
230
242
  repo,
231
243
  view,
232
244
  views
@@ -236,13 +248,15 @@ const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operatio
236
248
  * The refs a push's objects follow, for its view: none read when the view's objects are whole, as
237
249
  * for a caller who sees every ref of a repo that isn't a fork under `access`; else every ref the
238
250
  * caller sees, read after `authorize` let the caller in, at a version of their own, which the
239
- * push's objects read at too.
251
+ * push's objects read at too. `roots` are the first read's: only an import's landing writes them,
252
+ * before any ref moves.
240
253
  */
241
- const seenRefsOf = /* @__PURE__ */ Effect.fnUntraced(function* (view, listed) {
254
+ const seenRefsOf = /* @__PURE__ */ Effect.fnUntraced(function* (view, listed, roots) {
242
255
  const core = yield* CoreParts;
243
256
  if (!(yield* view.narrowed)) return {
244
257
  listed,
245
- refs: /* @__PURE__ */ new Map()
258
+ refs: /* @__PURE__ */ new Map(),
259
+ roots
246
260
  };
247
261
  const { snapshot } = yield* readRecord(core.store, listed.repo, [
248
262
  refsRead,
@@ -259,7 +273,8 @@ const seenRefsOf = /* @__PURE__ */ Effect.fnUntraced(function* (view, listed) {
259
273
  packs
260
274
  },
261
275
  refs,
262
- index: indexRows[0]?.value
276
+ index: indexRows[0]?.value,
277
+ roots
263
278
  };
264
279
  });
265
280
  /**
@@ -429,6 +444,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
429
444
  cruftRead,
430
445
  indexRowKey,
431
446
  reachedKey,
447
+ readyKey,
432
448
  ...own,
433
449
  ...keyed,
434
450
  ...targets,
@@ -445,7 +461,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
445
461
  ], rowCounts);
446
462
  if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${repo.name}'`);
447
463
  const [, refRows = [], headRows = [], cursorRows = [], packRows = [], ...more] = snapshot.results;
448
- const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], reachedRows = [], ...rest] = more;
464
+ const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], reachedRows = [], readyRows = [], ...rest] = more;
449
465
  const receipt = yield* heldReceipt(rest.slice(own.length, own.length + keyed.length), kept);
450
466
  if (receipt === void 0 && (yield* markOf(markRows)) !== mark) return yield* fail("UNAVAILABLE", "The repo was pruned during the push", { hint: "Push again" });
451
467
  const targeted = rest.slice(own.length + keyed.length, own.length + keyed.length + targets.length);
@@ -464,7 +480,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
464
480
  const mirrorRows = rest.slice(guardedAt + unchanged.length).flat();
465
481
  const changed = unchanged.some((row, at) => !Equal.equals(row.value, now[at]?.[0]?.value));
466
482
  const packs = yield* decodePacks(packRows);
467
- const times = yield* decodeTimes(timeRows);
483
+ const times = yield* decodeStats(timeRows);
468
484
  const [ownRow] = own.length === 0 ? [] : rest[0] ?? [];
469
485
  const refs = yield* wholeRefs(pushWhole, refRows);
470
486
  const outbox = yield* decodeOutbox([headRows, cursorRows]);
@@ -499,7 +515,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
499
515
  tips: /* @__PURE__ */ new Map(),
500
516
  revoked: revoked !== void 0
501
517
  };
502
- const stats = repoStats(record, refs.size, packs, times);
518
+ const stats = repoStats(record, refs.size, packs, times, yield* readyBytesOf(readyRows));
503
519
  const [indexRow] = indexRows;
504
520
  return {
505
521
  read,
@@ -526,7 +542,7 @@ const settingsOf = (record) => ({
526
542
  const runChecks = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, facts) {
527
543
  const context = checking(input);
528
544
  const ruled = yield* registeredAfter(checks, input, yield* runPushRules(checks, input, context));
529
- const whole = yield* runHookGroups(checks.reports, checks.groups?.() ?? [], context, {
545
+ const whole = yield* runHookGroups(checks.groups?.() ?? [], context, {
530
546
  atomic: input.atomic,
531
547
  updates: ruled.updates,
532
548
  refused: ruled.refused
@@ -823,14 +839,14 @@ const lists = (body, pack) => body.delete.some((key) => key.collection === objec
823
839
  * only, refused as the commit would be, its `writes` or none, and answered before it, for
824
840
  * `checkPush`: nothing before that point writes, reserves or enqueues, with no pack.
825
841
  */
826
- const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, view, views }, key, answers, checking = false) => Effect.scoped(Effect.gen(function* () {
842
+ const pushOnto = (request, { listed, defaultBranch, mark, roots, repo: checkedRepo, view, views }, key, answers, checking = false) => Effect.scoped(Effect.gen(function* () {
827
843
  const core = yield* CoreParts;
828
844
  const { objects: sealed } = yield* ObjectsParts;
829
845
  const authorize = yield* Authorize;
830
846
  const { store } = core;
831
847
  const { caller, repo, signal } = request;
832
848
  const call = signal === void 0 ? {} : { signal };
833
- const seen = yield* seenRefsOf(view, listed);
849
+ const seen = yield* seenRefsOf(view, listed, roots);
834
850
  const { received, rooted } = yield* receive(yield* read({
835
851
  view,
836
852
  at: seen
@@ -860,6 +876,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
860
876
  listed: pushedListed,
861
877
  pushed,
862
878
  edits: request.edits,
879
+ roots,
863
880
  ...call
864
881
  };
865
882
  if (rooted !== void 0) kindsInput.missing = rooted;
@@ -898,9 +915,11 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
898
915
  refs: publishedRefs(refs),
899
916
  objects: whole,
900
917
  listed: at,
918
+ roots,
901
919
  visible: (tips, fallback) => SealedObjects.visibleWhole(sealed, pushWhole, at, {
902
920
  tips,
903
- row: index?.value
921
+ row: index?.value,
922
+ roots
904
923
  }, fallback),
905
924
  pushed: wholePushed,
906
925
  pushedListed: withReceived(at, received),
@@ -1118,12 +1137,16 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
1118
1137
  const kept = receiptWrites(key, answers.kept(final), core.repackJobRow);
1119
1138
  const woken = shown.filter((move) => queued.has(move.ref)).map((move) => advanceRow(move.ref));
1120
1139
  const pushed = pushedRows(core.access, shown, times, at);
1140
+ const moved = received === void 0 || !planned.moves ? noRows : yield* rowsAtCommit(store, listed.repo, received.change, read.version);
1141
+ if (moved === void 0) continue;
1142
+ const loose = looseRows(times.loose, moved);
1121
1143
  const body = {
1122
1144
  id,
1123
1145
  expect: planned.expect,
1124
1146
  put: [
1125
1147
  ...change.put,
1126
1148
  ...pushed,
1149
+ ...loose,
1127
1150
  ...kept.put,
1128
1151
  ...also?.put ?? [],
1129
1152
  ...appended.put,
@@ -113,12 +113,12 @@ const memoKey = (internalId, caller) => Effect.map(grantOf(caller), (grant) => J
113
113
  /** `caller`'s ref view of `repo`'s refs, asked of `authorize` each time it runs: no held answer. */
114
114
  /** The prefixes of the registry's table, as `AccessOption.refViewOf` takes them. */
115
115
  const prefixesOf = (table) => table.map(({ owner }) => owner.prefix);
116
- const askRefView = (access, caller, repo, hidden) => {
116
+ const askRefView = (access, caller, about, hidden) => {
117
117
  if (access === void 0) return Effect.succeed(wholeView);
118
118
  return Effect.map(Effect.suspend(() => audience({
119
119
  caller,
120
- repo,
121
- patterns: access.patterns
120
+ patterns: access.patterns,
121
+ ...about
122
122
  })), (audience) => access.refViewOf(audience, hidden));
123
123
  };
124
124
  /** `caller`'s ref view of `repo`'s refs, asked of `authorize` once per request at most. */
@@ -127,7 +127,7 @@ const refViewIn = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo) {
127
127
  if (access === void 0) return wholeView;
128
128
  const hidden = prefixesOf(hiddenRefs());
129
129
  const authorize = yield* Authorize;
130
- const ask = Effect.provideService(askRefView(access, caller, repo, hidden), Authorize, authorize);
130
+ const ask = Effect.provideService(askRefView(access, caller, { repo }, hidden), Authorize, authorize);
131
131
  const memo = yield* Effect.serviceOption(AudienceMemo);
132
132
  if (Option.isNone(memo)) return yield* ask;
133
133
  const key = yield* memoKey(repo.internalId, caller);
@@ -166,6 +166,14 @@ const accessAgain = /* @__PURE__ */ Effect.fnUntraced(function* (caller, kind, r
166
166
  const refViewAgain = /* @__PURE__ */ Effect.fnUntraced(function* (caller, kind, repo) {
167
167
  const { access, hiddenRefs } = yield* CoreParts;
168
168
  yield* accessAgain(caller, kind, repo);
169
- return yield* askRefView(access, caller, repo, prefixesOf(hiddenRefs()));
169
+ return yield* askRefView(access, caller, { repo }, prefixesOf(hiddenRefs()));
170
170
  });
171
- export { AudienceMemo, ViewedMemo, accessAgain, refViewAgain, refViewIn, seesJob, viewedIn, wholeView, withAudienceMemo };
171
+ /**
172
+ * `caller`'s ref view of the repo an import is about to make as `name`, asked of `authorize` as
173
+ * `repo.create` is, with the name and no repo: afresh, since no repo is there to hold it by.
174
+ */
175
+ const creatingRefView = /* @__PURE__ */ Effect.fnUntraced(function* (caller, name) {
176
+ const { access, hiddenRefs } = yield* CoreParts;
177
+ return yield* askRefView(access, caller, { creating: name }, prefixesOf(hiddenRefs()));
178
+ });
179
+ export { AudienceMemo, ViewedMemo, accessAgain, creatingRefView, refViewAgain, refViewIn, seesJob, viewedIn, wholeView, withAudienceMemo };