@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/engine/merge.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fail, gitError } from "../contracts/result.mjs";
|
|
1
2
|
import { joinedBytes } from "../protocol/bytes/joined.mjs";
|
|
2
3
|
import { streamOf } from "../protocol/bytes/streams.mjs";
|
|
3
4
|
import { bytesOf, keyOf } from "../protocol/diff/paths.mjs";
|
|
@@ -7,7 +8,7 @@ import { compareEntries, treeBytes } from "../protocol/objects/tree.mjs";
|
|
|
7
8
|
import { attributesFor, parseAttributes, parsedBytes, pathAttributesOf, refusedAttribute } from "./attributes.mjs";
|
|
8
9
|
import { defaultContentConfig, markerSizeOf, mergeContent } from "./content.mjs";
|
|
9
10
|
import { ancestry, namedCommit } from "./commits.mjs";
|
|
10
|
-
import {
|
|
11
|
+
import { fromDiff, fromMissing } from "./failures.mjs";
|
|
11
12
|
import { mergeBasesOf } from "./merge-base-walk.mjs";
|
|
12
13
|
import { folderRenamesOf, foldersAbove, movedBy, otherOf, renamesOf } from "./merge-renames.mjs";
|
|
13
14
|
import { limitsOf, readThrough, stepDeadline, timed, within } from "./reads.mjs";
|
|
@@ -53,7 +54,8 @@ import * as Scope from "effect/Scope";
|
|
|
53
54
|
* `<path>~<label>`, or `_0` and on after it. A rename/delete keeps the base's file at the
|
|
54
55
|
* destination, a rename/rename merges at both, and a file added beside a rename merges with it
|
|
55
56
|
* two-way. Directory renames stay off there, and `.gitattributes` are the outer merge's. A
|
|
56
|
-
* conflict there that isn't measured against git 2.53.0 refuses: `unsupported-virtual-base
|
|
57
|
+
* conflict there that isn't measured against git 2.53.0 refuses: `unsupported-virtual-base`, as
|
|
58
|
+
* does a virtual base past `virtualBaseMergesMost` merges.
|
|
57
59
|
*
|
|
58
60
|
* A file both sides changed merges with the attributes ours's `.gitattributes` give it, as `git
|
|
59
61
|
* merge` reads its worktree's and `git --attr-source=<ours> merge-tree` reads ours: `merge=union`,
|
|
@@ -68,6 +70,8 @@ const scoredByDiff = {
|
|
|
68
70
|
set: "text",
|
|
69
71
|
unset: "binary"
|
|
70
72
|
};
|
|
73
|
+
/** The most bytes of JSON a conflict's listed paths take, well under a client's 4 MiB read. */
|
|
74
|
+
const conflictPathBytesMost = 1048576;
|
|
71
75
|
/** A mode's kind, as `S_IFMT` reads it: a file, executable or not, a symlink, or a gitlink. */
|
|
72
76
|
const kindOf = (mode) => mode === "100755" ? "100644" : mode;
|
|
73
77
|
const same = (x, y) => x !== void 0 && y !== void 0 && x.mode === y.mode && x.oid === y.oid;
|
|
@@ -147,7 +151,10 @@ var TreeMerge = class {
|
|
|
147
151
|
get checkpoint() {
|
|
148
152
|
return Effect.andThen(Effect.yieldNow, within(this.deadline));
|
|
149
153
|
}
|
|
150
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* The collection again from its start, reading the folders of `sides`. It keeps the trees read,
|
|
156
|
+
* so the second collection charges none of them again.
|
|
157
|
+
*/
|
|
151
158
|
readFoldersOf(sides) {
|
|
152
159
|
this.reads = sides;
|
|
153
160
|
this.files = /* @__PURE__ */ new Map();
|
|
@@ -157,24 +164,22 @@ var TreeMerge = class {
|
|
|
157
164
|
this.late = bySide();
|
|
158
165
|
}
|
|
159
166
|
/** An object the merge made, its bytes charged to the call. */
|
|
160
|
-
write(type, bytes) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
bytes
|
|
166
|
-
});
|
|
167
|
-
this.made.set(oid, {
|
|
168
|
-
type,
|
|
169
|
-
bytes
|
|
170
|
-
});
|
|
171
|
-
this.known.set(oid, {
|
|
172
|
-
type,
|
|
173
|
-
bytes
|
|
174
|
-
});
|
|
175
|
-
return oid;
|
|
167
|
+
write = Effect.fnUntraced({ self: this }, function* (type, bytes) {
|
|
168
|
+
yield* Effect.mapError(this.reader.charge(bytes.length), fromDiff("diff-limit"));
|
|
169
|
+
const oid = yield* objectId({
|
|
170
|
+
type,
|
|
171
|
+
bytes
|
|
176
172
|
});
|
|
177
|
-
|
|
173
|
+
this.made.set(oid, {
|
|
174
|
+
type,
|
|
175
|
+
bytes
|
|
176
|
+
});
|
|
177
|
+
this.known.set(oid, {
|
|
178
|
+
type,
|
|
179
|
+
bytes
|
|
180
|
+
});
|
|
181
|
+
return oid;
|
|
182
|
+
});
|
|
178
183
|
/** A folder's entries, or none where a side has no folder here. */
|
|
179
184
|
entries(entry) {
|
|
180
185
|
if (entry === void 0 || !isFolder(entry)) return Effect.succeed([]);
|
|
@@ -189,61 +194,57 @@ var TreeMerge = class {
|
|
|
189
194
|
* Three folders' entries collected, at `prefix`, a folder's key and `/` or none at the root.
|
|
190
195
|
* Below a folder a directory rename might move, `moved`, every folder is read.
|
|
191
196
|
*/
|
|
192
|
-
folder(prefix, sides, moved) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return yield* fail("DATA_LOSS", `A tree names ${path} twice`);
|
|
205
|
-
}
|
|
206
|
-
three[at] = entry;
|
|
207
|
-
byName.set(key, three);
|
|
197
|
+
folder = Effect.fnUntraced({ self: this }, function* (prefix, sides, moved) {
|
|
198
|
+
const byName = /* @__PURE__ */ new Map();
|
|
199
|
+
for (const [at, entries] of sides.entries()) for (const entry of entries) {
|
|
200
|
+
const key = keyOf(entry.name);
|
|
201
|
+
const three = byName.get(key) ?? [
|
|
202
|
+
void 0,
|
|
203
|
+
void 0,
|
|
204
|
+
void 0
|
|
205
|
+
];
|
|
206
|
+
if (three[at] !== void 0) {
|
|
207
|
+
const path = new TextDecoder().decode(bytesOf(prefix + key));
|
|
208
|
+
return yield* fail("DATA_LOSS", `A tree names ${path} twice`);
|
|
208
209
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
three[at] = entry;
|
|
211
|
+
byName.set(key, three);
|
|
212
|
+
}
|
|
213
|
+
for (const [name, three] of byName) yield* this.path(prefix + name, three, moved);
|
|
214
|
+
});
|
|
212
215
|
/**
|
|
213
216
|
* One path's three entries collected. Its files are kept whatever they hold. Where a folder is
|
|
214
217
|
* among them, a side as the base had it, or without it as the base was, takes the other side's
|
|
215
218
|
* entry whole, an empty folder too, unless renames read that side: its folders' files, and the
|
|
216
219
|
* base's it deleted, may be renames' destinations and sources.
|
|
217
220
|
*/
|
|
218
|
-
path(key, three, moved) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (taken !== void 0)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (folders !== 0)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
});
|
|
246
|
-
}
|
|
221
|
+
path = Effect.fnUntraced({ self: this }, function* (key, three, moved) {
|
|
222
|
+
const [base, ours, theirs] = three;
|
|
223
|
+
const folders = maskOf(three, isFolder);
|
|
224
|
+
const files = maskOf(three, (entry) => !isFolder(entry));
|
|
225
|
+
const whole = (side) => alike(base, three[side]) || !moved && !this.reads.has(side);
|
|
226
|
+
if (!moved) this.defer(key, three);
|
|
227
|
+
const taken = folders === 0 ? void 0 : alike(base, ours) && whole(2) ? { entry: theirs } : alike(base, theirs) && whole(1) ? { entry: ours } : void 0;
|
|
228
|
+
if (taken !== void 0) {
|
|
229
|
+
if (taken.entry !== void 0) this.whole.set(key, taken.entry);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (folders !== 0) {
|
|
233
|
+
for (const side of [1, 2]) if ((folders & 1) !== 0 && (folders & 1 << side) === 0) this.removed[side].add(key);
|
|
234
|
+
const below = [
|
|
235
|
+
yield* this.entries(base),
|
|
236
|
+
yield* this.entries(ours),
|
|
237
|
+
yield* this.entries(theirs)
|
|
238
|
+
];
|
|
239
|
+
const movable = this.movable(key, three, below);
|
|
240
|
+
yield* this.folder(`${key}/`, below, moved || movable);
|
|
241
|
+
}
|
|
242
|
+
if (files !== 0) this.files.set(key, [
|
|
243
|
+
fileOf(base),
|
|
244
|
+
fileOf(ours),
|
|
245
|
+
fileOf(theirs)
|
|
246
|
+
]);
|
|
247
|
+
});
|
|
247
248
|
/**
|
|
248
249
|
* Where Git's merge reads a side's folder late, after every other path, which orders its
|
|
249
250
|
* renames: the side has a folder here that isn't the base's, the other side has the base's
|
|
@@ -300,235 +301,229 @@ var TreeMerge = class {
|
|
|
300
301
|
* Every collected path resolved, its renames and directory renames applied: the files of the
|
|
301
302
|
* merged tree, each path's that conflicts marked.
|
|
302
303
|
*/
|
|
303
|
-
resolve() {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
conflict: false
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
const renamed = (side) => Effect.gen({ self: this }, function* () {
|
|
317
|
-
const found = yield* Effect.mapError(renamesOf(this.reader, this.files, side, (key) => this.relevant(side, key), this.late[side], (key) => this.scoredAs(key)), fromDiff("diff-limit"));
|
|
318
|
-
if (found.renamesSkipped !== void 0) this.renamesSkipped.add(found.renamesSkipped);
|
|
319
|
-
return found.renames;
|
|
304
|
+
resolve = Effect.fnUntraced({ self: this }, function* () {
|
|
305
|
+
const items = /* @__PURE__ */ new Map();
|
|
306
|
+
for (const [key, three] of this.files) {
|
|
307
|
+
const added = [1, 2].filter((side) => three[side] !== void 0);
|
|
308
|
+
const newOn = three[0] === void 0 && added.length === 1 ? added[0] : void 0;
|
|
309
|
+
items.set(key, {
|
|
310
|
+
at: key,
|
|
311
|
+
three: [...three],
|
|
312
|
+
newOn,
|
|
313
|
+
conflict: false
|
|
320
314
|
});
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
renames: /* @__PURE__ */ new Map(),
|
|
327
|
-
split: false
|
|
328
|
-
} : folderRenamesOf(found[side], this.removed[side], this.moving[side]);
|
|
329
|
-
const folders = {
|
|
330
|
-
1: folderRenames(1),
|
|
331
|
-
2: folderRenames(2)
|
|
332
|
-
};
|
|
333
|
-
const renames = yield* this.relocated(items, found, folders);
|
|
334
|
-
yield* this.renamed(items, renames);
|
|
335
|
-
yield* this.moved(items, folders);
|
|
336
|
-
const byAt = /* @__PURE__ */ new Map();
|
|
337
|
-
for (const item of items.values()) byAt.set(item.at, [...byAt.get(item.at) ?? [], item]);
|
|
338
|
-
const out = /* @__PURE__ */ new Map();
|
|
339
|
-
for (const [at, landed] of byAt) {
|
|
340
|
-
const [item] = landed;
|
|
341
|
-
if (item === void 0) continue;
|
|
342
|
-
if (landed.length > 1 || item.conflict) {
|
|
343
|
-
const kept = landed.flatMap(({ three }) => [three[1], three[2]]).find(Boolean);
|
|
344
|
-
this.conflicts.add(at);
|
|
345
|
-
if (kept !== void 0) out.set(at, kept);
|
|
346
|
-
else this.fileless.add(at);
|
|
347
|
-
continue;
|
|
348
|
-
}
|
|
349
|
-
const marks = item.named === void 0 ? void 0 : {
|
|
350
|
-
...item.named,
|
|
351
|
-
longer: 0
|
|
352
|
-
};
|
|
353
|
-
const resolved = yield* this.file(at, item.three, marks);
|
|
354
|
-
if (!resolved.clean) this.conflicts.add(at);
|
|
355
|
-
if (resolved.entry !== void 0) out.set(at, resolved.entry);
|
|
356
|
-
else if (!resolved.clean) this.fileless.add(at);
|
|
357
|
-
}
|
|
358
|
-
return out;
|
|
315
|
+
}
|
|
316
|
+
const renamed = Effect.fnUntraced({ self: this }, function* (side) {
|
|
317
|
+
const found = yield* Effect.mapError(renamesOf(this.reader, this.files, side, (key) => this.relevant(side, key), this.late[side], (key) => this.scoredAs(key)), fromDiff("diff-limit"));
|
|
318
|
+
if (found.renamesSkipped !== void 0) this.renamesSkipped.add(found.renamesSkipped);
|
|
319
|
+
return found.renames;
|
|
359
320
|
});
|
|
360
|
-
|
|
321
|
+
const found = {
|
|
322
|
+
1: yield* renamed(1),
|
|
323
|
+
2: yield* renamed(2)
|
|
324
|
+
};
|
|
325
|
+
const folderRenames = (side) => this.depth > 0 ? {
|
|
326
|
+
renames: /* @__PURE__ */ new Map(),
|
|
327
|
+
split: false
|
|
328
|
+
} : folderRenamesOf(found[side], this.removed[side], this.moving[side]);
|
|
329
|
+
const folders = {
|
|
330
|
+
1: folderRenames(1),
|
|
331
|
+
2: folderRenames(2)
|
|
332
|
+
};
|
|
333
|
+
const renames = yield* this.relocated(items, found, folders);
|
|
334
|
+
yield* this.renamed(items, renames);
|
|
335
|
+
yield* this.moved(items, folders);
|
|
336
|
+
const byAt = /* @__PURE__ */ new Map();
|
|
337
|
+
for (const item of items.values()) byAt.set(item.at, [...byAt.get(item.at) ?? [], item]);
|
|
338
|
+
const out = /* @__PURE__ */ new Map();
|
|
339
|
+
for (const [at, landed] of byAt) {
|
|
340
|
+
const [item] = landed;
|
|
341
|
+
if (item === void 0) continue;
|
|
342
|
+
if (landed.length > 1 || item.conflict) {
|
|
343
|
+
const kept = landed.flatMap(({ three }) => [three[1], three[2]]).find(Boolean);
|
|
344
|
+
this.conflicts.add(at);
|
|
345
|
+
if (kept !== void 0) out.set(at, kept);
|
|
346
|
+
else this.fileless.add(at);
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
const marks = item.named === void 0 ? void 0 : {
|
|
350
|
+
...item.named,
|
|
351
|
+
longer: 0
|
|
352
|
+
};
|
|
353
|
+
const resolved = yield* this.file(at, item.three, marks);
|
|
354
|
+
if (!resolved.clean) this.conflicts.add(at);
|
|
355
|
+
if (resolved.entry !== void 0) out.set(at, resolved.entry);
|
|
356
|
+
else if (!resolved.clean) this.fileless.add(at);
|
|
357
|
+
}
|
|
358
|
+
return out;
|
|
359
|
+
});
|
|
361
360
|
/** Each side's file renames applied: the other side's source moved to the destination. */
|
|
362
|
-
renamed(items, renames) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
361
|
+
renamed = Effect.fnUntraced({ self: this }, function* (items, renames) {
|
|
362
|
+
const both = /* @__PURE__ */ new Set();
|
|
363
|
+
for (const side of [1, 2]) {
|
|
364
|
+
const other = otherOf(side);
|
|
365
|
+
for (const [source, destination] of renames[side]) {
|
|
366
|
+
const from = items.get(source);
|
|
367
|
+
const to = items.get(destination);
|
|
368
|
+
if (from === void 0 || to === void 0 || both.has(source)) continue;
|
|
369
|
+
const elsewhere = renames[other].get(source);
|
|
370
|
+
if (elsewhere === destination) {
|
|
371
|
+
both.add(source);
|
|
372
|
+
to.three[0] = from.three[0];
|
|
373
|
+
items.delete(source);
|
|
374
|
+
} else if (elsewhere !== void 0 && this.depth > 0) {
|
|
375
|
+
both.add(source);
|
|
376
|
+
const destinations = side === 1 ? {
|
|
377
|
+
1: destination,
|
|
378
|
+
2: elsewhere
|
|
379
|
+
} : {
|
|
380
|
+
1: elsewhere,
|
|
381
|
+
2: destination
|
|
382
|
+
};
|
|
383
|
+
yield* this.apart(items, source, destinations);
|
|
384
|
+
} else if (elsewhere !== void 0) {
|
|
385
|
+
both.add(source);
|
|
386
|
+
for (const key of [
|
|
387
|
+
source,
|
|
388
|
+
destination,
|
|
389
|
+
elsewhere
|
|
390
|
+
]) {
|
|
391
|
+
const item = items.get(key);
|
|
392
|
+
if (item !== void 0) item.conflict = true;
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
const [base] = from.three;
|
|
396
|
+
const kept = from.three[other];
|
|
397
|
+
const retyped = kept !== void 0 && base !== void 0 && kindOf(kept.mode) !== kindOf(base.mode);
|
|
398
|
+
const left = retyped ? void 0 : kept;
|
|
399
|
+
const moved = to.three[side];
|
|
400
|
+
const paired = side === 1 ? [
|
|
401
|
+
base,
|
|
402
|
+
moved,
|
|
403
|
+
left
|
|
404
|
+
] : [
|
|
405
|
+
base,
|
|
406
|
+
left,
|
|
407
|
+
moved
|
|
408
|
+
];
|
|
409
|
+
const added = to.three[other];
|
|
410
|
+
const asRenamed = same(added, moved);
|
|
411
|
+
const asBoth = asRenamed && side === 2;
|
|
412
|
+
const named = side === 1 ? {
|
|
413
|
+
ours: destination,
|
|
414
|
+
theirs: source
|
|
415
|
+
} : {
|
|
416
|
+
ours: source,
|
|
417
|
+
theirs: destination
|
|
418
|
+
};
|
|
419
|
+
const merged = added !== void 0 && left !== void 0 && !asBoth ? yield* this.file(source, paired, {
|
|
420
|
+
...named,
|
|
421
|
+
longer: 1
|
|
422
|
+
}) : void 0;
|
|
423
|
+
let taken;
|
|
424
|
+
if (merged?.marked !== void 0) {
|
|
425
|
+
if (asRenamed && merged.entry !== void 0) taken = {
|
|
426
|
+
...merged.entry,
|
|
427
|
+
oid: yield* this.write("blob", merged.marked)
|
|
384
428
|
};
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
if (item !== void 0) item.conflict = true;
|
|
395
|
-
}
|
|
396
|
-
} else {
|
|
397
|
-
const [base] = from.three;
|
|
398
|
-
const kept = from.three[other];
|
|
399
|
-
const retyped = kept !== void 0 && base !== void 0 && kindOf(kept.mode) !== kindOf(base.mode);
|
|
400
|
-
const left = retyped ? void 0 : kept;
|
|
401
|
-
const moved = to.three[side];
|
|
402
|
-
const paired = side === 1 ? [
|
|
429
|
+
} else if (merged !== void 0) {
|
|
430
|
+
if (same(added, merged.entry)) taken = added;
|
|
431
|
+
else if (asRenamed && merged.clean) taken = merged.entry;
|
|
432
|
+
}
|
|
433
|
+
const conflicted = left === void 0 || added !== void 0 && !asBoth && taken === void 0;
|
|
434
|
+
const own = merged?.clean === true ? merged.entry : void 0;
|
|
435
|
+
if (this.depth > 0 && conflicted) {
|
|
436
|
+
const renamedFile = own ?? moved;
|
|
437
|
+
if (added === void 0) to.three = [
|
|
403
438
|
base,
|
|
404
|
-
moved,
|
|
405
|
-
left
|
|
406
|
-
] : [
|
|
407
439
|
base,
|
|
408
|
-
|
|
409
|
-
moved
|
|
440
|
+
base
|
|
410
441
|
];
|
|
411
|
-
|
|
412
|
-
const asRenamed = same(added, moved);
|
|
413
|
-
const asBoth = asRenamed && side === 2;
|
|
414
|
-
const named = side === 1 ? {
|
|
415
|
-
ours: destination,
|
|
416
|
-
theirs: source
|
|
417
|
-
} : {
|
|
418
|
-
ours: source,
|
|
419
|
-
theirs: destination
|
|
420
|
-
};
|
|
421
|
-
const merged = added !== void 0 && left !== void 0 && !asBoth ? yield* this.file(source, paired, {
|
|
422
|
-
...named,
|
|
423
|
-
longer: 1
|
|
424
|
-
}) : void 0;
|
|
425
|
-
let taken;
|
|
426
|
-
if (merged?.marked !== void 0) {
|
|
427
|
-
if (asRenamed && merged.entry !== void 0) taken = {
|
|
428
|
-
...merged.entry,
|
|
429
|
-
oid: yield* this.write("blob", merged.marked)
|
|
430
|
-
};
|
|
431
|
-
} else if (merged !== void 0) {
|
|
432
|
-
if (same(added, merged.entry)) taken = added;
|
|
433
|
-
else if (asRenamed && merged.clean) taken = merged.entry;
|
|
434
|
-
}
|
|
435
|
-
const conflicted = left === void 0 || added !== void 0 && !asBoth && taken === void 0;
|
|
436
|
-
const own = merged?.clean === true ? merged.entry : void 0;
|
|
437
|
-
if (this.depth > 0 && conflicted) {
|
|
438
|
-
const renamedFile = own ?? moved;
|
|
439
|
-
if (added === void 0) to.three = [
|
|
440
|
-
base,
|
|
441
|
-
base,
|
|
442
|
-
base
|
|
443
|
-
];
|
|
444
|
-
else to.three = side === 1 ? [
|
|
445
|
-
void 0,
|
|
446
|
-
renamedFile,
|
|
447
|
-
added
|
|
448
|
-
] : [
|
|
449
|
-
void 0,
|
|
450
|
-
added,
|
|
451
|
-
renamedFile
|
|
452
|
-
];
|
|
453
|
-
} else {
|
|
454
|
-
if (conflicted) to.conflict = true;
|
|
455
|
-
to.three = added === void 0 ? paired : taken !== void 0 ? [
|
|
456
|
-
base,
|
|
457
|
-
taken,
|
|
458
|
-
taken
|
|
459
|
-
] : [
|
|
460
|
-
base,
|
|
461
|
-
to.three[1],
|
|
462
|
-
to.three[2]
|
|
463
|
-
];
|
|
464
|
-
if (added === void 0) to.named = named;
|
|
465
|
-
}
|
|
466
|
-
if (!retyped) items.delete(source);
|
|
467
|
-
else from.three = other === 1 ? [
|
|
442
|
+
else to.three = side === 1 ? [
|
|
468
443
|
void 0,
|
|
469
|
-
|
|
470
|
-
|
|
444
|
+
renamedFile,
|
|
445
|
+
added
|
|
471
446
|
] : [
|
|
472
447
|
void 0,
|
|
473
|
-
|
|
474
|
-
|
|
448
|
+
added,
|
|
449
|
+
renamedFile
|
|
475
450
|
];
|
|
451
|
+
} else {
|
|
452
|
+
if (conflicted) to.conflict = true;
|
|
453
|
+
to.three = added === void 0 ? paired : taken !== void 0 ? [
|
|
454
|
+
base,
|
|
455
|
+
taken,
|
|
456
|
+
taken
|
|
457
|
+
] : [
|
|
458
|
+
base,
|
|
459
|
+
to.three[1],
|
|
460
|
+
to.three[2]
|
|
461
|
+
];
|
|
462
|
+
if (added === void 0) to.named = named;
|
|
476
463
|
}
|
|
464
|
+
if (!retyped) items.delete(source);
|
|
465
|
+
else from.three = other === 1 ? [
|
|
466
|
+
void 0,
|
|
467
|
+
kept,
|
|
468
|
+
void 0
|
|
469
|
+
] : [
|
|
470
|
+
void 0,
|
|
471
|
+
void 0,
|
|
472
|
+
kept
|
|
473
|
+
];
|
|
477
474
|
}
|
|
478
475
|
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
476
|
+
}
|
|
477
|
+
});
|
|
481
478
|
/**
|
|
482
479
|
* A rename/rename inside a virtual base: the base's file merged with each side's renamed one, at
|
|
483
480
|
* both destinations, its markers naming them and one longer, and the source gone; a file the
|
|
484
481
|
* other side added at a destination merges two-way with it there. Measured against git 2.53.0;
|
|
485
482
|
* another file at the source isn't, and conflicts.
|
|
486
483
|
*/
|
|
487
|
-
apart(items, source, destinations) {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
],
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
});
|
|
531
|
-
}
|
|
484
|
+
apart = Effect.fnUntraced({ self: this }, function* (items, source, destinations) {
|
|
485
|
+
const from = items.get(source);
|
|
486
|
+
const one = items.get(destinations[1]);
|
|
487
|
+
const two = items.get(destinations[2]);
|
|
488
|
+
if (from === void 0 || one === void 0 || two === void 0) return;
|
|
489
|
+
const [base, oursThere, theirsThere] = from.three;
|
|
490
|
+
const [, ours, besideOurs] = one.three;
|
|
491
|
+
const [, besideTheirs, theirs] = two.three;
|
|
492
|
+
const alone = [
|
|
493
|
+
oursThere,
|
|
494
|
+
theirsThere,
|
|
495
|
+
one.three[0],
|
|
496
|
+
two.three[0]
|
|
497
|
+
];
|
|
498
|
+
const merged = base !== void 0 && ours !== void 0 && theirs !== void 0 && alone.every((entry) => entry === void 0) && kindOf(ours.mode) === kindOf(theirs.mode) ? yield* this.file(source, [
|
|
499
|
+
base,
|
|
500
|
+
ours,
|
|
501
|
+
theirs
|
|
502
|
+
], {
|
|
503
|
+
ours: destinations[1],
|
|
504
|
+
theirs: destinations[2],
|
|
505
|
+
longer: 1
|
|
506
|
+
}) : void 0;
|
|
507
|
+
if (merged?.clean !== true || merged.entry === void 0) {
|
|
508
|
+
for (const item of [
|
|
509
|
+
from,
|
|
510
|
+
one,
|
|
511
|
+
two
|
|
512
|
+
]) item.conflict = true;
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
one.three = [
|
|
516
|
+
void 0,
|
|
517
|
+
merged.entry,
|
|
518
|
+
besideOurs ?? merged.entry
|
|
519
|
+
];
|
|
520
|
+
two.three = [
|
|
521
|
+
void 0,
|
|
522
|
+
besideTheirs ?? merged.entry,
|
|
523
|
+
merged.entry
|
|
524
|
+
];
|
|
525
|
+
items.delete(source);
|
|
526
|
+
});
|
|
532
527
|
/**
|
|
533
528
|
* Each side's file renames whose destination is below a folder the other side renamed, moved
|
|
534
529
|
* there before they're paired, as Git's "file location" conflict moves them: the file lands at
|
|
@@ -538,94 +533,90 @@ var TreeMerge = class {
|
|
|
538
533
|
* whose new place is taken, in the way in its side's tree, or another of its side's renames' new
|
|
539
534
|
* place too, stays, and leaves no path placed.
|
|
540
535
|
*/
|
|
541
|
-
relocated(items, found, folders) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
to
|
|
559
|
-
});
|
|
560
|
-
movers.set(`${side} ${to}`, (movers.get(`${side} ${to}`) ?? 0) + 1);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
for (const { side, source, destination, to } of moves) {
|
|
564
|
-
const from = items.get(destination);
|
|
565
|
-
const file = from?.three[side];
|
|
566
|
-
if (from === void 0 || file === void 0) continue;
|
|
567
|
-
if ((movers.get(`${side} ${to}`) ?? 0) > 1) {
|
|
568
|
-
this.unplaced = true;
|
|
569
|
-
continue;
|
|
570
|
-
}
|
|
571
|
-
const empty = {
|
|
572
|
-
at: to,
|
|
573
|
-
three: [
|
|
574
|
-
void 0,
|
|
575
|
-
void 0,
|
|
576
|
-
void 0
|
|
577
|
-
],
|
|
578
|
-
newOn: void 0,
|
|
579
|
-
conflict: false
|
|
580
|
-
};
|
|
581
|
-
const target = items.get(to) ?? empty;
|
|
582
|
-
if (target.three[side] !== void 0 || (yield* this.entryAt(side, to)) !== void 0) {
|
|
583
|
-
this.unplaced = true;
|
|
584
|
-
continue;
|
|
585
|
-
}
|
|
586
|
-
from.three[side] = void 0;
|
|
587
|
-
if (from.three.every((entry) => entry === void 0)) items.delete(destination);
|
|
588
|
-
target.three[side] = file;
|
|
589
|
-
items.set(to, {
|
|
590
|
-
...target,
|
|
591
|
-
newOn: void 0,
|
|
592
|
-
conflict: true
|
|
536
|
+
relocated = Effect.fnUntraced({ self: this }, function* (items, found, folders) {
|
|
537
|
+
const renames = {
|
|
538
|
+
1: new Map(found[1]),
|
|
539
|
+
2: new Map(found[2])
|
|
540
|
+
};
|
|
541
|
+
const moves = [];
|
|
542
|
+
const movers = /* @__PURE__ */ new Map();
|
|
543
|
+
for (const side of [1, 2]) {
|
|
544
|
+
const other = otherOf(side);
|
|
545
|
+
for (const [source, destination] of found[side]) {
|
|
546
|
+
const to = movedBy(destination, folders[other], folders[side]);
|
|
547
|
+
if (to === void 0 || items.get(destination)?.three[side] === void 0) continue;
|
|
548
|
+
moves.push({
|
|
549
|
+
side,
|
|
550
|
+
source,
|
|
551
|
+
destination,
|
|
552
|
+
to
|
|
593
553
|
});
|
|
594
|
-
|
|
595
|
-
else renames[side].delete(source);
|
|
554
|
+
movers.set(`${side} ${to}`, (movers.get(`${side} ${to}`) ?? 0) + 1);
|
|
596
555
|
}
|
|
597
|
-
|
|
598
|
-
})
|
|
599
|
-
|
|
556
|
+
}
|
|
557
|
+
for (const { side, source, destination, to } of moves) {
|
|
558
|
+
const from = items.get(destination);
|
|
559
|
+
const file = from?.three[side];
|
|
560
|
+
if (from === void 0 || file === void 0) continue;
|
|
561
|
+
if ((movers.get(`${side} ${to}`) ?? 0) > 1) {
|
|
562
|
+
this.unplaced = true;
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
const empty = {
|
|
566
|
+
at: to,
|
|
567
|
+
three: [
|
|
568
|
+
void 0,
|
|
569
|
+
void 0,
|
|
570
|
+
void 0
|
|
571
|
+
],
|
|
572
|
+
newOn: void 0,
|
|
573
|
+
conflict: false
|
|
574
|
+
};
|
|
575
|
+
const target = items.get(to) ?? empty;
|
|
576
|
+
if (target.three[side] !== void 0 || (yield* this.entryAt(side, to)) !== void 0) {
|
|
577
|
+
this.unplaced = true;
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
from.three[side] = void 0;
|
|
581
|
+
if (from.three.every((entry) => entry === void 0)) items.delete(destination);
|
|
582
|
+
target.three[side] = file;
|
|
583
|
+
items.set(to, {
|
|
584
|
+
...target,
|
|
585
|
+
newOn: void 0,
|
|
586
|
+
conflict: true
|
|
587
|
+
});
|
|
588
|
+
if (to !== source || side === 2 && found[1].has(source)) renames[side].set(source, to);
|
|
589
|
+
else renames[side].delete(source);
|
|
590
|
+
}
|
|
591
|
+
return renames;
|
|
592
|
+
});
|
|
600
593
|
/**
|
|
601
594
|
* Each side's directory renames applied to the paths the other side added below them: moved,
|
|
602
595
|
* and conflicting where they land. Several moving to one path stay, and so does a folder split,
|
|
603
596
|
* or a path whose new place holds a file or a folder in the tree of the side that added it.
|
|
604
597
|
*/
|
|
605
|
-
moved(items, folders) {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
if (to !== void 0) landing.set(to, [...landing.get(to) ?? [], item]);
|
|
615
|
-
}
|
|
598
|
+
moved = Effect.fnUntraced({ self: this }, function* (items, folders) {
|
|
599
|
+
const landing = /* @__PURE__ */ new Map();
|
|
600
|
+
for (const side of [1, 2]) {
|
|
601
|
+
const mine = folders[side];
|
|
602
|
+
const theirs = folders[otherOf(side)];
|
|
603
|
+
if (mine.split) this.unplaced = true;
|
|
604
|
+
for (const item of items.values()) {
|
|
605
|
+
const to = item.newOn === otherOf(side) ? movedBy(item.at, mine, theirs) : void 0;
|
|
606
|
+
if (to !== void 0) landing.set(to, [...landing.get(to) ?? [], item]);
|
|
616
607
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
608
|
+
}
|
|
609
|
+
for (const [to, movers] of landing) {
|
|
610
|
+
const [item] = movers;
|
|
611
|
+
if (item === void 0) continue;
|
|
612
|
+
const inTheWay = item.newOn !== void 0 && (yield* this.entryAt(item.newOn, to)) !== void 0;
|
|
613
|
+
if (movers.length > 1 || inTheWay) this.unplaced = true;
|
|
614
|
+
else {
|
|
615
|
+
item.at = to;
|
|
616
|
+
item.conflict = true;
|
|
626
617
|
}
|
|
627
|
-
}
|
|
628
|
-
}
|
|
618
|
+
}
|
|
619
|
+
});
|
|
629
620
|
/**
|
|
630
621
|
* A path's files merged, a folder on a side read as no file. Inside a virtual base, what
|
|
631
622
|
* conflicts takes the base's file, or none, as Git's does: a modify/delete, or files of two
|
|
@@ -672,78 +663,74 @@ var TreeMerge = class {
|
|
|
672
663
|
* its markers, and a mode conflict takes ours's; a symlink or a gitlink both sides changed takes
|
|
673
664
|
* the base's entry, or none.
|
|
674
665
|
*/
|
|
675
|
-
content(at, base, ours, theirs, marks) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
clean: clean && modeClean
|
|
688
|
-
});
|
|
689
|
-
if (ours.oid === theirs.oid || ours.oid === base?.oid) return entry(theirs.oid, true);
|
|
690
|
-
if (theirs.oid === base?.oid) return entry(ours.oid, true);
|
|
691
|
-
if (kindOf(ours.mode) !== "100644") return inside ? {
|
|
692
|
-
entry: base,
|
|
693
|
-
clean: true
|
|
694
|
-
} : entry(ours.oid, false);
|
|
695
|
-
const attributes = yield* this.attributesOf(at);
|
|
696
|
-
const over = baseOf(base, ours);
|
|
697
|
-
const { merge } = attributes;
|
|
698
|
-
const driver = merge.state === "value" ? merge.value : merge.state;
|
|
699
|
-
const size = markerSizeOf(attributes) + 2 * this.depth + (marks?.longer ?? 0);
|
|
700
|
-
const labels = inside || marks !== void 0 ? this.labelsOf(size, marks, inside) : void 0;
|
|
701
|
-
const named = marks === void 0 ? "" : `\0${marks.ours}\0${marks.theirs}`;
|
|
702
|
-
const key = `${driver} ${size} ${over?.oid ?? ""} ${ours.oid} ${theirs.oid}${named}`;
|
|
703
|
-
const content = this.#contents.get(key) ?? (yield* this.merged(at, over, ours, theirs, attributes, labels));
|
|
704
|
-
this.#contents.set(key, content);
|
|
705
|
-
if (content.kind === "conflict" && inside) return entry(yield* this.write("blob", content.bytes), true);
|
|
706
|
-
if (content.kind === "conflict") {
|
|
707
|
-
const kept = entry(ours.oid, false);
|
|
708
|
-
return content.reason === "text" ? {
|
|
709
|
-
...kept,
|
|
710
|
-
marked: content.bytes
|
|
711
|
-
} : kept;
|
|
712
|
-
}
|
|
713
|
-
this.made.set(content.oid, {
|
|
714
|
-
type: "blob",
|
|
715
|
-
bytes: content.bytes
|
|
716
|
-
});
|
|
717
|
-
return entry(content.oid, true);
|
|
666
|
+
content = Effect.fnUntraced({ self: this }, function* (at, base, ours, theirs, marks) {
|
|
667
|
+
const inside = this.depth > 0;
|
|
668
|
+
const baseMode = base?.mode;
|
|
669
|
+
const modeClean = inside || ours.mode === theirs.mode || ours.mode === baseMode || theirs.mode === baseMode;
|
|
670
|
+
const mode = ours.mode === theirs.mode || ours.mode === baseMode ? theirs.mode : ours.mode;
|
|
671
|
+
const entry = (oid, clean) => ({
|
|
672
|
+
entry: {
|
|
673
|
+
mode,
|
|
674
|
+
name: ours.name,
|
|
675
|
+
oid
|
|
676
|
+
},
|
|
677
|
+
clean: clean && modeClean
|
|
718
678
|
});
|
|
719
|
-
|
|
679
|
+
if (ours.oid === theirs.oid || ours.oid === base?.oid) return entry(theirs.oid, true);
|
|
680
|
+
if (theirs.oid === base?.oid) return entry(ours.oid, true);
|
|
681
|
+
if (kindOf(ours.mode) !== "100644") return inside ? {
|
|
682
|
+
entry: base,
|
|
683
|
+
clean: true
|
|
684
|
+
} : entry(ours.oid, false);
|
|
685
|
+
const attributes = yield* this.attributesOf(at);
|
|
686
|
+
const over = baseOf(base, ours);
|
|
687
|
+
const { merge } = attributes;
|
|
688
|
+
const driver = merge.state === "value" ? merge.value : merge.state;
|
|
689
|
+
const size = markerSizeOf(attributes) + 2 * this.depth + (marks?.longer ?? 0);
|
|
690
|
+
const labels = inside || marks !== void 0 ? this.labelsOf(size, marks, inside) : void 0;
|
|
691
|
+
const named = marks === void 0 ? "" : `\0${marks.ours}\0${marks.theirs}`;
|
|
692
|
+
const key = `${driver} ${size} ${over?.oid ?? ""} ${ours.oid} ${theirs.oid}${named}`;
|
|
693
|
+
const content = this.#contents.get(key) ?? (yield* this.merged(at, over, ours, theirs, attributes, labels));
|
|
694
|
+
this.#contents.set(key, content);
|
|
695
|
+
if (content.kind === "conflict" && inside) return entry(yield* this.write("blob", content.bytes), true);
|
|
696
|
+
if (content.kind === "conflict") {
|
|
697
|
+
const kept = entry(ours.oid, false);
|
|
698
|
+
return content.reason === "text" ? {
|
|
699
|
+
...kept,
|
|
700
|
+
marked: content.bytes
|
|
701
|
+
} : kept;
|
|
702
|
+
}
|
|
703
|
+
this.made.set(content.oid, {
|
|
704
|
+
type: "blob",
|
|
705
|
+
bytes: content.bytes
|
|
706
|
+
});
|
|
707
|
+
return entry(content.oid, true);
|
|
708
|
+
});
|
|
720
709
|
/**
|
|
721
710
|
* The attributes a file both sides changed merges with: ours's, once neither side's give it what
|
|
722
711
|
* the engine doesn't run.
|
|
723
712
|
*/
|
|
724
|
-
attributesOf(at) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
});
|
|
746
|
-
}
|
|
713
|
+
attributesOf = Effect.fnUntraced({ self: this }, function* (at) {
|
|
714
|
+
const given = {
|
|
715
|
+
1: yield* this.attributesAt(at, 1),
|
|
716
|
+
2: yield* this.attributesAt(at, 2)
|
|
717
|
+
};
|
|
718
|
+
for (const side of [1, 2]) {
|
|
719
|
+
const refused = refusedAttribute(given[side]);
|
|
720
|
+
if (refused === void 0) continue;
|
|
721
|
+
const path = new TextDecoder().decode(bytesOf(at));
|
|
722
|
+
return yield* fail("FAILED_PRECONDITION", `${path} merges with ${refused} in ${side === 1 ? "ours" : "theirs"}'s .gitattributes, which the merge doesn't run`, {
|
|
723
|
+
context: {
|
|
724
|
+
reason: "unsupported-attribute",
|
|
725
|
+
attribute: refused,
|
|
726
|
+
paths: [path],
|
|
727
|
+
total: 1
|
|
728
|
+
},
|
|
729
|
+
hint: "Merge it with Git, where the driver or filter is configured"
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
return given[1];
|
|
733
|
+
});
|
|
747
734
|
/**
|
|
748
735
|
* How a rename scores the file at `key`, by the `diff` ours's `.gitattributes` give it, as Git
|
|
749
736
|
* 2.53.0's merge reads it with `--attr-source=<ours>`: set as text, unset, as `binary` unsets
|
|
@@ -754,41 +741,37 @@ var TreeMerge = class {
|
|
|
754
741
|
return Effect.map(this.attributesAt(key, 1), ({ diff }) => scoredByDiff[diff.state]);
|
|
755
742
|
}
|
|
756
743
|
/** `side`'s entry at `key`, a file or a folder, read down from its root. */
|
|
757
|
-
entryAt(side, key) {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
});
|
|
768
|
-
}
|
|
744
|
+
entryAt = Effect.fnUntraced({ self: this }, function* (side, key) {
|
|
745
|
+
const names = key.split("/");
|
|
746
|
+
let entries = this.roots[side];
|
|
747
|
+
for (const name of names.slice(0, -1)) {
|
|
748
|
+
const folder = entries.find((entry) => isFolder(entry) && keyOf(entry.name) === name);
|
|
749
|
+
if (folder === void 0) return void 0;
|
|
750
|
+
entries = yield* this.entries(folder);
|
|
751
|
+
}
|
|
752
|
+
return entries.find((entry) => keyOf(entry.name) === names.at(-1));
|
|
753
|
+
});
|
|
769
754
|
/**
|
|
770
755
|
* The attributes `side`'s `.gitattributes` give the file at `key`, from each folder above it:
|
|
771
756
|
* the outer merge's side's, inside a virtual base too, as Git reads its one attribute source.
|
|
772
757
|
*/
|
|
773
|
-
attributesAt(key, side) {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
});
|
|
791
|
-
}
|
|
758
|
+
attributesAt = Effect.fnUntraced({ self: this }, function* (key, side) {
|
|
759
|
+
const names = key.split("/");
|
|
760
|
+
const files = [];
|
|
761
|
+
let entries = this.attributeRoots[side];
|
|
762
|
+
for (let depth = 0; depth < names.length; depth += 1) {
|
|
763
|
+
const folder = names.slice(0, depth).join("/");
|
|
764
|
+
const found = entries.find((entry) => !isFolder(entry) && entry.mode !== "160000" && keyOf(entry.name) === ".gitattributes");
|
|
765
|
+
if (found !== void 0) files.push({
|
|
766
|
+
folder,
|
|
767
|
+
file: yield* this.attributesFile(found.oid)
|
|
768
|
+
});
|
|
769
|
+
const below = entries.find((entry) => isFolder(entry) && keyOf(entry.name) === names[depth]);
|
|
770
|
+
if (below === void 0 || depth === names.length - 1) break;
|
|
771
|
+
entries = yield* this.entries(below);
|
|
772
|
+
}
|
|
773
|
+
return pathAttributesOf(yield* attributesFor(files, key, this.checkpoint));
|
|
774
|
+
});
|
|
792
775
|
/** A `.gitattributes` blob, read once, and what reading it holds charged before it's read. */
|
|
793
776
|
attributesFile(oid) {
|
|
794
777
|
const read = this.#attributes.get(oid);
|
|
@@ -811,32 +794,30 @@ var TreeMerge = class {
|
|
|
811
794
|
};
|
|
812
795
|
}
|
|
813
796
|
/** Two files' content merged through xdiff over the base's, if it's a file of their kind. */
|
|
814
|
-
merged(at, base, ours, theirs, attributes, labels) {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
});
|
|
839
|
-
}
|
|
797
|
+
merged = Effect.fnUntraced({ self: this }, function* (at, base, ours, theirs, attributes, labels) {
|
|
798
|
+
const read = (oid) => Effect.mapError(this.reader.bytesOf(oid, "blob"), fromDiff("diff-limit"));
|
|
799
|
+
const sides = {
|
|
800
|
+
base: base === void 0 ? void 0 : yield* read(base.oid),
|
|
801
|
+
ours: yield* read(ours.oid),
|
|
802
|
+
theirs: yield* read(theirs.oid)
|
|
803
|
+
};
|
|
804
|
+
const merged = yield* Effect.flatMap(this.xdiff, (xdiff) => mergeContent(xdiff, sides, attributes, defaultContentConfig, labels)).pipe(Effect.catchIf((error) => error instanceof XdiffDefect, Effect.die));
|
|
805
|
+
if (merged.kind === "refused") {
|
|
806
|
+
const shown = new TextDecoder().decode(bytesOf(at));
|
|
807
|
+
return yield* Effect.fail(gitError("RESOURCE_EXHAUSTED", `${shown} is too large to merge: ${merged.why}`, { context: { reason: "too-large" } }));
|
|
808
|
+
}
|
|
809
|
+
if (merged.kind === "conflict") return {
|
|
810
|
+
kind: "conflict",
|
|
811
|
+
reason: merged.reason,
|
|
812
|
+
bytes: Uint8Array.from(merged.bytes)
|
|
813
|
+
};
|
|
814
|
+
const bytes = Uint8Array.from(merged.bytes);
|
|
815
|
+
return {
|
|
816
|
+
kind: "clean",
|
|
817
|
+
oid: yield* this.write("blob", bytes),
|
|
818
|
+
bytes
|
|
819
|
+
};
|
|
820
|
+
});
|
|
840
821
|
/** The merged root's entries, from the merged files and the entries taken whole. */
|
|
841
822
|
build(files) {
|
|
842
823
|
const root = {
|
|
@@ -862,81 +843,75 @@ var TreeMerge = class {
|
|
|
862
843
|
* a file a folder stays at a conflict, moved beside it inside a virtual base. A folder taken
|
|
863
844
|
* whole that more lands in is read.
|
|
864
845
|
*/
|
|
865
|
-
tree(prefix, node) {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
below: /* @__PURE__ */ new Map()
|
|
877
|
-
});
|
|
878
|
-
}
|
|
879
|
-
child.entry = void 0;
|
|
880
|
-
}
|
|
881
|
-
const below = child.below.size > 0 ? yield* this.tree(`${key}/`, child) : [];
|
|
882
|
-
if (below.length > 0) {
|
|
883
|
-
out.push({
|
|
884
|
-
mode: "040000",
|
|
885
|
-
name: bytes,
|
|
886
|
-
oid: yield* this.write("tree", treeBytes(below))
|
|
846
|
+
tree = Effect.fnUntraced({ self: this }, function* (prefix, node) {
|
|
847
|
+
const out = [];
|
|
848
|
+
for (const [name, child] of node.below) {
|
|
849
|
+
const key = prefix + name;
|
|
850
|
+
const bytes = bytesOf(name);
|
|
851
|
+
if (child.entry !== void 0 && isFolder(child.entry) && child.below.size > 0) {
|
|
852
|
+
for (const inside of yield* this.entries(child.entry)) {
|
|
853
|
+
const named = keyOf(inside.name);
|
|
854
|
+
if (!child.below.has(named)) child.below.set(named, {
|
|
855
|
+
entry: inside,
|
|
856
|
+
below: /* @__PURE__ */ new Map()
|
|
887
857
|
});
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
858
|
+
}
|
|
859
|
+
child.entry = void 0;
|
|
860
|
+
}
|
|
861
|
+
const below = child.below.size > 0 ? yield* this.tree(`${key}/`, child) : [];
|
|
862
|
+
if (below.length > 0) {
|
|
863
|
+
out.push({
|
|
864
|
+
mode: "040000",
|
|
894
865
|
name: bytes,
|
|
895
|
-
oid:
|
|
866
|
+
oid: yield* this.write("tree", treeBytes(below))
|
|
896
867
|
});
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
868
|
+
const beside = child.entry !== void 0 && this.depth > 0 ? yield* this.beside(key, name, node.below, child.entry) : void 0;
|
|
869
|
+
if (beside !== void 0) out.push(beside);
|
|
870
|
+
else if (child.entry !== void 0) this.conflicts.add(key);
|
|
871
|
+
else if (this.fileless.has(key)) this.conflicts.delete(key);
|
|
872
|
+
} else if (child.entry !== void 0) out.push({
|
|
873
|
+
mode: child.entry.mode,
|
|
874
|
+
name: bytes,
|
|
875
|
+
oid: child.entry.oid
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
return out;
|
|
879
|
+
});
|
|
901
880
|
/**
|
|
902
881
|
* Inside a virtual base, a file a folder stays at, moved beside it to `<name>~<label>`, the label
|
|
903
882
|
* of the side whose file it is, or `_0`, `_1` and on after it where a name is taken: in any of
|
|
904
883
|
* the three trees, the merge, or by a file moved before. Measured against git 2.53.0; a file
|
|
905
884
|
* both sides or neither have there isn't, and conflicts.
|
|
906
885
|
*/
|
|
907
|
-
beside(key, name, siblings, entry) {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
});
|
|
927
|
-
}
|
|
886
|
+
beside = Effect.fnUntraced({ self: this }, function* (key, name, siblings, entry) {
|
|
887
|
+
const sides = [];
|
|
888
|
+
for (const side of [1, 2]) {
|
|
889
|
+
const found = yield* this.entryAt(side, key);
|
|
890
|
+
if (found !== void 0 && !isFolder(found)) sides.push(side);
|
|
891
|
+
}
|
|
892
|
+
const [side] = sides;
|
|
893
|
+
if (side === void 0 || sides.length > 1) return void 0;
|
|
894
|
+
const prefix = key.slice(0, key.length - name.length);
|
|
895
|
+
const named = `${name}~${side === 1 ? this.labels.ours : this.labels.theirs}`;
|
|
896
|
+
let moved = named;
|
|
897
|
+
for (let at = 0; yield* this.taken(prefix, moved, siblings); at += 1) moved = `${named}_${at}`;
|
|
898
|
+
this.besides.add(prefix + moved);
|
|
899
|
+
return {
|
|
900
|
+
mode: entry.mode,
|
|
901
|
+
name: bytesOf(moved),
|
|
902
|
+
oid: entry.oid
|
|
903
|
+
};
|
|
904
|
+
});
|
|
928
905
|
/** Whether `name` in the folder at `prefix` is in any of the three trees, or the merge's. */
|
|
929
|
-
taken(prefix, name, siblings) {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
});
|
|
939
|
-
}
|
|
906
|
+
taken = Effect.fnUntraced({ self: this }, function* (prefix, name, siblings) {
|
|
907
|
+
if (siblings.has(name) || this.besides.has(prefix + name)) return true;
|
|
908
|
+
for (const slot of [
|
|
909
|
+
0,
|
|
910
|
+
1,
|
|
911
|
+
2
|
|
912
|
+
]) if ((yield* this.entryAt(slot, prefix + name)) !== void 0) return true;
|
|
913
|
+
return false;
|
|
914
|
+
});
|
|
940
915
|
};
|
|
941
916
|
/** The objects a merge made, each read as a stream of its bytes, as often as it's iterated. */
|
|
942
917
|
const writesOf = (made) => ({ async *[Symbol.asyncIterator]() {
|
|
@@ -957,16 +932,34 @@ const knownFirst = (known, read) => (oid) => {
|
|
|
957
932
|
bytes: streamOf(made.bytes)
|
|
958
933
|
});
|
|
959
934
|
};
|
|
960
|
-
/**
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
935
|
+
/**
|
|
936
|
+
* A conflict's paths, sorted as Git sorts them and named as text, beside their total. The list
|
|
937
|
+
* keeps the first `conflictPathsShown` within `conflictPathBytesMost` of their JSON: a path past
|
|
938
|
+
* the budget ends it, never cut.
|
|
939
|
+
*/
|
|
940
|
+
const conflictPaths = (conflicts) => {
|
|
941
|
+
const sorted = [...conflicts].sort((x, y) => compareEntries({
|
|
942
|
+
mode: "100644",
|
|
943
|
+
name: x
|
|
944
|
+
}, {
|
|
945
|
+
mode: "100644",
|
|
946
|
+
name: y
|
|
947
|
+
}));
|
|
948
|
+
const paths = [];
|
|
949
|
+
let bytes = 0;
|
|
950
|
+
for (const each of sorted.slice(0, 100)) {
|
|
951
|
+
const path = new TextDecoder().decode(each);
|
|
952
|
+
bytes += new TextEncoder().encode(JSON.stringify(path)).length;
|
|
953
|
+
if (bytes > 1048576) break;
|
|
954
|
+
paths.push(path);
|
|
955
|
+
}
|
|
956
|
+
return {
|
|
957
|
+
paths,
|
|
958
|
+
total: sorted.length
|
|
959
|
+
};
|
|
960
|
+
};
|
|
968
961
|
/** Three roots merged at `depth`: the merge, its conflicts kept, and its root's entries. */
|
|
969
|
-
const mergeAt = (call, roots, labels, depth, attributeRoots)
|
|
962
|
+
const mergeAt = /* @__PURE__ */ Effect.fnUntraced(function* (call, roots, labels, depth, attributeRoots) {
|
|
970
963
|
const merge = new TreeMerge(call, roots, labels, depth, attributeRoots);
|
|
971
964
|
yield* merge.folder("", roots, false);
|
|
972
965
|
const renaming = merge.renaming();
|
|
@@ -992,6 +985,10 @@ var VirtualCommits = class {
|
|
|
992
985
|
this.walked = walked;
|
|
993
986
|
}
|
|
994
987
|
commits = (oid) => this.walked.get(oid) ?? this.#made.get(oid);
|
|
988
|
+
/** How many merges the virtual base has made so far, at every depth. */
|
|
989
|
+
get made() {
|
|
990
|
+
return this.#made.size;
|
|
991
|
+
}
|
|
995
992
|
/** A merge of `one` and `two`, named apart from every object ID. */
|
|
996
993
|
merged(one, two) {
|
|
997
994
|
const generation = 1 + Math.max(this.commits(one)?.generation ?? 0, this.commits(two)?.generation ?? 0);
|
|
@@ -1010,7 +1007,7 @@ var VirtualCommits = class {
|
|
|
1010
1007
|
* tree, or a virtual base one deeper. A conflict Git's virtual base keeps no file for, which this
|
|
1011
1008
|
* doesn't build as Git does, refuses.
|
|
1012
1009
|
*/
|
|
1013
|
-
const virtualBase = (call, walk, bases, depth, attributeRoots)
|
|
1010
|
+
const virtualBase = /* @__PURE__ */ Effect.fnUntraced(function* (call, walk, bases, depth, attributeRoots) {
|
|
1014
1011
|
const [first, ...rest] = [...bases].reverse();
|
|
1015
1012
|
if (first === void 0) return [];
|
|
1016
1013
|
let merged = {
|
|
@@ -1020,19 +1017,24 @@ const virtualBase = (call, walk, bases, depth, attributeRoots) => Effect.gen(fun
|
|
|
1020
1017
|
for (const next of rest) {
|
|
1021
1018
|
const inner = yield* Effect.mapError(mergeBasesOf(walk.commits, merged.id, [next]), fromMissing);
|
|
1022
1019
|
const [only] = inner;
|
|
1020
|
+
const base = inner.length > 1 ? yield* virtualBase(call, walk, inner, depth + 1, attributeRoots) : only === void 0 ? [] : yield* rootOf(call, only);
|
|
1021
|
+
if (walk.made >= 64) return yield* fail("FAILED_PRECONDITION", `The merge bases' virtual base takes more than 64 merges, \`virtualBaseMergesMost\``, {
|
|
1022
|
+
context: { reason: "unsupported-virtual-base" },
|
|
1023
|
+
hint: "Merge it with Git, or name one of the merge bases as the base"
|
|
1024
|
+
});
|
|
1023
1025
|
const roots = [
|
|
1024
|
-
|
|
1026
|
+
base,
|
|
1025
1027
|
merged.root,
|
|
1026
1028
|
yield* rootOf(call, next)
|
|
1027
1029
|
];
|
|
1028
1030
|
const { merge, entries } = yield* mergeAt(call, roots, temporary, depth, attributeRoots);
|
|
1029
1031
|
if (merge.conflicts.size > 0 || merge.unplaced) {
|
|
1030
|
-
const paths =
|
|
1031
|
-
return yield* fail("FAILED_PRECONDITION", `The merge bases' virtual base conflicts in ${
|
|
1032
|
+
const { paths, total } = conflictPaths([...merge.conflicts].map(bytesOf));
|
|
1033
|
+
return yield* fail("FAILED_PRECONDITION", `The merge bases' virtual base conflicts in ${total} paths in a way the engine doesn't merge as Git does`, {
|
|
1032
1034
|
context: {
|
|
1033
1035
|
reason: "unsupported-virtual-base",
|
|
1034
|
-
paths
|
|
1035
|
-
total
|
|
1036
|
+
paths,
|
|
1037
|
+
total
|
|
1036
1038
|
},
|
|
1037
1039
|
hint: "Merge it with Git, or name one of the merge bases as the base"
|
|
1038
1040
|
});
|
|
@@ -1048,7 +1050,7 @@ const virtualBase = (call, walk, bases, depth, attributeRoots) => Effect.gen(fun
|
|
|
1048
1050
|
* The base the two commits merge over without one given: their merge base's root, or the
|
|
1049
1051
|
* virtual base of several. Unrelated histories, which Git refuses, fail.
|
|
1050
1052
|
*/
|
|
1051
|
-
const basesRoot =
|
|
1053
|
+
const basesRoot = /* @__PURE__ */ Effect.fnUntraced(function* (call, input, attributeRoots) {
|
|
1052
1054
|
const ours = yield* namedCommit(call.reader, input.ours);
|
|
1053
1055
|
const theirs = yield* namedCommit(call.reader, input.theirs);
|
|
1054
1056
|
const walk = new VirtualCommits(yield* ancestry(call.reader, [ours, theirs]));
|
|
@@ -1099,12 +1101,12 @@ const mergeTrees = (read, input, load, step) => Effect.scoped(Effect.gen(functio
|
|
|
1099
1101
|
};
|
|
1100
1102
|
const { merge, entries } = yield* mergeAt(call, roots, labels, 0, roots);
|
|
1101
1103
|
if (merge.conflicts.size > 0 || merge.unplaced) {
|
|
1102
|
-
const paths =
|
|
1103
|
-
return yield* fail("FAILED_PRECONDITION",
|
|
1104
|
+
const { paths, total } = conflictPaths([...merge.conflicts].map(bytesOf));
|
|
1105
|
+
return yield* fail("FAILED_PRECONDITION", total > 0 ? `The merge conflicts in ${total} paths` : "The merge conflicts where a directory rename can't place its files", {
|
|
1104
1106
|
context: {
|
|
1105
1107
|
reason: "merge-conflict",
|
|
1106
|
-
paths
|
|
1107
|
-
total
|
|
1108
|
+
paths,
|
|
1109
|
+
total
|
|
1108
1110
|
},
|
|
1109
1111
|
hint: "Resolve the conflicts, then merge the resolution"
|
|
1110
1112
|
});
|
|
@@ -1122,4 +1124,4 @@ const mergeTrees = (read, input, load, step) => Effect.scoped(Effect.gen(functio
|
|
|
1122
1124
|
});
|
|
1123
1125
|
return yield* timed(run, deadline);
|
|
1124
1126
|
}));
|
|
1125
|
-
export { mergeTrees };
|
|
1127
|
+
export { conflictPathBytesMost, conflictPaths, mergeTrees };
|