@ref0/git 0.3.0 → 0.6.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.
- package/dist/_virtual/_rolldown/runtime.mjs +12 -0
- package/dist/access/private-refs.d.mts +12 -9
- package/dist/access/private-refs.mjs +70 -48
- package/dist/auth/access-jwt.mjs +7 -7
- package/dist/auth/auth.d.mts +41 -0
- package/dist/auth/auth.mjs +39 -0
- package/dist/auth/authorize.mjs +65 -83
- package/dist/auth/bridge.mjs +30 -0
- package/dist/auth/fences.d.mts +22 -2
- package/dist/auth/fences.mjs +3 -3
- package/dist/auth/grants.d.mts +25 -0
- package/dist/auth/grants.mjs +29 -34
- package/dist/auth/helpers.mjs +4 -4
- package/dist/auth/host-function.d.mts +9 -2
- package/dist/auth/host-function.mjs +35 -8
- package/dist/auth/identify.d.mts +7 -2
- package/dist/auth/identify.mjs +9 -11
- package/dist/auth/namespaces.d.mts +3 -0
- package/dist/auth/policy.d.mts +57 -0
- package/dist/auth/policy.mjs +56 -0
- package/dist/auth/token-rows.mjs +6 -6
- package/dist/auth/token-text.mjs +16 -4
- package/dist/auth/tokens.d.mts +3 -0
- package/dist/auth/tokens.mjs +63 -24
- package/dist/auth.d.mts +2 -1
- package/dist/auth.mjs +2 -1
- package/dist/client/answer.mjs +49 -11
- package/dist/client/client.d.mts +2 -2
- package/dist/client/client.mjs +3 -3
- package/dist/client/git-http.d.mts +6 -0
- package/dist/client/git-http.mjs +23 -36
- package/dist/client/helper-node.d.mts +12 -0
- package/dist/client/helper-node.mjs +108 -5
- package/dist/client/local.mjs +96 -99
- package/dist/client/negotiate.mjs +10 -8
- package/dist/client/push-upload.d.mts +14 -0
- package/dist/client/push-upload.mjs +12 -12
- package/dist/client/remote-helper.mjs +22 -20
- package/dist/client/remote.mjs +28 -22
- package/dist/client/run-remote-helper.d.mts +40 -16
- package/dist/client/run-remote-helper.mjs +147 -154
- package/dist/client/scrub.d.mts +8 -2
- package/dist/client/scrub.mjs +76 -4
- package/dist/client/slice-push.d.mts +77 -0
- package/dist/client/slice-push.mjs +169 -0
- package/dist/client/slice-report.mjs +188 -0
- package/dist/client/slices.d.mts +44 -0
- package/dist/client/slices.mjs +131 -0
- package/dist/client/transport.d.mts +1 -0
- package/dist/client/transport.mjs +30 -26
- package/dist/contracts/access.d.mts +41 -10
- package/dist/contracts/actors.d.mts +28 -10
- package/dist/contracts/actors.mjs +17 -0
- package/dist/contracts/authorize.d.mts +81 -0
- package/dist/contracts/authorize.mjs +25 -0
- package/dist/contracts/blobs.d.mts +48 -15
- package/dist/contracts/blobs.mjs +30 -0
- package/dist/contracts/calls-spent.d.mts +1 -0
- package/dist/contracts/calls-spent.mjs +58 -18
- package/dist/contracts/client.d.mts +14 -16
- package/dist/contracts/commits.d.mts +558 -76
- package/dist/contracts/commits.mjs +147 -0
- package/dist/contracts/engine.d.mts +91 -55
- package/dist/contracts/engine.mjs +103 -0
- package/dist/contracts/events.d.mts +1410 -206
- package/dist/contracts/events.mjs +496 -0
- package/dist/contracts/files.d.mts +295 -50
- package/dist/contracts/files.mjs +100 -0
- package/dist/contracts/forks.d.mts +306 -25
- package/dist/contracts/forks.mjs +39 -0
- package/dist/contracts/git.d.mts +172 -0
- package/dist/contracts/git.mjs +23 -0
- package/dist/contracts/grants.d.mts +7 -2
- package/dist/contracts/ids.d.mts +23 -8
- package/dist/contracts/ids.mjs +40 -5
- package/dist/contracts/lfs.d.mts +12 -4
- package/dist/contracts/merges.d.mts +68 -16
- package/dist/contracts/merges.mjs +27 -0
- package/dist/contracts/namespaces.d.mts +14 -0
- package/dist/contracts/object-values.d.mts +96 -0
- package/dist/contracts/object-values.mjs +104 -0
- package/dist/contracts/objects.d.mts +329 -88
- package/dist/contracts/operations.d.mts +24 -16
- package/dist/contracts/promises.d.mts +10 -11
- package/dist/contracts/push-uploads.d.mts +40 -25
- package/dist/contracts/push-uploads.mjs +54 -0
- package/dist/contracts/queue.d.mts +454 -141
- package/dist/contracts/queue.mjs +197 -0
- package/dist/contracts/refs.d.mts +248 -45
- package/dist/contracts/refs.mjs +117 -0
- package/dist/contracts/repo-records.d.mts +34 -0
- package/dist/contracts/repo-records.mjs +18 -0
- package/dist/contracts/repos.d.mts +411 -58
- package/dist/contracts/repos.mjs +136 -0
- package/dist/contracts/result.d.mts +339 -69
- package/dist/contracts/result.mjs +355 -5
- package/dist/contracts/rules.d.mts +60 -48
- package/dist/contracts/rules.mjs +9 -0
- package/dist/contracts/server.d.mts +124 -51
- package/dist/contracts/services.d.mts +15 -24
- package/dist/contracts/services.mjs +5 -9
- package/dist/contracts/signin.d.mts +64 -31
- package/dist/contracts/signin.mjs +18 -0
- package/dist/contracts/store.d.mts +45 -5
- package/dist/contracts/store.mjs +31 -0
- package/dist/contracts/sync.d.mts +81 -46
- package/dist/contracts/sync.mjs +41 -2
- package/dist/contracts/tags.d.mts +204 -22
- package/dist/contracts/tags.mjs +51 -1
- package/dist/contracts/tokens.d.mts +32 -7
- package/dist/contracts/tokens.mjs +31 -1
- package/dist/contracts/topics.d.mts +123 -67
- package/dist/contracts/topics.mjs +109 -0
- package/dist/contracts/trees.d.mts +132 -52
- package/dist/contracts/trees.mjs +105 -0
- package/dist/contracts/work.d.mts +128 -21
- package/dist/contracts/work.mjs +69 -0
- package/dist/core/access.d.mts +25 -14
- package/dist/core/access.mjs +93 -108
- package/dist/core/ancestry.mjs +86 -18
- package/dist/core/call-names.d.mts +3 -1
- package/dist/core/call-names.mjs +1 -0
- package/dist/core/call-services.mjs +73 -0
- package/dist/core/changes.d.mts +31 -0
- package/dist/core/changes.mjs +5 -0
- package/dist/core/claim-rows.d.mts +4 -0
- package/dist/core/claim-rows.mjs +53 -0
- package/dist/core/clock.mjs +3 -3
- package/dist/core/events/deliver.d.mts +12 -0
- package/dist/core/events/deliver.mjs +454 -146
- package/dist/core/events/seen.mjs +138 -0
- package/dist/core/forks.mjs +435 -161
- package/dist/core/hooks/order.d.mts +9 -0
- package/dist/core/hooks/order.mjs +25 -0
- package/dist/core/hooks/post-receive.mjs +33 -29
- package/dist/core/hooks/pre-receive.d.mts +8 -1
- package/dist/core/hooks/pre-receive.mjs +8 -6
- package/dist/core/imports.mjs +212 -0
- package/dist/core/index-job.mjs +152 -53
- package/dist/core/merge-parts.d.mts +30 -0
- package/dist/core/merge-parts.mjs +31 -0
- package/dist/core/names.mjs +4 -16
- package/dist/core/namespaces.d.mts +2 -0
- package/dist/core/objects/blobs.mjs +4 -4
- package/dist/core/objects/commit-writes.mjs +19 -17
- package/dist/core/objects/commits.mjs +12 -12
- package/dist/core/objects/files.mjs +10 -11
- package/dist/core/objects/lines.mjs +15 -32
- package/dist/core/objects/merges.mjs +4 -4
- package/dist/core/objects/objects-layer.d.mts +21 -0
- package/dist/core/objects/objects-layer.mjs +47 -0
- package/dist/core/objects/objects-namespace.d.mts +6 -0
- package/dist/core/objects/objects-namespace.mjs +13 -0
- package/dist/core/objects/objects.d.mts +49 -0
- package/dist/core/objects/objects.mjs +18 -0
- package/dist/core/objects/peel.mjs +3 -3
- package/dist/core/objects/reading.mjs +135 -40
- package/dist/core/objects/tags.mjs +7 -7
- package/dist/core/objects/tree-edits.mjs +40 -27
- package/dist/core/objects/trees.mjs +23 -18
- package/dist/core/objects/writing.mjs +43 -44
- package/dist/core/own-writes.mjs +3 -3
- package/dist/core/parts.d.mts +131 -0
- package/dist/core/parts.mjs +59 -0
- package/dist/core/promise.mjs +13 -9
- package/dist/core/publish.mjs +27 -17
- package/dist/core/purge.d.mts +8 -0
- package/dist/core/purge.mjs +237 -0
- package/dist/core/push-decide.mjs +116 -29
- package/dist/core/push.mjs +352 -171
- package/dist/core/receipts.d.mts +4 -3
- package/dist/core/receipts.mjs +20 -12
- package/dist/core/ref-conflicts.mjs +70 -4
- package/dist/core/ref-index-job.mjs +176 -0
- package/dist/core/ref-index.d.mts +26 -0
- package/dist/core/ref-index.mjs +156 -0
- package/dist/core/ref-view.mjs +171 -0
- package/dist/core/refs.mjs +318 -98
- package/dist/core/repack.d.mts +11 -0
- package/dist/core/repack.mjs +264 -136
- package/dist/core/repo-info.mjs +99 -0
- package/dist/core/repos.mjs +114 -80
- package/dist/core/rules/changes.mjs +48 -20
- package/dist/core/rules/check.mjs +36 -28
- package/dist/core/rules/commit-changes.d.mts +13 -0
- package/dist/core/rules/commit-changes.mjs +100 -91
- package/dist/core/rules/context.d.mts +67 -8
- package/dist/core/rules/context.mjs +88 -51
- package/dist/core/rules/facts.mjs +1 -1
- package/dist/core/rules/fetch.mjs +24 -26
- package/dist/core/rules/files.d.mts +13 -0
- package/dist/core/rules/files.mjs +27 -28
- package/dist/core/rules/namespace.d.mts +2 -0
- package/dist/core/rules/patterns.mjs +29 -5
- package/dist/core/rules/protect.d.mts +12 -6
- package/dist/core/rules/protect.mjs +22 -20
- package/dist/core/rules/rules-layer.d.mts +17 -0
- package/dist/core/rules/rules-layer.mjs +26 -0
- package/dist/core/rules/rules.d.mts +8 -0
- package/dist/core/rules/rules.mjs +16 -0
- package/dist/core/rules/service.mjs +18 -0
- package/dist/core/seam.d.mts +60 -10
- package/dist/core/seam.mjs +25 -15
- package/dist/core/still-takes.mjs +75 -0
- package/dist/core/tokens.mjs +29 -23
- package/dist/core/view.d.mts +106 -6
- package/dist/core/view.mjs +215 -114
- package/dist/core/work.mjs +40 -14
- package/dist/effect.d.mts +3 -4
- package/dist/effect.mjs +2 -3
- package/dist/engine/allotted-xdiff.d.mts +1 -0
- package/dist/engine/allotted-xdiff.mjs +1 -1
- package/dist/engine/attributes.mjs +1 -1
- package/dist/engine/combined.d.mts +18 -0
- package/dist/engine/combined.mjs +39 -44
- package/dist/engine/commits.mjs +5 -4
- package/dist/engine/content.d.mts +3 -2
- package/dist/engine/content.mjs +2 -2
- package/dist/engine/failures.d.mts +2 -2
- package/dist/engine/failures.mjs +2 -9
- package/dist/engine/merge-base-walk.d.mts +3 -2
- package/dist/engine/merge-base-walk.mjs +1 -1
- package/dist/engine/merge-bases.mjs +3 -2
- package/dist/engine/merge.mjs +568 -566
- package/dist/engine/parts.d.mts +3 -2
- package/dist/engine/parts.mjs +40 -7
- package/dist/engine/reads.d.mts +1 -0
- package/dist/engine/reads.mjs +5 -5
- package/dist/engine/walk.mjs +23 -24
- package/dist/engine/xdiff.d.mts +2 -33
- package/dist/engine/xdiff.mjs +6 -3
- package/dist/event-streams/event-streams.d.mts +25 -0
- package/dist/event-streams/event-streams.mjs +22 -0
- package/dist/event-streams/namespace.d.mts +2 -0
- package/dist/event-streams/stream.d.mts +42 -0
- package/dist/{core/events → event-streams}/stream.mjs +106 -49
- package/dist/extend.d.mts +5 -2
- package/dist/http/answers.mjs +8 -4
- package/dist/http/bodies.mjs +84 -56
- package/dist/http/core-parts.mjs +222 -68
- package/dist/http/handler.d.mts +2 -0
- package/dist/http/handler.mjs +19 -13
- package/dist/http/node.d.mts +2 -23
- package/dist/http/node.mjs +10 -6
- package/dist/http/parts.d.mts +13 -0
- package/dist/http/push-uploads.d.mts +17 -0
- package/dist/http/push-uploads.mjs +94 -87
- package/dist/http/receive-pack.mjs +165 -29
- package/dist/http/upload-pack.mjs +106 -81
- package/dist/index.d.mts +52 -28
- package/dist/index.mjs +31 -7
- package/dist/lfs/base.d.mts +32 -0
- package/dist/lfs/base.mjs +8 -0
- package/dist/lfs/calls.mjs +21 -12
- package/dist/lfs/layer.d.mts +27 -0
- package/dist/lfs/layer.mjs +64 -0
- package/dist/lfs/locks.mjs +36 -46
- package/dist/lfs/namespace.d.mts +2 -0
- package/dist/lfs/objects.d.mts +26 -0
- package/dist/lfs/objects.mjs +83 -94
- package/dist/lfs/pointers.mjs +13 -11
- package/dist/lfs/public.d.mts +5 -0
- package/dist/lfs/public.mjs +8 -0
- package/dist/lfs/purge.mjs +44 -0
- package/dist/lfs/rows.mjs +30 -18
- package/dist/lfs/service.d.mts +14 -0
- package/dist/lfs/service.mjs +26 -28
- package/dist/lfs/upkeep.mjs +39 -54
- package/dist/lfs/wire.mjs +80 -38
- package/dist/merges/merges.d.mts +20 -0
- package/dist/merges/merges.mjs +32 -0
- package/dist/merges/namespace.d.mts +2 -0
- package/dist/merges/public.d.mts +6 -0
- package/dist/merges/public.mjs +10 -0
- package/dist/node.d.mts +3 -3
- package/dist/node.mjs +1 -3
- package/dist/protocol/bytes/buffers.d.mts +9 -3
- package/dist/protocol/bytes/buffers.mjs +11 -5
- package/dist/protocol/bytes/deflate.d.mts +7 -5
- package/dist/protocol/bytes/deflate.mjs +59 -23
- package/dist/protocol/bytes/inflate.d.mts +4 -3
- package/dist/protocol/bytes/inflate.mjs +61 -26
- package/dist/protocol/bytes/reader.mjs +61 -0
- package/dist/protocol/bytes/sha1-hasher.d.mts +3 -1
- package/dist/protocol/bytes/sha1-hasher.mjs +13 -3
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +5 -5
- package/dist/protocol/bytes/streams.mjs +16 -6
- package/dist/protocol/diff/patch.d.mts +4 -0
- package/dist/protocol/diff/patch.mjs +1 -1
- package/dist/protocol/diff/paths.mjs +1 -1
- package/dist/protocol/diff/read.d.mts +1 -1
- package/dist/protocol/diff/read.mjs +102 -90
- package/dist/protocol/framing/pkt-line.d.mts +1 -0
- package/dist/protocol/framing/pkt-line.mjs +40 -6
- package/dist/protocol/objects/checked-blobs.d.mts +1 -0
- package/dist/protocol/objects/fsck.mjs +7 -1
- package/dist/protocol/objects/held.mjs +5 -11
- package/dist/protocol/objects/ident.mjs +1 -1
- package/dist/protocol/objects/object-rules.mjs +15 -7
- package/dist/protocol/objects/object.d.mts +6 -2
- package/dist/protocol/objects/object.mjs +5 -2
- package/dist/protocol/objects/tag.d.mts +3 -1
- package/dist/protocol/objects/tag.mjs +27 -1
- package/dist/protocol/objects/tree.mjs +1 -1
- package/dist/protocol/packs/delta.d.mts +1 -1
- package/dist/protocol/packs/delta.mjs +2 -2
- package/dist/protocol/packs/graph.mjs +55 -56
- package/dist/protocol/packs/idx.d.mts +4 -2
- package/dist/protocol/packs/idx.mjs +156 -63
- package/dist/protocol/packs/indexer.d.mts +22 -4
- package/dist/protocol/packs/indexer.mjs +14 -35
- package/dist/protocol/packs/parts.mjs +5 -5
- package/dist/protocol/packs/pos.mjs +12 -5
- package/dist/protocol/packs/reader.d.mts +19 -12
- package/dist/protocol/packs/reader.mjs +252 -25
- package/dist/protocol/packs/rev.d.mts +1 -1
- package/dist/protocol/packs/rev.mjs +42 -24
- package/dist/protocol/packs/types-file.mjs +85 -0
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +2 -2
- package/dist/protocol/packs/writer.d.mts +40 -15
- package/dist/protocol/packs/writer.mjs +142 -49
- package/dist/protocol/wire/advertisement.d.mts +34 -15
- package/dist/protocol/wire/advertisement.mjs +135 -35
- package/dist/protocol/wire/fetch.d.mts +57 -19
- package/dist/protocol/wire/fetch.mjs +57 -26
- package/dist/protocol/wire/json.mjs +25 -0
- package/dist/protocol/wire/lines.d.mts +22 -0
- package/dist/protocol/wire/lines.mjs +51 -26
- package/dist/protocol/wire/push-limits.d.mts +6 -0
- package/dist/protocol/wire/push-limits.mjs +88 -0
- package/dist/protocol/wire/push-uploads.mjs +3 -28
- package/dist/protocol/wire/receive-pack.d.mts +30 -14
- package/dist/protocol/wire/receive-pack.mjs +29 -2
- package/dist/protocol/wire/report-status.d.mts +30 -11
- package/dist/protocol/wire/report-status.mjs +21 -2
- package/dist/protocol/wire/v2.d.mts +45 -29
- package/dist/protocol/wire/v2.mjs +95 -18
- package/dist/protocol.d.mts +4 -3
- package/dist/protocol.mjs +7 -6
- package/dist/queue/advance.mjs +240 -148
- package/dist/queue/callers.mjs +12 -9
- package/dist/queue/calls.mjs +315 -157
- package/dist/queue/commit.mjs +86 -35
- package/dist/queue/host.d.mts +39 -12
- package/dist/queue/host.mjs +36 -38
- package/dist/queue/lanes.mjs +1 -1
- package/dist/queue/layer.d.mts +16 -0
- package/dist/queue/layer.mjs +60 -0
- package/dist/queue/limits.mjs +43 -2
- package/dist/queue/namespace.d.mts +2 -0
- package/dist/queue/pages.mjs +1 -1
- package/dist/queue/public.d.mts +6 -0
- package/dist/queue/public.mjs +21 -0
- package/dist/queue/push-option.mjs +49 -30
- package/dist/queue/rows.mjs +38 -21
- package/dist/queue/schedule.mjs +22 -22
- package/dist/queue/search.mjs +8 -7
- package/dist/queue/state.mjs +68 -18
- package/dist/queue/steps.mjs +16 -7
- package/dist/queue/trim.mjs +284 -0
- package/dist/remote-helper.d.mts +5 -2
- package/dist/remote-helper.mjs +5 -2
- package/dist/rest/api.d.mts +1 -1
- package/dist/rest/blobs.d.mts +799 -32
- package/dist/rest/blobs.mjs +4 -4
- package/dist/rest/caller.d.mts +4163 -36
- package/dist/rest/caller.mjs +2 -2
- package/dist/rest/client.mjs +80 -70
- package/dist/rest/commits.d.mts +3261 -190
- package/dist/rest/commits.mjs +18 -64
- package/dist/rest/errors.d.mts +2082 -22
- package/dist/rest/errors.mjs +46 -89
- package/dist/rest/events.d.mts +394 -11
- package/dist/rest/events.mjs +13 -9
- package/dist/rest/files.d.mts +1265 -114
- package/dist/rest/files.mjs +11 -42
- package/dist/rest/forks.d.mts +2045 -102
- package/dist/rest/forks.mjs +10 -13
- package/dist/rest/handler.d.mts +3 -0
- package/dist/rest/handler.mjs +35 -19
- package/dist/rest/handlers.mjs +53 -60
- package/dist/rest/layer.d.mts +14 -0
- package/dist/rest/layer.mjs +52 -0
- package/dist/rest/listen.d.mts +5 -8
- package/dist/rest/listen.mjs +23 -29
- package/dist/rest/me.d.mts +393 -10
- package/dist/rest/me.mjs +2 -2
- package/dist/rest/merges.d.mts +399 -16
- package/dist/rest/merges.mjs +3 -17
- package/dist/rest/namespace.d.mts +2 -0
- package/dist/rest/paths.mjs +1 -0
- package/dist/rest/queue.d.mts +5658 -283
- package/dist/rest/queue.mjs +15 -130
- package/dist/rest/refs.d.mts +2869 -142
- package/dist/rest/refs.mjs +19 -39
- package/dist/rest/repos.d.mts +2421 -93
- package/dist/rest/repos.mjs +10 -33
- package/dist/rest/tags.d.mts +1220 -69
- package/dist/rest/tags.mjs +6 -34
- package/dist/rest/tokens.d.mts +2358 -55
- package/dist/rest/tokens.mjs +7 -4
- package/dist/rest/topics.d.mts +2053 -106
- package/dist/rest/topics.mjs +23 -71
- package/dist/rest/trees.d.mts +1616 -81
- package/dist/rest/trees.mjs +16 -57
- package/dist/rest/wire.d.mts +404 -0
- package/dist/rest/wire.mjs +32 -46
- package/dist/rest/work.d.mts +1204 -63
- package/dist/rest/work.mjs +7 -51
- package/dist/rest.d.mts +3 -3
- package/dist/server/edge-node.d.mts +20 -0
- package/dist/server/edge-node.mjs +20 -0
- package/dist/server/edge.d.mts +10 -0
- package/dist/server/edge.mjs +23 -0
- package/dist/server/extension.d.mts +6 -2
- package/dist/server/extension.mjs +54 -30
- package/dist/server/git-layer.d.mts +34 -0
- package/dist/server/git-layer.mjs +118 -0
- package/dist/server/git-namespace.d.mts +7 -0
- package/dist/server/git-namespace.mjs +18 -0
- package/dist/server/lifecycle.d.mts +1 -2
- package/dist/server/lifecycle.mjs +8 -15
- package/dist/server/namespaces.d.mts +2 -0
- package/dist/server/registry.d.mts +12 -0
- package/dist/server/registry.mjs +218 -0
- package/dist/server/route-match.mjs +88 -0
- package/dist/server/routes.d.mts +12 -8
- package/dist/server/routes.mjs +27 -18
- package/dist/server/server.d.mts +22 -0
- package/dist/server/server.mjs +335 -210
- package/dist/server/uploads.d.mts +14 -0
- package/dist/server/uploads.mjs +15 -0
- package/dist/signin/codes.mjs +9 -6
- package/dist/signin/context.d.mts +1 -0
- package/dist/signin/context.mjs +4 -4
- package/dist/signin/device.mjs +8 -8
- package/dist/signin/forms.mjs +11 -29
- package/dist/signin/grants.d.mts +4 -2
- package/dist/signin/grants.mjs +20 -19
- package/dist/signin/route.mjs +2 -2
- package/dist/signin/web.mjs +7 -7
- package/dist/signin/wire.mjs +6 -6
- package/dist/storage/budget.mjs +51 -18
- package/dist/storage/calls.d.mts +28 -11
- package/dist/storage/calls.mjs +354 -117
- package/dist/storage/clean-up.mjs +121 -46
- package/dist/storage/counted-bucket.mjs +115 -0
- package/dist/storage/fetch.d.mts +2 -0
- package/dist/storage/fetch.mjs +243 -100
- package/dist/storage/fsck.mjs +56 -7
- package/dist/storage/held-types.d.mts +7 -0
- package/dist/storage/held-types.mjs +263 -0
- package/dist/storage/host-bucket.mjs +43 -0
- package/dist/storage/id-mix.d.mts +1 -0
- package/dist/storage/id-mix.mjs +55 -0
- package/dist/storage/index-bitmaps.d.mts +2 -1
- package/dist/storage/index-bitmaps.mjs +233 -101
- package/dist/storage/index-build.d.mts +6 -2
- package/dist/storage/index-build.mjs +650 -164
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +297 -195
- package/dist/storage/index-files.mjs +25 -27
- package/dist/storage/index-graph.d.mts +2 -1
- package/dist/storage/index-graph.mjs +127 -91
- package/dist/storage/index-layers.d.mts +11 -0
- package/dist/storage/index-layers.mjs +258 -78
- package/dist/storage/index-reach.mjs +181 -75
- package/dist/storage/index-remap.mjs +74 -32
- package/dist/storage/index-shallow.mjs +311 -0
- package/dist/storage/index-visible.mjs +168 -0
- package/dist/storage/layout.d.mts +1 -0
- package/dist/storage/layout.mjs +44 -8
- package/dist/storage/lfs-pointers.d.mts +3 -1
- package/dist/storage/lfs-pointers.mjs +25 -9
- package/dist/storage/link-join.d.mts +4 -0
- package/dist/storage/link-join.mjs +50 -12
- package/dist/storage/links.mjs +89 -4
- package/dist/storage/listed-ids.mjs +10 -0
- package/dist/storage/loose.d.mts +11 -4
- package/dist/storage/loose.mjs +102 -69
- package/dist/storage/memory-budget.d.mts +5 -0
- package/dist/storage/memory-budget.mjs +530 -102
- package/dist/storage/merge-choose.mjs +258 -0
- package/dist/storage/merge-cut.mjs +47 -0
- package/dist/storage/merge-fence.mjs +89 -0
- package/dist/storage/merge-index.mjs +347 -0
- package/dist/storage/merge-most.mjs +202 -0
- package/dist/storage/merge-plan.mjs +171 -0
- package/dist/storage/merge-row.mjs +258 -0
- package/dist/storage/merge-stream.mjs +497 -0
- package/dist/storage/merge-walk.mjs +199 -0
- package/dist/storage/merge-write.mjs +129 -0
- package/dist/storage/merge.d.mts +10 -0
- package/dist/storage/merge.mjs +82 -306
- package/dist/storage/object-rows.d.mts +4 -2
- package/dist/storage/object-rows.mjs +101 -17
- package/dist/storage/pack-order.d.mts +1 -1
- package/dist/storage/pack-order.mjs +69 -54
- package/dist/storage/pack-ranges.d.mts +1 -1
- package/dist/storage/pack-ranges.mjs +396 -60
- package/dist/storage/pack-reads.d.mts +6 -2
- package/dist/storage/pack-reads.mjs +598 -126
- package/dist/storage/pack-receive.d.mts +5 -0
- package/dist/storage/pack-receive.mjs +820 -237
- package/dist/storage/packs-memory.d.mts +25 -0
- package/dist/storage/packs-memory.mjs +49 -0
- package/dist/storage/packs.d.mts +7 -5
- package/dist/storage/packs.mjs +554 -213
- package/dist/storage/placed-reads.mjs +205 -0
- package/dist/storage/prune-keep.mjs +164 -0
- package/dist/storage/prune-walk.mjs +578 -0
- package/dist/storage/prune.mjs +739 -332
- package/dist/storage/push-allotment.mjs +3 -3
- package/dist/storage/push-uploads.mjs +31 -26
- package/dist/storage/pushed-commits.mjs +8 -9
- package/dist/storage/quarantine.d.mts +10 -0
- package/dist/storage/quarantine.mjs +71 -29
- package/dist/storage/range-cache.mjs +71 -0
- package/dist/storage/raw-ids.mjs +20 -1
- package/dist/storage/ready.d.mts +4 -2
- package/dist/storage/ready.mjs +109 -48
- package/dist/storage/receive-admission.mjs +67 -0
- package/dist/storage/receive-bounds.d.mts +1 -0
- package/dist/storage/receive-bounds.mjs +202 -0
- package/dist/storage/receive-files.mjs +248 -0
- package/dist/storage/receive-links.mjs +281 -244
- package/dist/storage/receive-state.d.mts +9 -0
- package/dist/storage/receive-state.mjs +150 -0
- package/dist/storage/receive-steps.mjs +344 -0
- package/dist/storage/receive-sweep.mjs +160 -0
- package/dist/storage/receive-table.d.mts +3 -0
- package/dist/storage/receive-table.mjs +197 -0
- package/dist/storage/repack-backlog.mjs +70 -0
- package/dist/storage/repack-contained.mjs +269 -0
- package/dist/storage/repack-job.d.mts +3 -0
- package/dist/storage/repack-job.mjs +27 -17
- package/dist/storage/repack.d.mts +4 -4
- package/dist/storage/repack.mjs +156 -77
- package/dist/storage/roots.mjs +23 -7
- package/dist/storage/rows.d.mts +4 -2
- package/dist/storage/rows.mjs +81 -9
- package/dist/storage/runs.d.mts +8 -0
- package/dist/storage/runs.mjs +731 -0
- package/dist/storage/send-list.d.mts +2 -1
- package/dist/storage/send-list.mjs +261 -76
- package/dist/storage/shallow.d.mts +3 -2
- package/dist/storage/shallow.mjs +7 -7
- package/dist/storage/single-flight.mjs +47 -0
- package/dist/storage/stream-whole.mjs +121 -54
- package/dist/storage/swap-walk.mjs +188 -0
- package/dist/storage/unpack.mjs +52 -23
- package/dist/storage/visible.mjs +58 -39
- package/dist/storage/walk.d.mts +2 -0
- package/dist/storage/walk.mjs +20 -7
- package/dist/storage/wants.mjs +185 -33
- package/dist/storage/written-bases.mjs +172 -0
- package/dist/store/call-count.d.mts +69 -4
- package/dist/store/call-count.mjs +193 -51
- package/dist/store/catalogue.d.mts +17 -3
- package/dist/store/catalogue.mjs +135 -48
- package/dist/store/crossing.mjs +2 -4
- package/dist/store/cursor-seal.d.mts +12 -1
- package/dist/store/cursor-seal.mjs +7 -6
- package/dist/store/errors.d.mts +2 -2
- package/dist/store/errors.mjs +112 -24
- package/dist/store/git-store.mjs +21 -2
- package/dist/store/job-try.mjs +26 -0
- package/dist/store/list-job.mjs +23 -17
- package/dist/store/outbox.d.mts +15 -5
- package/dist/store/outbox.mjs +143 -39
- package/dist/store/promises.d.mts +8 -2
- package/dist/store/promises.mjs +129 -85
- package/dist/store/queue-jobs.mjs +34 -13
- package/dist/store/records.d.mts +64 -1
- package/dist/store/records.mjs +101 -32
- package/dist/store/ref-rows.d.mts +18 -2
- package/dist/store/ref-rows.mjs +62 -5
- package/dist/store/repo-record.mjs +11 -9
- package/dist/store/reservations.mjs +9 -8
- package/dist/store/scopes.mjs +13 -11
- package/dist/store/settle.mjs +1 -1
- package/dist/store/topic-jobs.mjs +4 -4
- package/dist/sync/bound.d.mts +5 -3
- package/dist/sync/bound.mjs +32 -3
- package/dist/sync/github.mjs +7 -7
- package/dist/sync/import.d.mts +2 -0
- package/dist/sync/import.mjs +46 -50
- package/dist/sync/jobs.mjs +15 -23
- package/dist/sync/mirror.d.mts +6 -2
- package/dist/sync/mirror.mjs +122 -45
- package/dist/sync/publish.d.mts +1 -0
- package/dist/sync/publish.mjs +22 -19
- package/dist/sync/step.mjs +443 -71
- package/dist/sync/tries.mjs +50 -32
- package/dist/sync.d.mts +3 -3
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +103 -86
- package/dist/topics/calls.mjs +97 -67
- package/dist/topics/directory.mjs +31 -11
- package/dist/topics/host.d.mts +0 -1
- package/dist/topics/host.mjs +2 -12
- package/dist/topics/members.mjs +30 -24
- package/dist/topics/rows.mjs +10 -9
- package/dist/topics/topic.mjs +20 -9
- package/package.json +8 -15
- package/dist/auth/authorize.d.mts +0 -5
- package/dist/contracts/objects.mjs +0 -54
- package/dist/core/events/stream.d.mts +0 -19
- package/dist/core/rules/define.d.mts +0 -5
- package/dist/core/rules/define.mjs +0 -13
- package/dist/core/rules/fetch.d.mts +0 -5
- package/dist/core/sight.mjs +0 -99
- package/dist/engine/engine.d.mts +0 -25
- package/dist/engine/engine.mjs +0 -49
- package/dist/engine/xdiff/NOTICE.md +0 -63
- package/dist/engine/xdiff/compiled.d.mts +0 -7
- package/dist/engine/xdiff/compiled.mjs +0 -9
- package/dist/engine/xdiff/embedded.mjs +0 -4
- package/dist/engine/xdiff/node.d.mts +0 -7
- package/dist/engine/xdiff/node.mjs +0 -10
- package/dist/engine/xdiff/upstream/LGPL-2.1 +0 -511
- package/dist/engine/xdiff/xdiff.wasm +0 -0
- package/dist/engine.d.mts +0 -3
- package/dist/engine.mjs +0 -3
- package/dist/lfs/repo.mjs +0 -42
- package/dist/storage/distinct-ids.mjs +0 -39
- package/dist/storage/held-memo.mjs +0 -188
- package/dist/storage/index-remap.d.mts +0 -8
- package/dist/sync/records.mjs +0 -73
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { gitError } from "../contracts/result.mjs";
|
|
1
2
|
import { deflateWhole } from "../protocol/bytes/deflate.mjs";
|
|
2
3
|
import { nativeSha1Hasher } from "../protocol/bytes/sha1-hasher.mjs";
|
|
3
4
|
import { entryHeader } from "../protocol/packs/writer.mjs";
|
|
4
|
-
import {
|
|
5
|
+
import { thrownError } from "../store/errors.mjs";
|
|
5
6
|
import { callsAhead } from "./fetch.mjs";
|
|
6
7
|
import { repoScope } from "../store/scopes.mjs";
|
|
7
|
-
import {
|
|
8
|
+
import { bucketStream } from "./calls.mjs";
|
|
8
9
|
import { noCall, runIn } from "../store/crossing.mjs";
|
|
9
10
|
import { objectCollections, packFiles } from "./layout.mjs";
|
|
10
11
|
import { eachPageAt, objectOfRow } from "./object-rows.mjs";
|
|
12
|
+
import { entryEnd, indexBytes } from "./pack-reads.mjs";
|
|
11
13
|
import { rowsBytes } from "./repack.mjs";
|
|
12
14
|
import * as Effect from "effect/Effect";
|
|
13
15
|
import * as Hex from "effect/encoding/Hex";
|
|
@@ -21,6 +23,13 @@ const wholeRowsMost = 1e3;
|
|
|
21
23
|
const headerBytes = 12;
|
|
22
24
|
/** A pack's trailer, the SHA-1 of every byte before it. */
|
|
23
25
|
const trailerBytes = 20;
|
|
26
|
+
/**
|
|
27
|
+
* What a later copy takes while a plan is made: its span's start and end, two doubles, and the
|
|
28
|
+
* offset it's found at, a double in an array that may hold room for as many again.
|
|
29
|
+
*/
|
|
30
|
+
const copyBytes = 32;
|
|
31
|
+
/** The later copies charged for at once, ahead of the first of them: 32 KiB. */
|
|
32
|
+
const copiesCharged = 1024;
|
|
24
33
|
/** A PACK's header: `PACK`, version 2, and `count`, four bytes big-endian. */
|
|
25
34
|
const packHeader = (count) => {
|
|
26
35
|
const bytes = new Uint8Array(headerBytes);
|
|
@@ -35,13 +44,23 @@ const packHeader = (count) => {
|
|
|
35
44
|
view.setUint32(8, count);
|
|
36
45
|
return bytes;
|
|
37
46
|
};
|
|
47
|
+
const changed = (pack) => gitError("DATA_LOSS", `Pack ${pack.pack.id}'s bytes aren't those its index lists`);
|
|
48
|
+
const gone = (pack) => gitError("DATA_LOSS", `Pack ${pack.pack.id} was listed when this clone began, and isn't now`);
|
|
38
49
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
50
|
+
* Each object of `packs` and `rows` once: a merge of the packs' sorted `.idx` tables, which meets
|
|
51
|
+
* an object's copies in plan order, keeps its first and cuts the rest, then each row a pack holds,
|
|
52
|
+
* or an earlier row, left out. Git's `index-pack` takes no object twice.
|
|
53
|
+
*
|
|
54
|
+
* Every stored pack is whole: receive refuses a delta with no base before it in the pack and an
|
|
55
|
+
* `OFS_DELTA`, and a merge writes a delta whose base it doesn't keep whole, so each delta names its
|
|
56
|
+
* base by ID and that base is in its own pack. A kept copy's base is then in its pack, and its own
|
|
57
|
+
* kept copy is there or in an earlier pack, so every chain runs back to earlier packs, never round.
|
|
58
|
+
* The copies are charged through `charge` before they're held, `copiesCharged` at a time.
|
|
42
59
|
*/
|
|
43
|
-
const
|
|
60
|
+
const copies = /* @__PURE__ */ Effect.fnUntraced(function* (packs, rows, charge) {
|
|
44
61
|
const ranks = packs.map(() => 0);
|
|
62
|
+
const later = packs.map(() => []);
|
|
63
|
+
let found = 0;
|
|
45
64
|
let last;
|
|
46
65
|
for (;;) {
|
|
47
66
|
let least = -1;
|
|
@@ -56,29 +75,54 @@ const duplicated = (packs, rows) => {
|
|
|
56
75
|
}
|
|
57
76
|
}
|
|
58
77
|
if (oid === void 0) break;
|
|
59
|
-
|
|
78
|
+
const rank = ranks[least] ?? 0;
|
|
79
|
+
ranks[least] = rank + 1;
|
|
80
|
+
if (oid === last) {
|
|
81
|
+
if (found % copiesCharged === 0) yield* charge(copyBytes * copiesCharged);
|
|
82
|
+
found += 1;
|
|
83
|
+
later[least]?.push(packs[least]?.index.offsetAt(rank) ?? 0);
|
|
84
|
+
}
|
|
60
85
|
last = oid;
|
|
61
|
-
ranks[least] = (ranks[least] ?? 0) + 1;
|
|
62
86
|
}
|
|
63
|
-
const
|
|
64
|
-
for (const
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
const streamed = [];
|
|
88
|
+
for (const [at, indexed] of packs.entries()) {
|
|
89
|
+
const starts = (later[at] ?? []).sort((a, b) => a - b);
|
|
90
|
+
const cut = new Float64Array(2 * starts.length);
|
|
91
|
+
for (const [each, start] of starts.entries()) {
|
|
92
|
+
const end = entryEnd(indexed, start);
|
|
93
|
+
if (end === void 0) return yield* Effect.fail(changed(indexed));
|
|
94
|
+
cut.set([start, end], 2 * each);
|
|
95
|
+
}
|
|
96
|
+
streamed.push({
|
|
97
|
+
indexed,
|
|
98
|
+
cut
|
|
99
|
+
});
|
|
67
100
|
}
|
|
68
|
-
|
|
69
|
-
|
|
101
|
+
const seen = /* @__PURE__ */ new Set();
|
|
102
|
+
return {
|
|
103
|
+
packs: streamed,
|
|
104
|
+
rows: rows.filter(({ oid }) => {
|
|
105
|
+
if (seen.has(oid) || packs.some(({ index }) => index.find(oid) !== void 0)) return false;
|
|
106
|
+
seen.add(oid);
|
|
107
|
+
return true;
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
});
|
|
70
111
|
/**
|
|
71
112
|
* What a whole clone of `listed` streams, read at its version: its packs but the cruft ones, each
|
|
72
|
-
* index loaded, and its object rows, read a page at a time so no answer passes the store's.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
113
|
+
* index loaded, and its object rows, read a page at a time so no answer passes the store's. An
|
|
114
|
+
* object stored twice goes once, its first copy in plan order, as `copies` says. Its packs' bytes
|
|
115
|
+
* and its rows' count toward `limits`, as a plan's would, each copy counted: so the check, made
|
|
116
|
+
* before the indexes load, is stricter than the stream by the copies. `undefined` when the repo
|
|
117
|
+
* moved since `listed` was read, when it holds more rows than `wholeRowsMost`, or when the clone is
|
|
118
|
+
* past `limits`: then the clone builds, as before. Refused by `tooManyCalls` when the calls it
|
|
119
|
+
* made, through `store` and `bucket`, and a ranged get a pack still to come pass `calls`, checked
|
|
120
|
+
* before each index load and once loaded, so it stops before the stream's first byte. Each page of
|
|
121
|
+
* rows is charged before it's kept, its values and the objects decoded from them, each pack's
|
|
122
|
+
* indexes before they load, and each later copy as `copies` finds it, so what it holds is within
|
|
123
|
+
* the fetch's allotment.
|
|
80
124
|
*/
|
|
81
|
-
const wholePlan = Effect.fnUntraced(function* (store, bucket, indexes, listed, input, calls, charge = () => Effect.void) {
|
|
125
|
+
const wholePlan = /* @__PURE__ */ Effect.fnUntraced(function* (store, bucket, indexes, listed, input, calls, charge = () => Effect.void) {
|
|
82
126
|
const snapshot = yield* store.read({
|
|
83
127
|
scope: repoScope(listed.repo),
|
|
84
128
|
reads: [{ collection: objectCollections.cruft }]
|
|
@@ -102,62 +146,85 @@ const wholePlan = Effect.fnUntraced(function* (store, bucket, indexes, listed, i
|
|
|
102
146
|
bucket: kept.length,
|
|
103
147
|
store: 0
|
|
104
148
|
}, true);
|
|
105
|
-
const packs = yield* Effect.forEach(kept, (pack) => Effect.andThen(
|
|
149
|
+
const packs = yield* Effect.forEach(kept, (pack) => gets.pipe(Effect.andThen(charge(indexBytes(pack))), Effect.andThen(indexes.load(bucket, pack))));
|
|
106
150
|
yield* gets;
|
|
107
|
-
|
|
151
|
+
const unique = yield* copies(packs, rows, charge);
|
|
152
|
+
const spans = unique.packs.reduce((sum, { cut }) => sum + cut.length / 2, 0);
|
|
153
|
+
const skipped = rows.length - unique.rows.length + spans;
|
|
108
154
|
return {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
objects
|
|
155
|
+
...unique,
|
|
156
|
+
objects: objects - skipped
|
|
112
157
|
};
|
|
113
158
|
});
|
|
114
|
-
const changed = (pack) => gitError("DATA_LOSS", `Pack ${pack.pack.id}'s bytes aren't those its index lists`);
|
|
115
|
-
const gone = (pack) => gitError("DATA_LOSS", `Pack ${pack.pack.id} was listed when this clone began, and isn't now`);
|
|
116
159
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
|
|
120
|
-
|
|
160
|
+
* The parts of `piece`, at `from` in its pack, outside `cut`'s spans, from the span at `next.span`
|
|
161
|
+
* on, which it moves past each span the piece ends beyond.
|
|
162
|
+
*/
|
|
163
|
+
const outside = (piece, from, cut, next) => {
|
|
164
|
+
const parts = [];
|
|
165
|
+
const to = from + piece.byteLength;
|
|
166
|
+
let at = from;
|
|
167
|
+
while (at < to) {
|
|
168
|
+
const start = cut[2 * next.span] ?? Infinity;
|
|
169
|
+
const end = cut[2 * next.span + 1] ?? Infinity;
|
|
170
|
+
if (at >= end) next.span += 1;
|
|
171
|
+
else if (at < start) {
|
|
172
|
+
const stop = Math.min(start, to);
|
|
173
|
+
parts.push(piece.subarray(at - from, stop - from));
|
|
174
|
+
at = stop;
|
|
175
|
+
} else at = Math.min(end, to);
|
|
176
|
+
}
|
|
177
|
+
return parts;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* One stored pack's entries but its later copies: one ranged get from its header's end to its
|
|
181
|
+
* trailer, each piece hashed with the header it was stored under, cut copies included, and checked
|
|
182
|
+
* against its index's checksum before the last piece is handed on. A pack whose bytes changed ends
|
|
183
|
+
* the clone with `DATA_LOSS` and no trailer, so Git keeps no clone of it, as the planned writer's
|
|
184
|
+
* CRC-32 check does.
|
|
121
185
|
*/
|
|
122
|
-
async function* packEntries(bucket, pack, signal, count) {
|
|
186
|
+
async function* packEntries(bucket, { indexed: pack, cut }, signal, count) {
|
|
123
187
|
const length = pack.pack.bytes - headerBytes - trailerBytes;
|
|
188
|
+
const next = { span: 0 };
|
|
124
189
|
const hash = nativeSha1Hasher();
|
|
125
190
|
await runIn(hash.write(packHeader(pack.index.count)), noCall);
|
|
126
|
-
const opening =
|
|
191
|
+
const opening = bucketStream(bucket, packFiles(pack.pack.id).pack, {
|
|
127
192
|
offset: headerBytes,
|
|
128
193
|
length
|
|
129
|
-
}
|
|
194
|
+
});
|
|
130
195
|
const stream = await runIn(Effect.mapError(opening, thrownError), count, signal);
|
|
131
196
|
if (stream === void 0) throw gone(pack);
|
|
132
197
|
const reader = stream.getReader();
|
|
133
198
|
const onAbort = () => void reader.cancel(signal?.reason).catch(() => void 0);
|
|
134
|
-
|
|
135
|
-
signal?.throwIfAborted();
|
|
136
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
137
|
-
let held;
|
|
199
|
+
let held = [];
|
|
138
200
|
let read = 0;
|
|
139
201
|
let done = false;
|
|
140
202
|
try {
|
|
203
|
+
signal?.throwIfAborted();
|
|
204
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
141
205
|
for (;;) {
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
read
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
206
|
+
const piece = await reader.read();
|
|
207
|
+
if (piece.done) break;
|
|
208
|
+
const parts = outside(piece.value, headerBytes + read, cut, next);
|
|
209
|
+
read += piece.value.byteLength;
|
|
210
|
+
await runIn(hash.write(piece.value), noCall);
|
|
211
|
+
if (parts.length === 0) continue;
|
|
212
|
+
yield* held;
|
|
213
|
+
held = parts;
|
|
148
214
|
}
|
|
149
215
|
done = true;
|
|
150
216
|
} finally {
|
|
151
217
|
signal?.removeEventListener("abort", onAbort);
|
|
152
|
-
if (!done)
|
|
218
|
+
if (!done) reader.cancel(signal?.reason).catch(() => void 0);
|
|
219
|
+
reader.releaseLock();
|
|
153
220
|
}
|
|
154
221
|
signal?.throwIfAborted();
|
|
155
222
|
const digest = Hex.encode(await runIn(hash.digest, noCall));
|
|
156
223
|
if (read !== length || digest !== pack.index.packChecksum) throw changed(pack);
|
|
157
|
-
|
|
224
|
+
yield* held;
|
|
158
225
|
}
|
|
159
226
|
/** A whole object's entry: its header, then its bytes deflated. */
|
|
160
|
-
const wholeEntry = Effect.fnUntraced(function* (object) {
|
|
227
|
+
const wholeEntry = /* @__PURE__ */ Effect.fnUntraced(function* (object) {
|
|
161
228
|
const body = yield* deflateWhole(object.bytes);
|
|
162
229
|
const header = entryHeader(object.type, object.bytes.byteLength);
|
|
163
230
|
const entry = new Uint8Array(header.byteLength + body.byteLength);
|
|
@@ -186,10 +253,10 @@ async function* wholePieces(bucket, plan, signal, hash, count) {
|
|
|
186
253
|
yield await runIn(hash.digest, noCall);
|
|
187
254
|
}
|
|
188
255
|
/**
|
|
189
|
-
* `plan`'s pack as one stream: a header counting
|
|
190
|
-
* get, the rows' objects written whole, and a SHA-1 of the bytes
|
|
191
|
-
*
|
|
192
|
-
* in the
|
|
256
|
+
* `plan`'s pack as one stream: a header counting each object once, each pack's entries by one
|
|
257
|
+
* ranged get with its later copies cut, the rows' objects written whole, and a SHA-1 of the bytes
|
|
258
|
+
* sent. A stored delta is a `REF_DELTA` whose base is in its own pack, so Git finds each base by
|
|
259
|
+
* its ID, in the copy the stream kept, wherever that sits. Cancelled, or its call's `signal` aborted, it
|
|
193
260
|
* cancels the bucket's read first: the pieces' `return` waits on a read that may never come. Its
|
|
194
261
|
* reads count into `count`, the clone's request's, if any.
|
|
195
262
|
*/
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { indexHeadBytes, indexMagic, tablesOf } from "../protocol/packs/idx.mjs";
|
|
2
|
+
import { packReadBytes } from "../protocol/packs/reader.mjs";
|
|
3
|
+
import { gitError } from "../contracts/result.mjs";
|
|
4
|
+
import { objectCollections, packFiles } from "./layout.mjs";
|
|
5
|
+
import { readBusy } from "./memory-budget.mjs";
|
|
6
|
+
import { openIndexRanges, readExactly } from "./pack-ranges.mjs";
|
|
7
|
+
import { compareIds } from "./raw-ids.mjs";
|
|
8
|
+
import { containedRanks } from "./repack-contained.mjs";
|
|
9
|
+
import { namedOf } from "./repack.mjs";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
// src/storage/swap-walk.ts
|
|
13
|
+
/** What one holder's walk holds at most: the IDs of the packs it names, and a piece of its own. */
|
|
14
|
+
const swapHeldBytes = 4194304;
|
|
15
|
+
/** A holding as a walk's answer names it: the held pack's ID, then its holder's. */
|
|
16
|
+
const holdingKey = ([holder, held]) => `${held.id} ${holder.id}`;
|
|
17
|
+
/** The IDs one get of an `.idx` takes with its header: a pack this small is read in one. */
|
|
18
|
+
const wholeRanks = /* @__PURE__ */ Math.floor((packReadBytes - indexHeadBytes) / 20);
|
|
19
|
+
/** The reads a pack's IDs take, read whole: one get, or its header and then a piece at a time. */
|
|
20
|
+
const idsReads = ({ objects }) => objects <= wholeRanks ? 1 : 1 + Math.ceil(objects / containedRanks);
|
|
21
|
+
/**
|
|
22
|
+
* The walks of `holdings` that fit within `most` reads, each within `swapHeldBytes`: grouped by
|
|
23
|
+
* holder, in the order of each group's first holding, each group's holdings in order. Once one
|
|
24
|
+
* doesn't fit, it and every one after it is left, so the next sync, which walks first what no
|
|
25
|
+
* sync settled, walks them.
|
|
26
|
+
*/
|
|
27
|
+
const holdingsPlan = (holdings, most) => {
|
|
28
|
+
const groups = /* @__PURE__ */ new Map();
|
|
29
|
+
for (const holding of holdings) {
|
|
30
|
+
const [holder] = holding;
|
|
31
|
+
groups.set(holder.id, [...groups.get(holder.id) ?? [], holding]);
|
|
32
|
+
}
|
|
33
|
+
const walks = [];
|
|
34
|
+
const apart = [];
|
|
35
|
+
let reads = 0;
|
|
36
|
+
let bytes = 0;
|
|
37
|
+
for (const group of groups.values()) {
|
|
38
|
+
const [[holder] = []] = group;
|
|
39
|
+
if (holder === void 0) continue;
|
|
40
|
+
let cost = reads + 1 + Math.ceil(holder.objects / containedRanks);
|
|
41
|
+
let held = packReadBytes;
|
|
42
|
+
const fits = [];
|
|
43
|
+
let cut = false;
|
|
44
|
+
for (const holding of group) {
|
|
45
|
+
const [, inner] = holding;
|
|
46
|
+
if (inner.objects > holder.objects) {
|
|
47
|
+
apart.push(holding);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
cut = cost + idsReads(inner) > most || held + inner.objects * 20 > 4194304;
|
|
51
|
+
if (cut) break;
|
|
52
|
+
cost += idsReads(inner);
|
|
53
|
+
held += inner.objects * 20;
|
|
54
|
+
fits.push(holding);
|
|
55
|
+
}
|
|
56
|
+
if (fits.length > 0) {
|
|
57
|
+
walks.push({
|
|
58
|
+
holder,
|
|
59
|
+
holdings: fits
|
|
60
|
+
});
|
|
61
|
+
reads = cost;
|
|
62
|
+
bytes = Math.max(bytes, held);
|
|
63
|
+
}
|
|
64
|
+
if (cut) break;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
walks,
|
|
68
|
+
apart,
|
|
69
|
+
reads,
|
|
70
|
+
bytes
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
const lost = (message) => gitError("DATA_LOSS", message);
|
|
74
|
+
const uint32 = (bytes, at) => (bytes[at] ?? 0) * 2 ** 24 + ((bytes[at + 1] ?? 0) << 16) + ((bytes[at + 2] ?? 0) << 8) + (bytes[at + 3] ?? 0) >>> 0;
|
|
75
|
+
/** `pack`'s `.idx` IDs, in order: in one get with its header when they fit one, else a piece at a time. */
|
|
76
|
+
const idsOf = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, pack) {
|
|
77
|
+
const named = yield* namedOf(pack);
|
|
78
|
+
const { ids } = tablesOf(pack.objects);
|
|
79
|
+
if (pack.objects > wholeRanks) {
|
|
80
|
+
const ranges = yield* openIndexRanges(bucket, named, pack.objects);
|
|
81
|
+
const out = new Uint8Array(pack.objects * 20);
|
|
82
|
+
for (let rank = 0; rank < pack.objects; rank += containedRanks) out.set(yield* ranges.ids(rank, Math.min(containedRanks, pack.objects - rank)), rank * 20);
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
const head = yield* readExactly(bucket, packFiles(named.id).idx, 0, ids + pack.objects * 20);
|
|
86
|
+
const version = uint32(head, 4);
|
|
87
|
+
const count = uint32(head, 1028);
|
|
88
|
+
if (indexMagic.some((byte, at) => head[at] !== byte) || version !== 2 || count !== pack.objects) return yield* Effect.fail(lost(`Pack ${pack.id}'s index doesn't list its row's objects`));
|
|
89
|
+
return head.subarray(ids);
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* Which of `walk`'s holdings its holder holds every object of: the IDs of each held pack, read
|
|
93
|
+
* whole, merged in order against the holder's, read a piece at a time from the first ID's first
|
|
94
|
+
* byte, each piece once. A held pack is apart at its first ID the holder lacks.
|
|
95
|
+
*/
|
|
96
|
+
const walkHolder = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, walk) {
|
|
97
|
+
const inner = yield* Effect.forEach(walk.holdings, ([, held]) => idsOf(bucket, held));
|
|
98
|
+
const outer = yield* openIndexRanges(bucket, yield* namedOf(walk.holder), walk.holder.objects);
|
|
99
|
+
const at = inner.map(() => 0);
|
|
100
|
+
const apart = inner.map(() => false);
|
|
101
|
+
let piece = /* @__PURE__ */ new Uint8Array(0);
|
|
102
|
+
let start = 0;
|
|
103
|
+
let next = 0;
|
|
104
|
+
for (;;) {
|
|
105
|
+
let least = -1;
|
|
106
|
+
for (const [one, ids] of inner.entries()) {
|
|
107
|
+
const each = at[one] ?? 0;
|
|
108
|
+
if (apart[one] === true || each === ids.length) continue;
|
|
109
|
+
const other = inner[least];
|
|
110
|
+
if (other === void 0 || compareIds(ids, each, other, at[least] ?? 0) < 0) least = one;
|
|
111
|
+
}
|
|
112
|
+
const ids = inner[least];
|
|
113
|
+
if (ids === void 0) break;
|
|
114
|
+
const each = at[least] ?? 0;
|
|
115
|
+
const first = ids[each] ?? 0;
|
|
116
|
+
next = Math.max(next, first === 0 ? 0 : outer.fanout[first - 1] ?? 0);
|
|
117
|
+
let order = 1;
|
|
118
|
+
while (next < outer.count) {
|
|
119
|
+
if (next >= start + piece.length / 20) {
|
|
120
|
+
piece = yield* outer.ids(next, Math.min(containedRanks, outer.count - next));
|
|
121
|
+
start = next;
|
|
122
|
+
}
|
|
123
|
+
order = compareIds(piece, (next - start) * 20, ids, each);
|
|
124
|
+
if (order >= 0) break;
|
|
125
|
+
next += 1;
|
|
126
|
+
}
|
|
127
|
+
if (order === 0) at[least] = each + 20;
|
|
128
|
+
else apart[least] = true;
|
|
129
|
+
}
|
|
130
|
+
return walk.holdings.map((holding, one) => [holdingKey(holding), apart[one] === true ? "apart" : "held"]);
|
|
131
|
+
});
|
|
132
|
+
/** Each of `plan`'s holdings, by `holdingKey`: whether its holder holds every object of it. */
|
|
133
|
+
const walkPlanned = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, plan) {
|
|
134
|
+
const walked = yield* Effect.forEach(plan.walks, (walk) => walkHolder(bucket, walk));
|
|
135
|
+
return new Map([...plan.apart.map((holding) => [holdingKey(holding), "apart"]), ...walked.flat()]);
|
|
136
|
+
});
|
|
137
|
+
/**
|
|
138
|
+
* `input`'s holdings walked within its reads, on an allotment of `budget`'s for what its walks
|
|
139
|
+
* hold, charged before the first read. One refused walks none and reads nothing: the sync keeps
|
|
140
|
+
* its copies listed, and the next walks the same holdings.
|
|
141
|
+
*/
|
|
142
|
+
const walkWithin = (bucket, budget, input) => Effect.scoped(Effect.gen(function* () {
|
|
143
|
+
const plan = holdingsPlan(input.holdings, input.most);
|
|
144
|
+
if (!(plan.walks.length === 0 || (yield* Effect.catchIf(Effect.as(budget.allot(plan.bytes, readBusy), true), (error) => error === readBusy, () => Effect.succeed(false))))) return {
|
|
145
|
+
walked: yield* walkPlanned(bucket, {
|
|
146
|
+
...plan,
|
|
147
|
+
walks: []
|
|
148
|
+
}),
|
|
149
|
+
reads: 0
|
|
150
|
+
};
|
|
151
|
+
return {
|
|
152
|
+
walked: yield* walkPlanned(bucket, plan),
|
|
153
|
+
reads: plan.reads
|
|
154
|
+
};
|
|
155
|
+
}));
|
|
156
|
+
/**
|
|
157
|
+
* The holdings a fork's syncs walked, `swaps`, `SwapsSettled`: each `holdingKey`, held or apart. A
|
|
158
|
+
* pack's objects never change, so no sync walks one again, and the next walks only what none
|
|
159
|
+
* settled. A holding goes once either pack is neither the fork's nor its source's, and in the
|
|
160
|
+
* commit of a step that takes either out.
|
|
161
|
+
*/
|
|
162
|
+
const swapsKey = {
|
|
163
|
+
collection: objectCollections.apart,
|
|
164
|
+
id: "swaps"
|
|
165
|
+
};
|
|
166
|
+
const SwapsSettled = /* @__PURE__ */ Schema.Struct({
|
|
167
|
+
apart: Schema.Array(Schema.String),
|
|
168
|
+
held: Schema.Array(Schema.String)
|
|
169
|
+
});
|
|
170
|
+
/**
|
|
171
|
+
* The `swaps` row `found` without a holding of a pack `change` takes out, held or apart, for the
|
|
172
|
+
* same commit, as `apartAfter` keeps the `apart` row's pairs: none when it names none of them.
|
|
173
|
+
*/
|
|
174
|
+
const swapsLeft = (found, change) => {
|
|
175
|
+
const removed = new Set(change.remove ?? []);
|
|
176
|
+
if (found === void 0 || removed.size === 0) return [];
|
|
177
|
+
const kept = (keys) => keys.filter((key) => !key.split(" ").some((id) => removed.has(id)));
|
|
178
|
+
const value = {
|
|
179
|
+
apart: kept(found.apart),
|
|
180
|
+
held: kept(found.held)
|
|
181
|
+
};
|
|
182
|
+
if (value.apart.length === found.apart.length && value.held.length === found.held.length) return [];
|
|
183
|
+
return [{
|
|
184
|
+
...swapsKey,
|
|
185
|
+
value
|
|
186
|
+
}];
|
|
187
|
+
};
|
|
188
|
+
export { SwapsSettled, holdingKey, holdingsPlan, swapHeldBytes, swapsKey, swapsLeft, walkPlanned, walkWithin };
|
package/dist/storage/unpack.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { gitError } from "../contracts/result.mjs";
|
|
1
2
|
import { BufferError, BufferMeter } from "../protocol/bytes/buffers.mjs";
|
|
2
3
|
import { joinedBytes } from "../protocol/bytes/joined.mjs";
|
|
3
4
|
import { nativeSha1Hasher } from "../protocol/bytes/sha1-hasher.mjs";
|
|
@@ -5,9 +6,8 @@ import { fsckObject } from "../protocol/objects/fsck.mjs";
|
|
|
5
6
|
import { objectId } from "../protocol/objects/object.mjs";
|
|
6
7
|
import { appliedDelta } from "../protocol/packs/delta.mjs";
|
|
7
8
|
import { PackError, PackTransportError, boundedSource, readPack } from "../protocol/packs/reader.mjs";
|
|
8
|
-
import { gitError } from "../store/errors.mjs";
|
|
9
9
|
import { checkedFilesRefused, checkedOverflow, fsckRefusal, receiveChecked } from "./fsck.mjs";
|
|
10
|
-
import { linksOf, mistyped, shallowLinks, shallowRoot } from "./links.mjs";
|
|
10
|
+
import { boundaryNotInPack, linksOf, mistyped, objectMissing, segmentCut, segmentTooLarge, shallowLinks, shallowRoot, tagTargetMissing } from "./links.mjs";
|
|
11
11
|
import { objectRow, rowValueBytes } from "./object-rows.mjs";
|
|
12
12
|
import { limits } from "@ref0/infra";
|
|
13
13
|
import * as Effect from "effect/Effect";
|
|
@@ -17,22 +17,27 @@ import * as Result from "effect/Result";
|
|
|
17
17
|
const commitBytes = 8388608;
|
|
18
18
|
/** What the reader may hold besides the entries it hands on: its inflater and buffers. */
|
|
19
19
|
const readerBytes = 1048576;
|
|
20
|
-
const tooLarge = (bytes, most) => gitError("RESOURCE_EXHAUSTED", `push takes ${bytes.toLocaleString("en-US")} bytes as rows;
|
|
20
|
+
const tooLarge = (bytes, most) => gitError("RESOURCE_EXHAUSTED", `push takes ${bytes.toLocaleString("en-US")} bytes as rows; this server takes ${most.toLocaleString("en-US")}`, {
|
|
21
21
|
hint: "Push fewer objects at a time",
|
|
22
|
-
hostHint: "Use
|
|
22
|
+
hostHint: "Use Objects.layer() storage, which keeps a push's objects in the bucket",
|
|
23
23
|
context: { reason: "too-large" }
|
|
24
24
|
});
|
|
25
25
|
/** A push whose objects, resolved whole, pass a commit before their rows are made: as `tooLarge`. */
|
|
26
|
-
const resolvedTooLarge = (bytes, most) => gitError("RESOURCE_EXHAUSTED", `push's objects take more than ${bytes.toLocaleString("en-US")} bytes whole;
|
|
26
|
+
const resolvedTooLarge = (bytes, most) => gitError("RESOURCE_EXHAUSTED", `push's objects take more than ${bytes.toLocaleString("en-US")} bytes whole; this server takes ${most.toLocaleString("en-US")}`, {
|
|
27
27
|
hint: "Push fewer objects at a time",
|
|
28
|
-
hostHint: "Use
|
|
28
|
+
hostHint: "Use Objects.layer() storage, which keeps a push's objects in the bucket",
|
|
29
29
|
context: { reason: "too-large" }
|
|
30
30
|
});
|
|
31
31
|
/** An object whose row passes one row's 1 MiB: `RESOURCE_EXHAUSTED`, reason `object-too-large`. */
|
|
32
32
|
const rowTooLarge = (oid, bytes) => gitError("RESOURCE_EXHAUSTED", `object ${oid} takes ${bytes.toLocaleString("en-US")} bytes as a row; one row holds ${limits.valueBytes.toLocaleString("en-US")}`, {
|
|
33
|
-
hostHint: "Use
|
|
33
|
+
hostHint: "Use Objects.layer() storage, which keeps a large object in the bucket",
|
|
34
34
|
context: { reason: "object-too-large" }
|
|
35
35
|
});
|
|
36
|
+
/** An `OFS_DELTA` entry where a storage takes `REF_DELTA` only, the same at any size of push. */
|
|
37
|
+
const ofsRefused = /* @__PURE__ */ gitError("INVALID_ARGUMENT", "The pack has an OFS_DELTA entry", {
|
|
38
|
+
hint: "This server takes REF_DELTA only, as its capabilities say: push with a client that doesn't send ofs-delta",
|
|
39
|
+
context: { reason: "ofs-delta" }
|
|
40
|
+
});
|
|
36
41
|
const malformedPack = (message) => gitError("INVALID_ARGUMENT", `The pack is malformed: ${message}`, { hint: "Push again" });
|
|
37
42
|
/** No pack or retry carries one object past what the storage takes, so the hint is to drop it. */
|
|
38
43
|
const objectPastHint = "Remove the file from history, or track it with Git LFS";
|
|
@@ -53,17 +58,18 @@ const readFailure = (error) => {
|
|
|
53
58
|
* Every entry of the pack, read whole, within `most` inflated bytes in all; a pack whose header
|
|
54
59
|
* counts more than `objects` entries is refused before its first.
|
|
55
60
|
*/
|
|
56
|
-
const readEntries =
|
|
61
|
+
const readEntries = /* @__PURE__ */ Effect.fnUntraced(function* (input, most) {
|
|
57
62
|
const entries = [];
|
|
58
63
|
let current;
|
|
59
64
|
let pieces = [];
|
|
60
65
|
let held = 0;
|
|
61
66
|
const sink = {
|
|
62
67
|
begin: ({ count }) => count > input.limits.objects ? Effect.fail(input.tooMany(count)) : Effect.void,
|
|
63
|
-
entry: (entry) =>
|
|
68
|
+
entry: (entry) => {
|
|
69
|
+
if (entry.kind === "ofs" && input.offsetDeltas === "refuse") return Effect.fail(ofsRefused);
|
|
64
70
|
current = entry;
|
|
65
71
|
pieces = [];
|
|
66
|
-
}
|
|
72
|
+
},
|
|
67
73
|
data: (bytes) => {
|
|
68
74
|
held += bytes.byteLength;
|
|
69
75
|
if (held > most) return Effect.fail(tooLarge(held, most));
|
|
@@ -99,7 +105,7 @@ const waitKey = (entry) => {
|
|
|
99
105
|
* entry by offset, one by ID in the pack, or one the repo holds. A delta left without its base
|
|
100
106
|
* refuses the pack, and so do objects past `most` bytes in all, as each delta's is made.
|
|
101
107
|
*/
|
|
102
|
-
const resolve = Effect.fnUntraced(function* (input, entries, most) {
|
|
108
|
+
const resolve = /* @__PURE__ */ Effect.fnUntraced(function* (input, entries, most) {
|
|
103
109
|
const objects = /* @__PURE__ */ new Map();
|
|
104
110
|
const waiting = /* @__PURE__ */ new Map();
|
|
105
111
|
const ready = [];
|
|
@@ -173,7 +179,7 @@ const resolve = Effect.fnUntraced(function* (input, entries, most) {
|
|
|
173
179
|
* `INVALID_ARGUMENT` for the first object Git 2.53's fsck refuses a push for: one of the pack's
|
|
174
180
|
* own, or a `.gitmodules` or `.gitattributes` one of its trees names, in the pack or the repo.
|
|
175
181
|
*/
|
|
176
|
-
const fscked = Effect.fnUntraced(function* (input, objects) {
|
|
182
|
+
const fscked = /* @__PURE__ */ Effect.fnUntraced(function* (input, objects) {
|
|
177
183
|
const checked = receiveChecked();
|
|
178
184
|
for (const object of objects.values()) {
|
|
179
185
|
const fault = fsckObject(object, checked);
|
|
@@ -186,42 +192,64 @@ const fscked = Effect.fnUntraced(function* (input, objects) {
|
|
|
186
192
|
/**
|
|
187
193
|
* `INVALID_ARGUMENT` unless every object the pack's own name is in it or the repo, of the type its
|
|
188
194
|
* link says, and `shallowRoot` when a shallow client's commit names parents neither holds. A
|
|
189
|
-
* partial pack may leave out both
|
|
195
|
+
* partial pack may leave out both, but for its tags' objects, which Git's server sends with them
|
|
196
|
+
* through any depth or filter: a missing one is `tagTargetMissing`, as the stored receive says. An
|
|
197
|
+
* import segment's boundary is its own commits, and their parents it leaves out are never asked of
|
|
198
|
+
* the repo; those it holds are checked as any link is.
|
|
190
199
|
*/
|
|
191
|
-
const connected = Effect.fnUntraced(function* (input, objects) {
|
|
192
|
-
|
|
200
|
+
const connected = /* @__PURE__ */ Effect.fnUntraced(function* (input, objects) {
|
|
201
|
+
const partial = input.receive.partial === true;
|
|
193
202
|
const shallow = new Set(input.receive.shallow);
|
|
203
|
+
const boundary = new Set(input.receive.boundary);
|
|
194
204
|
const links = [];
|
|
195
205
|
const parents = [];
|
|
206
|
+
const tagged = /* @__PURE__ */ new Map();
|
|
207
|
+
for (const oid of boundary) if (objects.get(oid)?.type !== "commit") return yield* Effect.fail(boundaryNotInPack(oid));
|
|
208
|
+
const segment = segmentCut(input.receive.cutMost);
|
|
209
|
+
for (const oid of input.receive.needs ?? []) links.push({
|
|
210
|
+
oid,
|
|
211
|
+
type: "commit"
|
|
212
|
+
});
|
|
196
213
|
for (const object of objects.values()) {
|
|
214
|
+
if (partial && object.type !== "tag") continue;
|
|
197
215
|
const split = shallowLinks(object, yield* Effect.fromResult(linksOf(object)), shallow);
|
|
198
|
-
for (const link of split.needed)
|
|
216
|
+
if (partial) for (const link of split.needed) tagged.set(link.oid, object.oid);
|
|
217
|
+
const cut = shallowLinks(object, split.needed, boundary);
|
|
218
|
+
for (const link of cut.needed) links.push(link);
|
|
219
|
+
for (const parent of cut.parents) {
|
|
220
|
+
const past = segment.add(object.oid, parent.oid);
|
|
221
|
+
if (past !== void 0) return yield* Effect.fail(past);
|
|
222
|
+
if (objects.has(parent.oid)) links.push(parent);
|
|
223
|
+
}
|
|
199
224
|
for (const parent of split.parents) parents.push(parent);
|
|
200
225
|
}
|
|
201
226
|
const outside = (link) => link.oid !== "4b825dc642cb6eb9a060e54bf8d69288fbee4904" && !objects.has(link.oid);
|
|
202
227
|
const asked = new Set([...links, ...parents].flatMap((link) => outside(link) ? [link.oid] : []));
|
|
203
228
|
const held = asked.size === 0 ? /* @__PURE__ */ new Map() : yield* input.held([...asked]);
|
|
204
229
|
const missing = links.find((link) => outside(link) && !held.has(link.oid));
|
|
205
|
-
if (missing !== void 0) return yield* Effect.fail(
|
|
230
|
+
if (missing !== void 0) return yield* Effect.fail(partial ? tagTargetMissing(missing.oid, tagged.get(missing.oid)) : objectMissing(missing.oid));
|
|
206
231
|
if (parents.some((link) => outside(link) && !held.has(link.oid))) return yield* Effect.fail(shallowRoot());
|
|
207
232
|
const typeOf = (oid) => oid === "4b825dc642cb6eb9a060e54bf8d69288fbee4904" ? "tree" : (objects.get(oid) ?? held.get(oid))?.type;
|
|
208
233
|
const wrong = mistyped([...links, ...parents], typeOf);
|
|
209
234
|
if (wrong !== void 0) return yield* Effect.fail(wrong);
|
|
235
|
+
return segment.leftOut((oid) => objects.has(oid));
|
|
210
236
|
});
|
|
211
237
|
/**
|
|
212
238
|
* A received pack as rows, one per object, for its push's commit: each entry read and resolved,
|
|
213
239
|
* each object checked as Git's fsck checks it and parsed, and every object they name present, of
|
|
214
240
|
* the type its link says. Refused whole, before any row, past `limits` or for an object whose row
|
|
215
|
-
* passes 1 MiB, for a malformed or unresolved pack, an
|
|
216
|
-
* mistyped object.
|
|
241
|
+
* passes 1 MiB, for a malformed or unresolved pack, an `OFS_DELTA` where `offsetDeltas` refuses
|
|
242
|
+
* one, an object fsck refuses, or a missing or mistyped object.
|
|
217
243
|
*/
|
|
218
|
-
const unpackObjects = Effect.fnUntraced(function* (input) {
|
|
244
|
+
const unpackObjects = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
|
|
219
245
|
const { receive, limits: limits$1 } = input;
|
|
220
246
|
if (receive.objects > limits$1.objects) return yield* Effect.fail(input.tooMany(receive.objects));
|
|
247
|
+
const past = segmentTooLarge(receive);
|
|
248
|
+
if (past !== void 0) return yield* Effect.fail(past);
|
|
221
249
|
const { entries, bytes } = yield* readEntries(input, limits$1.bytes);
|
|
222
250
|
const objects = yield* resolve(input, entries, limits$1.bytes);
|
|
223
251
|
yield* fscked(input, objects);
|
|
224
|
-
yield* connected(input, objects);
|
|
252
|
+
const cut = yield* connected(input, objects);
|
|
225
253
|
const rows = [...objects.values()].map(objectRow);
|
|
226
254
|
for (const row of rows) {
|
|
227
255
|
const valueBytes = rowValueBytes(row.value);
|
|
@@ -232,7 +260,8 @@ const unpackObjects = Effect.fnUntraced(function* (input) {
|
|
|
232
260
|
return {
|
|
233
261
|
objects: [...objects.values()],
|
|
234
262
|
rows,
|
|
235
|
-
bytes
|
|
263
|
+
bytes,
|
|
264
|
+
cut
|
|
236
265
|
};
|
|
237
266
|
});
|
|
238
|
-
export { commitBytes, malformedPack, readFailure, rowTooLarge, unpackObjects };
|
|
267
|
+
export { commitBytes, malformedPack, ofsRefused, readFailure, rowTooLarge, unpackObjects };
|