@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
package/dist/core/push.mjs
CHANGED
|
@@ -1,52 +1,67 @@
|
|
|
1
|
+
import { fail, gitError } from "../contracts/result.mjs";
|
|
1
2
|
import { openTreeBytes } from "../storage/budget.mjs";
|
|
2
|
-
import {
|
|
3
|
+
import { objectsFace, scopedReceive, walkObjects } from "../storage/calls.mjs";
|
|
4
|
+
import { isUnindexedRead } from "../storage/index-visible.mjs";
|
|
3
5
|
import { openTreesRefusal } from "../storage/push-allotment.mjs";
|
|
4
6
|
import { isLoose } from "../storage/loose.mjs";
|
|
5
|
-
import {
|
|
7
|
+
import { listedIds } from "../storage/listed-ids.mjs";
|
|
8
|
+
import { indexRowKey, isPackId, objectCollections } from "../storage/layout.mjs";
|
|
6
9
|
import { noLfsPointers } from "../storage/lfs-pointers.mjs";
|
|
7
10
|
import { isShallowRoot } from "../storage/links.mjs";
|
|
11
|
+
import { isAwaitingRepack } from "../storage/repack-backlog.mjs";
|
|
8
12
|
import { allottedRows } from "../storage/allotted.mjs";
|
|
9
13
|
import { gitObjectOf, objectOfRow, receivedRows } from "../storage/object-rows.mjs";
|
|
14
|
+
import { pruneClearedKey } from "../storage/prune.mjs";
|
|
15
|
+
import { abandonOwn } from "../storage/quarantine.mjs";
|
|
10
16
|
import { QuarantineRow, decodeHeld } from "../storage/rows.mjs";
|
|
11
|
-
import {
|
|
17
|
+
import { bestEffort, decodeRow, storeCall } from "../store/errors.mjs";
|
|
12
18
|
import { callScope } from "../store/call-count.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { WholeRepo, wholeRefs } from "../store/ref-rows.mjs";
|
|
19
|
+
import { decodePacks, gitStore } from "../store/git-store.mjs";
|
|
20
|
+
import { WholeRepo, refBytesOf, storesPeel, wholeRefs } from "../store/ref-rows.mjs";
|
|
16
21
|
import { gitsOwnMove, hiddenUnder } from "../protocol/wire/lines.mjs";
|
|
17
|
-
import {
|
|
22
|
+
import { sliceOf } from "../protocol/wire/push-limits.mjs";
|
|
23
|
+
import { pushCounts } from "./events/seen.mjs";
|
|
24
|
+
import { refViewIn } from "./ref-view.mjs";
|
|
18
25
|
import { appendEvents, decodeOutbox, firstSeq, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
19
26
|
import { MirrorRow, PrunedMark, mirrorJobName } from "../store/records.mjs";
|
|
20
27
|
import { decodeTimes, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
|
|
21
28
|
import { advanceRow } from "../store/queue-jobs.mjs";
|
|
22
29
|
import { liveReservations, reservedTarget } from "../store/reservations.mjs";
|
|
23
30
|
import { settleName } from "../store/settle.mjs";
|
|
24
|
-
import { collections, newChangeId, prunedKey, pushedKey, pushedUnder, repoScope } from "../store/scopes.mjs";
|
|
25
|
-
import { headOf, indexJobs, openKeyed, openRepo } from "./access.mjs";
|
|
31
|
+
import { collections, newChangeId, prunedKey, pushedKey, pushedUnder, reachedKey, repoScope } from "../store/scopes.mjs";
|
|
32
|
+
import { headOf, indexJobs, openKeyed, openRepo, refIndexJobs, repoAccess } from "./access.mjs";
|
|
26
33
|
import { kindsOf } from "./ancestry.mjs";
|
|
27
34
|
import { savedPushRow } from "./hooks/post-receive.mjs";
|
|
28
35
|
import { runPreReceive } from "./hooks/pre-receive.mjs";
|
|
29
|
-
import {
|
|
36
|
+
import { Changes } from "./changes.mjs";
|
|
37
|
+
import { batchOf, readerOf } from "./rules/changes.mjs";
|
|
30
38
|
import { commitChangesOf, coveredTips } from "./rules/commit-changes.mjs";
|
|
31
|
-
import { gitsOwnRef, runPushRules, unseenRef } from "./rules/check.mjs";
|
|
39
|
+
import { gitsOwnRef, pushRulesFor, runPushRules, unseenRef } from "./rules/check.mjs";
|
|
32
40
|
import { checking } from "./rules/context.mjs";
|
|
33
41
|
import { changedWhileChecked, factsHeld, tipsOf } from "./rules/facts.mjs";
|
|
34
|
-
import { decidePush } from "./push-decide.mjs";
|
|
42
|
+
import { clearsMark, decidePush, otherWritesProblem, pushOptionsProblem } from "./push-decide.mjs";
|
|
35
43
|
import { heldReceipt, receiptReads, receiptWrites, refsAnswer, refsKept, withJobs } from "./receipts.mjs";
|
|
36
44
|
import { SealedObjects, viewOf } from "./view.mjs";
|
|
37
45
|
import { ownWriter, ownWritesOf } from "./own-writes.mjs";
|
|
46
|
+
import { ensureRepack } from "./repack.mjs";
|
|
38
47
|
import { publishable, unpublished } from "./publish.mjs";
|
|
39
|
-
import { peeledOf } from "../storage/wants.mjs";
|
|
48
|
+
import { peeledAll, peeledOf } from "../storage/wants.mjs";
|
|
49
|
+
import { CoreParts, ObjectsParts } from "./parts.mjs";
|
|
50
|
+
import { Authorize, check } from "../contracts/authorize.mjs";
|
|
51
|
+
import { read } from "./objects/objects.mjs";
|
|
40
52
|
import { checkWrites } from "@ref0/infra";
|
|
41
53
|
import * as Effect from "effect/Effect";
|
|
54
|
+
import * as Clock$1 from "effect/Clock";
|
|
42
55
|
import * as Result from "effect/Result";
|
|
56
|
+
import * as Exit from "effect/Exit";
|
|
57
|
+
import * as Equal from "effect/Equal";
|
|
43
58
|
// src/core/push.ts
|
|
44
59
|
/**
|
|
45
60
|
* The push decide reads every ref, private or not: a move's `from`, a folder conflict and a
|
|
46
61
|
* topic's reservation are checked against the repo as it is. What it answers the caller about a
|
|
47
62
|
* name it can't write is `unseenRef`'s, the same whatever is there.
|
|
48
63
|
*/
|
|
49
|
-
const pushWhole = WholeRepo.mint();
|
|
64
|
+
const pushWhole = /* @__PURE__ */ WholeRepo.mint();
|
|
50
65
|
const packsRead = { collection: collections.packs };
|
|
51
66
|
const refsRead = { collection: collections.refs };
|
|
52
67
|
const timesRead = { collection: collections.stats };
|
|
@@ -55,7 +70,6 @@ const cruftRead = {
|
|
|
55
70
|
collection: objectCollections.cruft,
|
|
56
71
|
limit: 65
|
|
57
72
|
};
|
|
58
|
-
const mirrorsRead = { collection: collections.mirrors };
|
|
59
73
|
/**
|
|
60
74
|
* A queue publish refused for `entries`, whose heads would publish commits their own callers may
|
|
61
75
|
* not: each fails alone, and the queue builds the rest again.
|
|
@@ -88,8 +102,8 @@ const refuseQueued = (request, refusals, by) => {
|
|
|
88
102
|
const first = refusals.find((error) => error !== void 0);
|
|
89
103
|
return first === void 0 ? Effect.void : Effect.fail(first);
|
|
90
104
|
};
|
|
91
|
-
/** The edits `
|
|
92
|
-
const unseenOf = (
|
|
105
|
+
/** The edits `refView` refuses: each name its caller can't write, as for a name with no ref there. */
|
|
106
|
+
const unseenOf = (refView, edits) => new Map(refView.whole ? [] : edits.flatMap((edit) => (edit.from === null ? refView.creates(edit.ref) : refView.sees(edit.ref)) ? [] : [[edit.ref, unseenRef(edit.ref)]]));
|
|
93
107
|
/**
|
|
94
108
|
* One fence over `fences`, each caller's, in the push's final read: their reads together, and each
|
|
95
109
|
* check on its own results. A queue's publish hears every credential that ended, by its place.
|
|
@@ -115,16 +129,18 @@ const fenceAll = (request, fences) => {
|
|
|
115
129
|
};
|
|
116
130
|
};
|
|
117
131
|
const moved = { queueMoved: true };
|
|
118
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* A queue's push whose repo moved past the version it planned at, or a build's whose fenced row
|
|
134
|
+
* changed: `UNAVAILABLE`.
|
|
135
|
+
*/
|
|
119
136
|
const queueMoved = (repo) => gitError("UNAVAILABLE", `'${repo}' moved while its merge queue wrote`, {
|
|
120
137
|
hint: "Try again",
|
|
121
138
|
cause: moved
|
|
122
139
|
});
|
|
123
|
-
const atomicHint = "Another ref in this atomic push was refused";
|
|
124
140
|
/** A queue push's refused ref, the cause's before the rest's, so its writes commit with none. */
|
|
125
141
|
const refusalOf = (updated) => {
|
|
126
142
|
const refused = updated.updates.flatMap((update) => update.kind === "rejected" ? [update.error] : []);
|
|
127
|
-
return refused.find((error) => error.
|
|
143
|
+
return refused.find((error) => error.context?.reason !== "atomic-partner") ?? refused[0];
|
|
128
144
|
};
|
|
129
145
|
/** Whether a push failed only since its repo moved past the queue's plan. */
|
|
130
146
|
const isQueueMoved = (error) => error.cause === moved;
|
|
@@ -175,12 +191,12 @@ const markOf = (rows) => {
|
|
|
175
191
|
* caller who can't read the repo gets the read's answer, as for a name with no repo, before a byte
|
|
176
192
|
* of the pack is read: only a caller who can read it is told a push is refused.
|
|
177
193
|
*/
|
|
178
|
-
const firstRead = (
|
|
194
|
+
const firstRead = (caller, operation, internalId) => openRepo(caller, {
|
|
179
195
|
kind: "read",
|
|
180
196
|
repo: operation.repo
|
|
181
197
|
}, [packsRead, prunedKey], internalId);
|
|
182
198
|
/** `firstRead` for a keyed push: `undefined` once `missed`'s repo moved, as `openKeyed` says. */
|
|
183
|
-
const keyedRead = (
|
|
199
|
+
const keyedRead = (caller, operation, missed, internalId) => openKeyed(caller, {
|
|
184
200
|
kind: "read",
|
|
185
201
|
repo: operation.repo
|
|
186
202
|
}, [packsRead, prunedKey], missed, internalId);
|
|
@@ -189,14 +205,10 @@ const keyedRead = (core, caller, operation, missed, internalId) => openKeyed(cor
|
|
|
189
205
|
* received against, its default branch, whose move rebuilds the ready shallow pack, and its
|
|
190
206
|
* `pruned` mark.
|
|
191
207
|
*/
|
|
192
|
-
const listedFor = Effect.fnUntraced(function* (
|
|
193
|
-
const { caller
|
|
194
|
-
const repo =
|
|
195
|
-
|
|
196
|
-
public: resolved.record.public,
|
|
197
|
-
internalId: resolved.internalId
|
|
198
|
-
};
|
|
199
|
-
if (request.queued === void 0) yield* core.authorize({
|
|
208
|
+
const listedFor = /* @__PURE__ */ Effect.fnUntraced(function* (request, operation, resolved) {
|
|
209
|
+
const { caller } = request;
|
|
210
|
+
const repo = repoAccess(resolved);
|
|
211
|
+
if (request.queued === void 0) yield* check({
|
|
200
212
|
caller,
|
|
201
213
|
operation,
|
|
202
214
|
repo
|
|
@@ -208,8 +220,8 @@ const listedFor = Effect.fnUntraced(function* (core, request, operation, resolve
|
|
|
208
220
|
packs
|
|
209
221
|
};
|
|
210
222
|
const mark = yield* markOf(resolved.snapshot.results[2] ?? []);
|
|
211
|
-
const views = decidingFor(request)
|
|
212
|
-
const [view = viewOf(
|
|
223
|
+
const views = yield* Effect.forEach(decidingFor(request), (one) => viewOf(one, resolved, request.as));
|
|
224
|
+
const [view = yield* viewOf(caller, resolved, request.as)] = views;
|
|
213
225
|
return {
|
|
214
226
|
listed,
|
|
215
227
|
defaultBranch: headOf(resolved.record.defaultBranch),
|
|
@@ -225,21 +237,28 @@ const listedFor = Effect.fnUntraced(function* (core, request, operation, resolve
|
|
|
225
237
|
* caller sees, read after `authorize` let the caller in, at a version of their own, which the
|
|
226
238
|
* push's objects read at too.
|
|
227
239
|
*/
|
|
228
|
-
const seenRefsOf = Effect.fnUntraced(function* (
|
|
240
|
+
const seenRefsOf = /* @__PURE__ */ Effect.fnUntraced(function* (view, listed) {
|
|
241
|
+
const core = yield* CoreParts;
|
|
229
242
|
if (!(yield* view.narrowed)) return {
|
|
230
243
|
listed,
|
|
231
244
|
refs: /* @__PURE__ */ new Map()
|
|
232
245
|
};
|
|
233
|
-
const { snapshot } = yield* readRecord(core.store, listed.repo, [
|
|
234
|
-
|
|
235
|
-
|
|
246
|
+
const { snapshot } = yield* readRecord(core.store, listed.repo, [
|
|
247
|
+
refsRead,
|
|
248
|
+
packsRead,
|
|
249
|
+
indexRowKey
|
|
250
|
+
]);
|
|
251
|
+
const [, refRows = [], packRows = [], indexRows = []] = snapshot.results;
|
|
252
|
+
const packs = yield* decodePacks(packRows);
|
|
253
|
+
const refs = yield* view.refs(refRows);
|
|
236
254
|
return {
|
|
237
255
|
listed: {
|
|
238
256
|
...listed,
|
|
239
257
|
version: snapshot.version,
|
|
240
258
|
packs
|
|
241
259
|
},
|
|
242
|
-
refs
|
|
260
|
+
refs,
|
|
261
|
+
index: indexRows[0]?.value
|
|
243
262
|
};
|
|
244
263
|
});
|
|
245
264
|
/**
|
|
@@ -267,13 +286,9 @@ const pushedOf = (objects, listed, received) => {
|
|
|
267
286
|
* Whether the push brings commit `oid`, for the file rules' walk: its own object, read as `pushed`
|
|
268
287
|
* reads one, its bytes let go unread. A read that fails throws, so the walk trusts nothing.
|
|
269
288
|
*/
|
|
270
|
-
const broughtCommit = (pushed,
|
|
271
|
-
const object = await runIn(Effect.mapError(pushed({ oid }), thrownError), scope);
|
|
272
|
-
await object?.bytes.cancel().catch(() => void 0);
|
|
273
|
-
return object?.type === "commit";
|
|
274
|
-
};
|
|
289
|
+
const broughtCommit = (pushed) => (oid) => Effect.flatMap(pushed({ oid }), (object) => Effect.as(Effect.promise(() => object?.bytes.cancel().catch(() => void 0) ?? Promise.resolve()), object?.type === "commit"));
|
|
275
290
|
/** The refs the repo mirrors, among `rows` of `mirrors`: each one an active mirror names. */
|
|
276
|
-
const activeMirrors = Effect.fnUntraced(function* (rows) {
|
|
291
|
+
const activeMirrors = /* @__PURE__ */ Effect.fnUntraced(function* (rows) {
|
|
277
292
|
const active = /* @__PURE__ */ new Set();
|
|
278
293
|
for (const row of rows) if ((yield* decodeRow(MirrorRow, row, `Mirror '${row.id}'`)).state === "active") active.add(row.id);
|
|
279
294
|
return active;
|
|
@@ -309,7 +324,25 @@ const withReceivedRows = (objects, received) => {
|
|
|
309
324
|
const row = rows.get(input.oid);
|
|
310
325
|
return row === void 0 ? objects.read(listed, input) : Effect.map(objectOfRow(row), gitObjectOf);
|
|
311
326
|
},
|
|
312
|
-
|
|
327
|
+
headers: Effect.fnUntraced(function* (listed, input) {
|
|
328
|
+
const answer = /* @__PURE__ */ new Map();
|
|
329
|
+
const stored = input.oids.filter((oid) => !rows.has(oid));
|
|
330
|
+
for (const oid of input.oids) {
|
|
331
|
+
const row = rows.get(oid);
|
|
332
|
+
if (row === void 0) continue;
|
|
333
|
+
const object = yield* objectOfRow(row);
|
|
334
|
+
answer.set(oid, {
|
|
335
|
+
type: object.type,
|
|
336
|
+
size: object.bytes.byteLength
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (stored.length > 0) for (const [oid, header] of yield* objects.headers(listed, {
|
|
340
|
+
...input,
|
|
341
|
+
oids: stored
|
|
342
|
+
})) answer.set(oid, header);
|
|
343
|
+
return answer;
|
|
344
|
+
}),
|
|
345
|
+
objects: Effect.fnUntraced(function* (listed, input) {
|
|
313
346
|
const asked = [...new Set(input.oids)];
|
|
314
347
|
const [first] = asked;
|
|
315
348
|
if (first === void 0 || !asked.some((oid) => rows.has(oid))) return yield* objects.objects(listed, {
|
|
@@ -331,14 +364,50 @@ const withReceivedRows = (objects, received) => {
|
|
|
331
364
|
};
|
|
332
365
|
};
|
|
333
366
|
/**
|
|
367
|
+
* The rows a build's write is fenced on, the one list of them (Q885): the repo's `pruned` mark, as
|
|
368
|
+
* its links read objects a prune may drop; its target's queue row, which names its open holds, and
|
|
369
|
+
* each of their rows, `holds`, which its lift reads; the target's ref, its tip, which a land links
|
|
370
|
+
* onto and a merge at the build compares; its candidate's row; and each entry it links, found or
|
|
371
|
+
* not. An entry's notes are fixed by its row: its `meta` and its report are each written only with
|
|
372
|
+
* a put of an entry's row that names them, which `pushPlan` holds. A key row (`latest`, `merged`)
|
|
373
|
+
* isn't one: a build reads none. The build takes each one's value from the read its plan made, and
|
|
374
|
+
* `finalRead` reads them again, so the write commits only while every one holds it, whatever else
|
|
375
|
+
* the repo's other writes moved.
|
|
376
|
+
*/
|
|
377
|
+
const buildFence = (build) => [
|
|
378
|
+
prunedKey,
|
|
379
|
+
{
|
|
380
|
+
collection: collections.queueTargets,
|
|
381
|
+
id: build.target
|
|
382
|
+
},
|
|
383
|
+
...build.holds.map((id) => ({
|
|
384
|
+
collection: collections.queueHolds,
|
|
385
|
+
id
|
|
386
|
+
})),
|
|
387
|
+
{
|
|
388
|
+
collection: collections.refs,
|
|
389
|
+
id: build.target
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
collection: collections.queueCandidates,
|
|
393
|
+
id: build.candidate
|
|
394
|
+
},
|
|
395
|
+
...build.entries.map((id) => ({
|
|
396
|
+
collection: collections.queueEntries,
|
|
397
|
+
id
|
|
398
|
+
}))
|
|
399
|
+
];
|
|
400
|
+
/**
|
|
334
401
|
* The decide's read, one of the repo's scope: its refs, its outbox, the push's own `quarantine` row
|
|
335
|
-
* if it has one, its key's receipt if it has a key, the
|
|
402
|
+
* if it has one, its key's receipt if it has a key, the mirror of each ref in `touched`, the
|
|
403
|
+
* queue's row of each branch in `branches`,
|
|
336
404
|
* with the live reservation each holds, and the caller's grant fence, checked on what it read. A revoke after it moves the version, as
|
|
337
405
|
* does a write with the same key that commits first. A prune that dropped objects since the first
|
|
338
406
|
* read moved the `pruned` mark: the push may name one it dropped, so unless its key's receipt
|
|
339
|
-
* answers, it fails, to be sent again (Q270).
|
|
407
|
+
* answers, it fails, to be sent again (Q270). `changed`: whether a row of a build's fence,
|
|
408
|
+
* `unchanged`, holds another value than its plan read.
|
|
340
409
|
*/
|
|
341
|
-
const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kept, mark, branches) {
|
|
410
|
+
const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fence, received, kept, mark, branches, touched, guard, unchanged = []) {
|
|
342
411
|
const own = received?.quarantine === void 0 ? [] : [received.quarantine];
|
|
343
412
|
const keyed = receiptReads(kept);
|
|
344
413
|
const targets = branches.map((id) => ({
|
|
@@ -352,21 +421,30 @@ const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kep
|
|
|
352
421
|
}));
|
|
353
422
|
const { record, snapshot } = yield* readRecord(store, repo.internalId, [
|
|
354
423
|
refsRead,
|
|
355
|
-
mirrorsRead,
|
|
356
424
|
...outboxReads,
|
|
357
425
|
packsRead,
|
|
358
426
|
prunedKey,
|
|
359
427
|
timesRead,
|
|
360
428
|
cruftRead,
|
|
361
429
|
indexRowKey,
|
|
430
|
+
reachedKey,
|
|
362
431
|
...own,
|
|
363
432
|
...keyed,
|
|
364
433
|
...targets,
|
|
365
|
-
...fence.reads
|
|
434
|
+
...fence.reads,
|
|
435
|
+
...guard?.reads ?? [],
|
|
436
|
+
...unchanged.map(({ collection, id }) => ({
|
|
437
|
+
collection,
|
|
438
|
+
id
|
|
439
|
+
})),
|
|
440
|
+
...touched.map((id) => ({
|
|
441
|
+
collection: collections.mirrors,
|
|
442
|
+
id
|
|
443
|
+
}))
|
|
366
444
|
], rowCounts);
|
|
367
445
|
if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${repo.name}'`);
|
|
368
|
-
const [, refRows = [],
|
|
369
|
-
const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], ...rest] = more;
|
|
446
|
+
const [, refRows = [], headRows = [], cursorRows = [], packRows = [], ...more] = snapshot.results;
|
|
447
|
+
const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], reachedRows = [], ...rest] = more;
|
|
370
448
|
const receipt = yield* heldReceipt(rest.slice(own.length, own.length + keyed.length), kept);
|
|
371
449
|
if (receipt === void 0 && (yield* markOf(markRows)) !== mark) return yield* fail("UNAVAILABLE", "The repo was pruned during the push", { hint: "Push again" });
|
|
372
450
|
const targeted = rest.slice(own.length + keyed.length, own.length + keyed.length + targets.length);
|
|
@@ -376,7 +454,14 @@ const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kep
|
|
|
376
454
|
const reservation = live[index];
|
|
377
455
|
return reservation === void 0 ? [] : [[branch, reservedTarget(branch, reservation)]];
|
|
378
456
|
}));
|
|
379
|
-
const
|
|
457
|
+
const fencedAt = own.length + keyed.length + targets.length;
|
|
458
|
+
const fenced = rest.slice(fencedAt, fencedAt + fence.reads.length);
|
|
459
|
+
const guardAt = fencedAt + fence.reads.length;
|
|
460
|
+
const guardedAt = guardAt + (guard?.reads.length ?? 0);
|
|
461
|
+
if (guard !== void 0) yield* guard.check(rest.slice(guardAt, guardedAt));
|
|
462
|
+
const now = rest.slice(guardedAt, guardedAt + unchanged.length);
|
|
463
|
+
const mirrorRows = rest.slice(guardedAt + unchanged.length).flat();
|
|
464
|
+
const changed = unchanged.some((row, at) => !Equal.equals(row.value, now[at]?.[0]?.value));
|
|
380
465
|
const packs = yield* decodePacks(packRows);
|
|
381
466
|
const times = yield* decodeTimes(timeRows);
|
|
382
467
|
const [ownRow] = own.length === 0 ? [] : rest[0] ?? [];
|
|
@@ -391,7 +476,10 @@ const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kep
|
|
|
391
476
|
const read = {
|
|
392
477
|
version: snapshot.version,
|
|
393
478
|
refs,
|
|
394
|
-
|
|
479
|
+
refBytes: refBytesOf(refRows),
|
|
480
|
+
head: headOf(record.defaultBranch),
|
|
481
|
+
record,
|
|
482
|
+
marked: reachedRows.length > 0
|
|
395
483
|
};
|
|
396
484
|
const at = {
|
|
397
485
|
repo: repo.internalId,
|
|
@@ -424,7 +512,8 @@ const finalRead = Effect.fnUntraced(function* (store, repo, fence, received, kep
|
|
|
424
512
|
times,
|
|
425
513
|
queued,
|
|
426
514
|
reserved,
|
|
427
|
-
indexRow
|
|
515
|
+
indexRow,
|
|
516
|
+
changed
|
|
428
517
|
};
|
|
429
518
|
});
|
|
430
519
|
const settingsOf = (record) => ({
|
|
@@ -432,32 +521,10 @@ const settingsOf = (record) => ({
|
|
|
432
521
|
public: record.public,
|
|
433
522
|
defaultBranch: record.defaultBranch
|
|
434
523
|
});
|
|
435
|
-
/** `objects`' batches as the engine's `ReadObjects`, over `listed`, each run in `scope`. */
|
|
436
|
-
const batchOf = (objects, listed, scope) => (input) => runIn(Effect.match(objects.objects(listed, input), {
|
|
437
|
-
onSuccess: (value) => ({
|
|
438
|
-
kind: "success",
|
|
439
|
-
value
|
|
440
|
-
}),
|
|
441
|
-
onFailure: (error) => ({
|
|
442
|
-
kind: "error",
|
|
443
|
-
error
|
|
444
|
-
})
|
|
445
|
-
}), scope);
|
|
446
|
-
/** `objects`' reads as the engine's `ReadObject`, over `listed`, each run in `scope`. */
|
|
447
|
-
const readerOf = (objects, listed, scope) => (input) => runIn(Effect.match(objects.read(listed, input), {
|
|
448
|
-
onSuccess: (value) => ({
|
|
449
|
-
kind: "success",
|
|
450
|
-
value
|
|
451
|
-
}),
|
|
452
|
-
onFailure: (error) => ({
|
|
453
|
-
kind: "error",
|
|
454
|
-
error
|
|
455
|
-
})
|
|
456
|
-
}), scope);
|
|
457
524
|
/** The rules, then `hooks.preReceive`, once, at the first read the push decides on. */
|
|
458
|
-
const runChecks = Effect.fnUntraced(function* (checks, input, facts) {
|
|
525
|
+
const runChecks = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, facts) {
|
|
459
526
|
const context = checking(input);
|
|
460
|
-
const ruled = yield*
|
|
527
|
+
const ruled = yield* claimedAfter(checks, input, yield* runPushRules(checks, input, context));
|
|
461
528
|
const whole = yield* runPreReceive(checks.reports, checks.preReceive, context, {
|
|
462
529
|
atomic: input.atomic,
|
|
463
530
|
updates: ruled.updates,
|
|
@@ -479,17 +546,21 @@ const runChecks = Effect.fnUntraced(function* (checks, input, facts) {
|
|
|
479
546
|
* hook refuses, on a ref none refused before, is told by its place, and the push fails. Passed, the
|
|
480
547
|
* answer is the first caller's, with the files allowed and the rules lifted for any of them.
|
|
481
548
|
*/
|
|
482
|
-
const checkAll = Effect.fnUntraced(function* (checks, request, input, facts, authorizeAs) {
|
|
549
|
+
const checkAll = /* @__PURE__ */ Effect.fnUntraced(function* (checks, request, input, facts, authorizeAs) {
|
|
483
550
|
if (request.queued === void 0) return yield* runChecks(checks, input, facts);
|
|
484
551
|
const each = [];
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
552
|
+
const refusals = [];
|
|
553
|
+
for (const caller of request.queued.callers) {
|
|
554
|
+
const one = yield* runChecks(checks, {
|
|
555
|
+
...input,
|
|
556
|
+
caller,
|
|
557
|
+
authorize: authorizeAs(caller)
|
|
558
|
+
}, facts);
|
|
559
|
+
const refusal = one.whole ?? [...one.refused].find(([ref]) => !input.refused.has(ref))?.[1];
|
|
560
|
+
if (refusal !== void 0 && retriedCodes.has(refusal.code)) return yield* Effect.fail(refusal);
|
|
561
|
+
each.push(one);
|
|
562
|
+
refusals.push(refusal);
|
|
563
|
+
}
|
|
493
564
|
yield* refuseQueued(request, refusals, "rules");
|
|
494
565
|
const union = (pick) => {
|
|
495
566
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -508,25 +579,28 @@ const checkAll = Effect.fnUntraced(function* (checks, request, input, facts, aut
|
|
|
508
579
|
bypassed: union((one) => one.bypassed)
|
|
509
580
|
};
|
|
510
581
|
});
|
|
511
|
-
/**
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
582
|
+
/**
|
|
583
|
+
* The rules' answer, with the refs the claimed checks refuse among the rest: each in turn, by band
|
|
584
|
+
* then claim name, on the refs none before it refused, so a ref's first refusal is its answer.
|
|
585
|
+
*/
|
|
586
|
+
const claimedAfter = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, ruled) {
|
|
587
|
+
const refused = new Map(ruled.refused);
|
|
588
|
+
for (const { handler } of checks.claimed?.() ?? []) {
|
|
589
|
+
const updates = ruled.updates.filter((update) => !refused.has(update.ref));
|
|
590
|
+
if (updates.length === 0) break;
|
|
591
|
+
for (const [ref, error] of yield* handler(input, updates)) if (!refused.has(ref)) refused.set(ref, error);
|
|
592
|
+
}
|
|
519
593
|
return {
|
|
520
594
|
...ruled,
|
|
521
|
-
refused
|
|
595
|
+
refused
|
|
522
596
|
};
|
|
523
597
|
});
|
|
524
|
-
/** Whether a push has anything to check: a rule,
|
|
525
|
-
const checksOf = (core)
|
|
598
|
+
/** Whether a push has anything to check: a rule, a claimed check, or `hooks.preReceive`. */
|
|
599
|
+
const checksOf = /* @__PURE__ */ Effect.fnUntraced(function* (core) {
|
|
526
600
|
const { checks } = core;
|
|
527
601
|
if (checks === void 0) return void 0;
|
|
528
|
-
return checks
|
|
529
|
-
};
|
|
602
|
+
return (yield* pushRulesFor(checks)).length > 0 || checks.preReceive !== void 0 || (checks.claimed?.().length ?? 0) > 0 ? checks : void 0;
|
|
603
|
+
});
|
|
530
604
|
/**
|
|
531
605
|
* The repo's objects with the push's own, for the built-in check: `objects` and `listed` read
|
|
532
606
|
* both, and `received` is the push's alone.
|
|
@@ -540,6 +614,17 @@ const pushedObjectsOf = (objects, listed, received, own) => {
|
|
|
540
614
|
lfsPointers: received?.lfsPointers ?? noLfsPointers
|
|
541
615
|
};
|
|
542
616
|
};
|
|
617
|
+
/** `decision`, a commit that clears the mark, with the clear's row at `at` among its puts. */
|
|
618
|
+
const clearedAt = (decision, at) => decision.kind === "commit" ? {
|
|
619
|
+
...decision,
|
|
620
|
+
change: {
|
|
621
|
+
...decision.change,
|
|
622
|
+
put: [...decision.change.put, {
|
|
623
|
+
...pruneClearedKey,
|
|
624
|
+
value: { at }
|
|
625
|
+
}]
|
|
626
|
+
}
|
|
627
|
+
} : decision;
|
|
543
628
|
/**
|
|
544
629
|
* What a decision commits: its writes and jobs at `expect`, or, for an answer that moves no ref,
|
|
545
630
|
* nothing, which a keyed write's receipt still commits at the read's version. A refusal fails.
|
|
@@ -568,7 +653,7 @@ const planOf = (decision, version, jobs) => {
|
|
|
568
653
|
* Each force among `kinds.updates` that its exact walk agrees is one, as a `diverged` refusal in
|
|
569
654
|
* `diverged`, or the walk's own error past its bound in `refused`.
|
|
570
655
|
*/
|
|
571
|
-
const divergedOf = Effect.fnUntraced(function* (kinds) {
|
|
656
|
+
const divergedOf = /* @__PURE__ */ Effect.fnUntraced(function* (kinds) {
|
|
572
657
|
const refused = /* @__PURE__ */ new Map();
|
|
573
658
|
const diverged = /* @__PURE__ */ new Map();
|
|
574
659
|
for (const update of kinds.updates) {
|
|
@@ -597,7 +682,7 @@ const divergedOf = Effect.fnUntraced(function* (kinds) {
|
|
|
597
682
|
* What the checks refused, and for a fetch, each diverged ref: refused, or with `force`, among
|
|
598
683
|
* `forced`.
|
|
599
684
|
*/
|
|
600
|
-
const fetchedRefused = Effect.fnUntraced(function* (kinds, request) {
|
|
685
|
+
const fetchedRefused = /* @__PURE__ */ Effect.fnUntraced(function* (kinds, request) {
|
|
601
686
|
const { fetched } = request;
|
|
602
687
|
if (fetched === void 0) return {
|
|
603
688
|
refused: kinds.refused,
|
|
@@ -636,7 +721,7 @@ const commitTooLarge = (received, body) => (error) => {
|
|
|
636
721
|
return gitError("RESOURCE_EXHAUSTED", `push's objects don't fit one commit: ${error.message}`, {
|
|
637
722
|
cause: error,
|
|
638
723
|
hint: "Push fewer objects at a time",
|
|
639
|
-
hostHint: "Use
|
|
724
|
+
hostHint: "Use Objects.layer() storage, which keeps a push's objects in the bucket",
|
|
640
725
|
context: { reason: "too-large" }
|
|
641
726
|
});
|
|
642
727
|
};
|
|
@@ -649,6 +734,13 @@ const fits = (change) => {
|
|
|
649
734
|
return false;
|
|
650
735
|
}
|
|
651
736
|
};
|
|
737
|
+
/** A push whose links or old tips the caller's set can't close yet, as between a large push and its update. */
|
|
738
|
+
const unindexedPush = () => gitError("RESOURCE_EXHAUSTED", "This push can't be checked until the repo's index is updated", {
|
|
739
|
+
hint: "Push again once the index is updated",
|
|
740
|
+
context: { reason: "walk-limit" }
|
|
741
|
+
});
|
|
742
|
+
/** `error`, a read by ID the index can't close yet told as the push's own. */
|
|
743
|
+
const asPushCheck = (error) => isUnindexedRead(error) ? unindexedPush() : error;
|
|
652
744
|
/** The request's pack into its quarantine, or `undefined` for a push with none. */
|
|
653
745
|
const receive = (objects, listed, request) => {
|
|
654
746
|
const { pack, shallow, signal } = request;
|
|
@@ -656,6 +748,10 @@ const receive = (objects, listed, request) => {
|
|
|
656
748
|
received: void 0,
|
|
657
749
|
rooted: void 0
|
|
658
750
|
});
|
|
751
|
+
if ("received" in pack) return Effect.succeed({
|
|
752
|
+
received: pack.received,
|
|
753
|
+
rooted: void 0
|
|
754
|
+
});
|
|
659
755
|
const input = {
|
|
660
756
|
pack: pack.bytes,
|
|
661
757
|
objects: pack.objects
|
|
@@ -665,6 +761,9 @@ const receive = (objects, listed, request) => {
|
|
|
665
761
|
if (shallow !== void 0 && shallow.length > 0) input.shallow = shallow;
|
|
666
762
|
if (signal !== void 0) input.signal = signal;
|
|
667
763
|
if (pack.partial === true) input.partial = true;
|
|
764
|
+
if (pack.boundary !== void 0 && pack.boundary.length > 0) input.boundary = pack.boundary;
|
|
765
|
+
if (pack.needs !== void 0 && pack.needs.length > 0) input.needs = pack.needs;
|
|
766
|
+
if (pack.cutMost !== void 0) input.cutMost = pack.cutMost;
|
|
668
767
|
return scopedReceive(objects, listed, input).pipe(Effect.map((received) => ({
|
|
669
768
|
received,
|
|
670
769
|
rooted: void 0
|
|
@@ -673,15 +772,33 @@ const receive = (objects, listed, request) => {
|
|
|
673
772
|
rooted
|
|
674
773
|
})));
|
|
675
774
|
};
|
|
676
|
-
/**
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
775
|
+
/**
|
|
776
|
+
* `ref.updated`'s `push`: the write, how many branches and tags it moved and each private
|
|
777
|
+
* pattern's part of them (`pushCounts`), its source, the slice its push options name, if they do
|
|
778
|
+
* (Q901), and those options, if it sent any.
|
|
779
|
+
*/
|
|
780
|
+
const pushOf = (access, id, moved, request) => {
|
|
781
|
+
const push = {
|
|
680
782
|
id,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
source
|
|
783
|
+
...pushCounts(access, moved),
|
|
784
|
+
source: request.source
|
|
684
785
|
};
|
|
786
|
+
const slice = sliceOf(request.pushOptions ?? []);
|
|
787
|
+
if (slice !== void 0) push.slice = slice;
|
|
788
|
+
const options = request.pushOptions ?? [];
|
|
789
|
+
if (options.length > 0) push.options = options;
|
|
790
|
+
return push;
|
|
791
|
+
};
|
|
792
|
+
/**
|
|
793
|
+
* Each of `moved` with its kind from `updates`, the push's decided updates. Every moved ref is
|
|
794
|
+
* among them, so the `force` fallback, the kind that claims least, is never taken.
|
|
795
|
+
*/
|
|
796
|
+
const movedKinds = (updates, moved) => {
|
|
797
|
+
const kinds = new Map(updates.map((update) => [update.ref, update.kind]));
|
|
798
|
+
return moved.map((move) => ({
|
|
799
|
+
...move,
|
|
800
|
+
kind: kinds.get(move.ref) ?? "force"
|
|
801
|
+
}));
|
|
685
802
|
};
|
|
686
803
|
/**
|
|
687
804
|
* What a push's commit saves for `hooks.postReceive`, when the host passed one: the push, with
|
|
@@ -694,11 +811,7 @@ const savedPush = (checks, push) => {
|
|
|
694
811
|
put: [],
|
|
695
812
|
jobs: []
|
|
696
813
|
};
|
|
697
|
-
const
|
|
698
|
-
const updates = push.moved.map((move) => ({
|
|
699
|
-
...move,
|
|
700
|
-
kind: kinds.get(move.ref) ?? "force"
|
|
701
|
-
}));
|
|
814
|
+
const updates = movedKinds(push.updates, push.moved);
|
|
702
815
|
const { pushOptions, source } = push.request;
|
|
703
816
|
const saved = {
|
|
704
817
|
pushId: push.id,
|
|
@@ -714,6 +827,17 @@ const savedPush = (checks, push) => {
|
|
|
714
827
|
};
|
|
715
828
|
};
|
|
716
829
|
/**
|
|
830
|
+
* The pack a push's own receive put under its `quarantine` row: none for a push with no pack, one
|
|
831
|
+
* of rows alone, or a caller's `received`, which stays its caller's to end.
|
|
832
|
+
*/
|
|
833
|
+
const ownPack = (request, received) => {
|
|
834
|
+
const id = received?.quarantine?.id;
|
|
835
|
+
if (request.pack === void 0 || "received" in request.pack || id === void 0) return void 0;
|
|
836
|
+
return isPackId(id) ? id : void 0;
|
|
837
|
+
};
|
|
838
|
+
/** Whether a commit lists `pack`: its change deletes the pack's own `quarantine` row. */
|
|
839
|
+
const lists = (body, pack) => body.delete.some((key) => key.collection === objectCollections.quarantine && key.id === pack);
|
|
840
|
+
/**
|
|
717
841
|
* The push decide's loop past its first read, onto `listed`, keeping its answer under `key`:
|
|
718
842
|
* the pack received into its quarantine; each edit's kind from the objects; then a read of the
|
|
719
843
|
* refs, the push's `quarantine` row and the caller's fence; a held receipt's answer; the rules and
|
|
@@ -721,17 +845,35 @@ const savedPush = (checks, push) => {
|
|
|
721
845
|
* version, with the ref moves, the receipt, the events and the push `hooks.postReceive` owes.
|
|
722
846
|
* `answers` says what the call answers and keeps.
|
|
723
847
|
*/
|
|
724
|
-
const pushOnto = (
|
|
848
|
+
const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, view, views }, key, answers) => Effect.scoped(Effect.gen(function* () {
|
|
849
|
+
const core = yield* CoreParts;
|
|
850
|
+
const { objects: sealed } = yield* ObjectsParts;
|
|
851
|
+
const authorize = yield* Authorize;
|
|
725
852
|
const { store } = core;
|
|
726
853
|
const { caller, repo, signal } = request;
|
|
727
854
|
const call = signal === void 0 ? {} : { signal };
|
|
728
|
-
const seen = yield* seenRefsOf(
|
|
729
|
-
const { received, rooted } = yield* receive(yield*
|
|
855
|
+
const seen = yield* seenRefsOf(view, listed);
|
|
856
|
+
const { received, rooted } = yield* receive(yield* read({
|
|
857
|
+
view,
|
|
858
|
+
at: seen
|
|
859
|
+
}), listed, request).pipe(Effect.tapError((error) => isAwaitingRepack(error) ? bestEffort(ensureRepack(core, core.jobs, repoScope(listed.repo))) : Effect.void), Effect.mapError(asPushCheck));
|
|
860
|
+
const ownedPack = ownPack(request, received);
|
|
861
|
+
let listing = false;
|
|
862
|
+
if (ownedPack !== void 0) yield* Effect.addFinalizer((exit) => listing || Exit.hasInterrupts(exit) ? Effect.void : Effect.flatMap(Clock$1.currentTimeMillis, (at) => abandonOwn({
|
|
863
|
+
store: gitStore(store),
|
|
864
|
+
repo: listed.repo,
|
|
865
|
+
pack: ownedPack,
|
|
866
|
+
at,
|
|
867
|
+
repackJobRow: core.repackJobRow
|
|
868
|
+
})));
|
|
730
869
|
const viewed = received === void 0 ? seen : {
|
|
731
870
|
...seen,
|
|
732
871
|
pushed: received
|
|
733
872
|
};
|
|
734
|
-
const objects = yield* walkObjects(
|
|
873
|
+
const objects = yield* walkObjects(objectsFace(yield* read({
|
|
874
|
+
view,
|
|
875
|
+
at: viewed
|
|
876
|
+
})), received?.allotment);
|
|
735
877
|
const pushedObjects = withReceivedRows(objects, received);
|
|
736
878
|
const pushedListed = withReceived(listed, received);
|
|
737
879
|
const pushed = pushedOf(objects, listed, received);
|
|
@@ -743,40 +885,45 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
743
885
|
...call
|
|
744
886
|
};
|
|
745
887
|
if (rooted !== void 0) kindsInput.missing = rooted;
|
|
746
|
-
const kinds = yield* kindsOf(kindsInput);
|
|
888
|
+
const kinds = yield* kindsOf(kindsInput).pipe(Effect.mapError(asPushCheck));
|
|
747
889
|
const fetchedOff = yield* fetchedRefused(kinds, request);
|
|
748
890
|
const { forced } = fetchedOff;
|
|
749
891
|
const refused = new Map(fetchedOff.refused);
|
|
892
|
+
const hidden = core.hiddenRefs();
|
|
750
893
|
for (const update of kinds.updates) {
|
|
751
|
-
const own = gitsOwnRef(update.ref, request.
|
|
894
|
+
const own = gitsOwnRef(hidden, update.ref, request.as);
|
|
752
895
|
if (own !== void 0 && !refused.has(update.ref)) refused.set(update.ref, own);
|
|
753
896
|
}
|
|
754
|
-
const
|
|
755
|
-
const unseens =
|
|
897
|
+
const refViews = yield* Effect.forEach(views, (one) => one.refView);
|
|
898
|
+
const unseens = refViews.map((refView) => unseenOf(refView, request.edits));
|
|
756
899
|
yield* refuseQueued(request, unseens.map((one) => one.values().next().value), "access");
|
|
757
900
|
const unseen = unseens[0] ?? /* @__PURE__ */ new Map();
|
|
758
901
|
const { updates } = kinds;
|
|
759
902
|
for (const [ref, error] of unseen) refused.set(ref, error);
|
|
760
903
|
const { access } = core;
|
|
761
|
-
const barred = access?.patterns.some((pattern) =>
|
|
762
|
-
const whole =
|
|
904
|
+
const barred = access?.patterns.some((pattern) => refViews.some((refView) => !publishable(refView, pattern))) === true;
|
|
905
|
+
const whole = objectsFace(SealedObjects.whole(sealed, pushWhole));
|
|
763
906
|
const wholePushed = access === void 0 || !barred && request.publishes === void 0 ? void 0 : withReceivedRows(yield* walkObjects(whole, received?.allotment), received);
|
|
764
|
-
const
|
|
765
|
-
const publishedRefs = (refs) => new Map([...refs].filter(([ref]) => hiddenUnder(ref) === void 0));
|
|
907
|
+
const refView = refViews[0] ?? (yield* view.refView);
|
|
908
|
+
const publishedRefs = (refs) => new Map([...refs].filter(([ref]) => hiddenUnder(hidden, ref) === void 0));
|
|
766
909
|
const writer = access === void 0 ? void 0 : yield* ownWriter(caller);
|
|
767
910
|
const made = new Set(request.own);
|
|
768
911
|
const ownOf = writer === void 0 ? void 0 : (oids) => {
|
|
769
912
|
const here = oids.filter((oid) => made.has(oid));
|
|
770
913
|
const stored = oids.filter((oid) => !made.has(oid));
|
|
771
914
|
if (stored.length === 0) return Effect.succeed(new Set(here));
|
|
772
|
-
return Effect.map(Effect.flatMap(
|
|
915
|
+
return Effect.map(Effect.flatMap(Clock$1.currentTimeMillis, (now) => ownWritesOf(core.store, listed.repo, writer, stored, now)), (kept) => /* @__PURE__ */ new Set([...here, ...kept]));
|
|
773
916
|
};
|
|
774
|
-
const unpublishedAt = (refs, at, judging, edits, own) => access === void 0 || wholePushed === void 0 ? Effect.succeed(/* @__PURE__ */ new Map()) : unpublished({
|
|
917
|
+
const unpublishedAt = (refs, at, index, judging, edits, own) => access === void 0 || wholePushed === void 0 ? Effect.succeed(/* @__PURE__ */ new Map()) : unpublished({
|
|
775
918
|
access,
|
|
776
|
-
|
|
919
|
+
refView: judging,
|
|
777
920
|
refs: publishedRefs(refs),
|
|
778
921
|
objects: whole,
|
|
779
922
|
listed: at,
|
|
923
|
+
visible: (tips, fallback) => SealedObjects.visibleWhole(sealed, pushWhole, at, {
|
|
924
|
+
tips,
|
|
925
|
+
row: index?.value
|
|
926
|
+
}, fallback),
|
|
780
927
|
pushed: wholePushed,
|
|
781
928
|
pushedListed: withReceived(at, received),
|
|
782
929
|
edits,
|
|
@@ -784,9 +931,9 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
784
931
|
...call
|
|
785
932
|
});
|
|
786
933
|
const headsOf = (edit) => edit.to === null ? void 0 : request.publishes?.get(edit.ref);
|
|
787
|
-
const publishedAt =
|
|
934
|
+
const publishedAt = Effect.fnUntraced(function* (refs, at, index) {
|
|
788
935
|
const plain = request.edits.filter((edit) => headsOf(edit) === void 0);
|
|
789
|
-
const refused = new Map(yield* unpublishedAt(refs, at,
|
|
936
|
+
const refused = new Map(yield* unpublishedAt(refs, at, index, refView, plain, ownOf));
|
|
790
937
|
for (const edit of request.edits) {
|
|
791
938
|
const heads = headsOf(edit);
|
|
792
939
|
if (heads === void 0) continue;
|
|
@@ -796,8 +943,8 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
796
943
|
}
|
|
797
944
|
const failed = [];
|
|
798
945
|
for (const { entry, head, caller: its } of heads) {
|
|
799
|
-
const judging = yield*
|
|
800
|
-
if ((yield* unpublishedAt(refs, at, judging, [{
|
|
946
|
+
const judging = yield* refViewIn(its, checkedRepo);
|
|
947
|
+
if ((yield* unpublishedAt(refs, at, index, judging, [{
|
|
801
948
|
...edit,
|
|
802
949
|
to: head
|
|
803
950
|
}])).has(edit.ref)) failed.push(entry);
|
|
@@ -806,11 +953,19 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
806
953
|
}
|
|
807
954
|
return refused;
|
|
808
955
|
});
|
|
956
|
+
const tagTips = updates.flatMap((update) => update.to !== null && storesPeel(update.ref) ? [update.to] : []);
|
|
957
|
+
const peeling = yield* peeledAll(pushedObjects, pushedListed, tagTips);
|
|
958
|
+
const peels = new Map(tagTips.map((tip) => [tip, peeling.peeled.get(tip) ?? null]));
|
|
959
|
+
for (const update of updates) {
|
|
960
|
+
const error = update.to === null ? void 0 : peeling.refused.get(update.to);
|
|
961
|
+
if (error !== void 0 && storesPeel(update.ref) && !refused.has(update.ref)) refused.set(update.ref, error);
|
|
962
|
+
}
|
|
809
963
|
const command = {
|
|
810
964
|
source: request.source,
|
|
811
965
|
updates,
|
|
812
966
|
atomic: request.atomic,
|
|
813
|
-
refused
|
|
967
|
+
refused,
|
|
968
|
+
peels
|
|
814
969
|
};
|
|
815
970
|
if (received !== void 0) command.received = received;
|
|
816
971
|
const target = {
|
|
@@ -820,13 +975,14 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
820
975
|
const fence = fenceAll(request, decidingFor(request).map((one) => core.fences(one, target)));
|
|
821
976
|
const ready = objects.readyShallow && request.edits.some((edit) => edit.ref === defaultBranch || edit.ref.startsWith("refs/tags/"));
|
|
822
977
|
const jobs = (received?.change.add?.length ?? 0) > 0 || ready ? [core.repackJobRow()] : [];
|
|
823
|
-
const own = updates.filter((update) => gitsOwnMove(request.
|
|
824
|
-
const outside = updates.filter((update) => !gitsOwnMove(request.
|
|
825
|
-
const checks = outside.length === 0 ? void 0 : checksOf(core);
|
|
978
|
+
const own = updates.filter((update) => gitsOwnMove(hidden, request.as, update.ref));
|
|
979
|
+
const outside = updates.filter((update) => !gitsOwnMove(hidden, request.as, update.ref));
|
|
980
|
+
const checks = outside.length === 0 ? void 0 : yield* checksOf(core);
|
|
826
981
|
const branches = request.source === "queue" ? [] : outside.map((update) => update.ref).filter((ref) => ref.startsWith("refs/heads/"));
|
|
827
982
|
const scope = yield* callScope;
|
|
828
983
|
const reader = readerOf(pushedObjects, pushedListed, scope);
|
|
829
984
|
const batch = batchOf(pushedObjects, pushedListed, scope);
|
|
985
|
+
const { between } = yield* Changes;
|
|
830
986
|
const unaborted = signal ?? new AbortController().signal;
|
|
831
987
|
const base = {
|
|
832
988
|
caller,
|
|
@@ -840,9 +996,14 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
840
996
|
},
|
|
841
997
|
exact: kinds.exact,
|
|
842
998
|
scope,
|
|
843
|
-
changes: (updates) =>
|
|
999
|
+
changes: (updates) => Effect.map(Effect.forEach(updates, ({ from, to }) => between({
|
|
1000
|
+
objects: pushedObjects,
|
|
1001
|
+
listed: pushedListed,
|
|
1002
|
+
from: from ?? void 0,
|
|
1003
|
+
to: to ?? void 0
|
|
1004
|
+
})), (each) => each.flat()),
|
|
844
1005
|
objects: pushedObjectsOf(pushedObjects, pushedListed, received, pushed),
|
|
845
|
-
authorize: (operation) =>
|
|
1006
|
+
authorize: (operation) => authorize.check({
|
|
846
1007
|
caller,
|
|
847
1008
|
operation,
|
|
848
1009
|
repo: checkedRepo
|
|
@@ -857,21 +1018,20 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
857
1018
|
source: request.source,
|
|
858
1019
|
allotment: received?.allotment,
|
|
859
1020
|
readerAllotment: pushedObjects.allotment(pushedListed, openTreeBytes, openTreesRefusal),
|
|
860
|
-
brought: broughtCommit(pushed
|
|
861
|
-
scope
|
|
1021
|
+
brought: broughtCommit(pushed)
|
|
862
1022
|
};
|
|
863
1023
|
if (request.pushOptions !== void 0) base.pushOptions = request.pushOptions;
|
|
864
1024
|
if (request.request !== void 0) base.request = request.request;
|
|
865
1025
|
let checked;
|
|
866
1026
|
for (let tries = 0; tries < 10; tries += 1) {
|
|
867
|
-
const at = yield*
|
|
868
|
-
const decide = yield* finalRead(store, target, fence, received, key, mark, branches);
|
|
1027
|
+
const at = yield* Clock$1.currentTimeMillis;
|
|
1028
|
+
const decide = yield* finalRead(store, target, fence, received, key, mark, branches, updates.map(({ ref }) => ref), request.guard, request.writes?.unchanged);
|
|
869
1029
|
const { read, receipt, outbox, record, mirrored, facts, stats, times, queued, reserved, indexRow } = decide;
|
|
870
|
-
const indexed = SealedObjects.whole(
|
|
1030
|
+
const indexed = SealedObjects.whole(sealed, pushWhole).index?.status(indexRow, at, listedIds(decide.at, received?.change));
|
|
871
1031
|
if (receipt !== void 0) return yield* answers.held(receipt);
|
|
872
|
-
const published = yield* publishedAt(read.refs, decide.at);
|
|
1032
|
+
const published = yield* publishedAt(read.refs, decide.at, indexRow);
|
|
873
1033
|
const { writes } = request;
|
|
874
|
-
if (writes !== void 0 && read.version !== writes.version) return yield* Effect.fail(queueMoved(repo));
|
|
1034
|
+
if (writes !== void 0 && (writes.unchanged === void 0 ? read.version !== writes.version : decide.changed)) return yield* Effect.fail(queueMoved(repo));
|
|
875
1035
|
const seen = {
|
|
876
1036
|
...facts,
|
|
877
1037
|
tips: tipsOf(read.refs, outside)
|
|
@@ -898,7 +1058,7 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
898
1058
|
return commitChangesOf(judging, updates);
|
|
899
1059
|
}
|
|
900
1060
|
};
|
|
901
|
-
checked = yield* checkAll(checks, request, input, seen, (one) => (operation) =>
|
|
1061
|
+
checked = yield* checkAll(checks, request, input, seen, (one) => (operation) => authorize.check({
|
|
902
1062
|
caller: one,
|
|
903
1063
|
operation,
|
|
904
1064
|
repo: checkedRepo
|
|
@@ -923,18 +1083,24 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
923
1083
|
...unseen
|
|
924
1084
|
])
|
|
925
1085
|
};
|
|
926
|
-
const
|
|
1086
|
+
const chosen = decidePush({
|
|
927
1087
|
read,
|
|
928
|
-
command: decided
|
|
929
|
-
|
|
1088
|
+
command: decided,
|
|
1089
|
+
index: core.refIndex
|
|
1090
|
+
});
|
|
1091
|
+
const clears = read.marked === true && clearsMark(chosen);
|
|
1092
|
+
const decision = clears ? clearedAt(chosen, at) : chosen;
|
|
1093
|
+
const upkept = clears && jobs.length === 0 ? [core.repackJobRow()] : jobs;
|
|
1094
|
+
const planned = yield* planOf(decision, read.version, upkept);
|
|
930
1095
|
const { change } = planned;
|
|
931
1096
|
const refusal = writes === void 0 ? void 0 : refusalOf(planned.answer);
|
|
932
1097
|
if (refusal !== void 0) return yield* Effect.fail(refusal);
|
|
933
1098
|
const movedRefs = new Set(planned.moved.map((move) => move.ref));
|
|
934
1099
|
const liftedOnMoves = [...checked?.bypassed ?? none].filter(([ref]) => movedRefs.has(ref));
|
|
935
1100
|
const answer = yield* answers.answer(planned.answer, forced, new Map(liftedOnMoves));
|
|
936
|
-
const also = planned.answer.updates.some((update) => update.kind === "rejected") || request.also === void 0 ? void 0 : request.also(yield*
|
|
937
|
-
const
|
|
1101
|
+
const also = planned.answer.updates.some((update) => update.kind === "rejected") || request.also === void 0 ? void 0 : request.also(yield* Clock$1.currentTimeMillis, received);
|
|
1102
|
+
const alsoWrites = (also?.put.length ?? 0) + (also?.delete?.length ?? 0);
|
|
1103
|
+
const quiet = key === void 0 && alsoWrites === 0 && writes === void 0;
|
|
938
1104
|
if (!planned.moves && quiet) return answer;
|
|
939
1105
|
const scope = repoScope(listed.repo);
|
|
940
1106
|
const { name } = record;
|
|
@@ -946,9 +1112,11 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
946
1112
|
if (yield* settleName(store, scope, settling)) continue;
|
|
947
1113
|
const envelope = repoEnvelope(caller, name);
|
|
948
1114
|
const id = newChangeId();
|
|
949
|
-
const shown = planned.moved.filter((move) => !gitsOwnMove(request.
|
|
950
|
-
const
|
|
951
|
-
|
|
1115
|
+
const shown = planned.moved.filter((move) => !gitsOwnMove(core.hiddenRefs(), request.as, move.ref));
|
|
1116
|
+
const optionsPast = pushOptionsProblem(request.pushOptions, shown.length);
|
|
1117
|
+
if (optionsPast !== void 0) return yield* Effect.fail(optionsPast);
|
|
1118
|
+
const push = pushOf(core.access, id, shown, request);
|
|
1119
|
+
const events = movedKinds(decided.updates, shown).map((move) => {
|
|
952
1120
|
const updated = {
|
|
953
1121
|
type: "ref.updated",
|
|
954
1122
|
...envelope,
|
|
@@ -995,6 +1163,7 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
995
1163
|
delete: [
|
|
996
1164
|
...change.delete,
|
|
997
1165
|
...appended.delete,
|
|
1166
|
+
...also?.delete ?? [],
|
|
998
1167
|
...writes?.delete ?? []
|
|
999
1168
|
],
|
|
1000
1169
|
jobs: withJobs([
|
|
@@ -1004,10 +1173,22 @@ const pushOnto = (core, request, { listed, defaultBranch, mark, repo: checkedRep
|
|
|
1004
1173
|
...mirrorJobs(core, planned.moved, mirrored),
|
|
1005
1174
|
...writes?.jobs ?? [],
|
|
1006
1175
|
...woken,
|
|
1007
|
-
...shown.length > 0 ? indexJobs(core, indexed) : []
|
|
1176
|
+
...shown.length > 0 ? indexJobs(core, indexed) : [],
|
|
1177
|
+
...planned.moves ? refIndexJobs(core, record) : []
|
|
1008
1178
|
], [...kept.jobs, ...also?.jobs ?? []])
|
|
1009
1179
|
};
|
|
1010
|
-
|
|
1180
|
+
const objects = (received?.change.put?.length ?? 0) + (received?.change.delete?.length ?? 0);
|
|
1181
|
+
const written = body.put.length + body.delete.length + body.jobs.length;
|
|
1182
|
+
const past = otherWritesProblem({
|
|
1183
|
+
writes: written,
|
|
1184
|
+
objects,
|
|
1185
|
+
moved: planned.moved.length
|
|
1186
|
+
}, core.refIndex);
|
|
1187
|
+
if (past !== void 0) return yield* Effect.fail(past);
|
|
1188
|
+
if ((yield* storeCall(() => store.commit(scope, body)).pipe(Effect.mapError(commitTooLarge(received, body)))).ok) {
|
|
1189
|
+
listing = ownedPack !== void 0 && lists(body, ownedPack);
|
|
1190
|
+
return final;
|
|
1191
|
+
}
|
|
1011
1192
|
}
|
|
1012
1193
|
return yield* fail("UNAVAILABLE", `Other writes kept moving '${repo}' through 10 tries`, { hint: "Push again" });
|
|
1013
1194
|
}));
|
|
@@ -1025,16 +1206,16 @@ const operationOf = ({ repo, edits }) => edits.length === 0 ? {
|
|
|
1025
1206
|
* reads and decides again. A push cut before its commit leaves an unlisted pack for clean-up, and
|
|
1026
1207
|
* no ref moved.
|
|
1027
1208
|
*/
|
|
1028
|
-
const pushWith =
|
|
1209
|
+
const pushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, key) {
|
|
1029
1210
|
const operation = operationOf(request);
|
|
1030
|
-
const resolved = yield* firstRead(
|
|
1031
|
-
const opened = yield* listedFor(
|
|
1032
|
-
return yield* pushOnto(
|
|
1211
|
+
const resolved = yield* firstRead(request.caller, operation, request.internalId).pipe(Effect.tapError((error) => retriedCodes.has(error.code) ? Effect.void : refuseQueued(request, [error], "access")));
|
|
1212
|
+
const opened = yield* listedFor(request, operation, resolved);
|
|
1213
|
+
return yield* pushOnto(request, opened, key, answers);
|
|
1033
1214
|
});
|
|
1034
1215
|
/** A push or an unkeyed `refs.update`, answering the decide's ref answer. */
|
|
1035
|
-
const push = (
|
|
1216
|
+
const push = (request) => pushWith(request, refsAnswers);
|
|
1036
1217
|
/** A `git push`, as `push`, with the lines Git prints for the rules `authorize` lifted. */
|
|
1037
|
-
const gitPush = (
|
|
1218
|
+
const gitPush = (request) => pushWith(request, gitAnswers);
|
|
1038
1219
|
/** A ref a forced fetch moved past its diverged tip, answered `force`; the rest as they are. */
|
|
1039
1220
|
const forcedOf = (forced) => (update) => update.kind === "applied" && forced.has(update.ref) ? {
|
|
1040
1221
|
kind: "force",
|
|
@@ -1049,7 +1230,7 @@ const appliedOf = (update) => update.kind === "force" ? {
|
|
|
1049
1230
|
* A client's fetch into its own refs, as `push`, each diverged ref a forced fetch moved answered
|
|
1050
1231
|
* `force`. Its refs move in one commit, so a fetch stopped before it moves none.
|
|
1051
1232
|
*/
|
|
1052
|
-
const pushFetched = (
|
|
1233
|
+
const pushFetched = (request) => pushWith(request, {
|
|
1053
1234
|
answer: (updated, forced) => Effect.succeed(updated.updates.map(forcedOf(forced))),
|
|
1054
1235
|
kept: (updates) => refsKept({ updates: updates.map(appliedOf) }),
|
|
1055
1236
|
held: (receipt) => Effect.map(refsAnswer(receipt), (held) => held.updates)
|
|
@@ -1058,13 +1239,13 @@ const pushFetched = (core, request) => pushWith(core, request, {
|
|
|
1058
1239
|
* `pushWith` for a write's key, which keeps its answer. `undefined`, with nothing written or
|
|
1059
1240
|
* asked of `authorize`, when the name holds a repo other than the one its key's lookup saw.
|
|
1060
1241
|
*/
|
|
1061
|
-
const keyedPushWith =
|
|
1242
|
+
const keyedPushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, keyed) {
|
|
1062
1243
|
const operation = operationOf(request);
|
|
1063
|
-
const resolved = yield* keyedRead(
|
|
1244
|
+
const resolved = yield* keyedRead(request.caller, operation, keyed.missed, request.internalId);
|
|
1064
1245
|
if (resolved === void 0) return void 0;
|
|
1065
|
-
const opened = yield* listedFor(
|
|
1066
|
-
return yield* pushOnto(
|
|
1246
|
+
const opened = yield* listedFor(request, operation, resolved);
|
|
1247
|
+
return yield* pushOnto(request, opened, keyed.key, answers);
|
|
1067
1248
|
});
|
|
1068
1249
|
/** `keyedPushWith` for `refs.update`, answering the decide's ref answer. */
|
|
1069
|
-
const keyedPush = (
|
|
1070
|
-
export { gitPush, isQueueMoved, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|
|
1250
|
+
const keyedPush = (request, keyed) => keyedPushWith(request, refsAnswers, keyed);
|
|
1251
|
+
export { buildFence, gitPush, isQueueMoved, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|