@statewalker/vcs-commands 0.5.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/README.md +123 -8
- package/dist/commands/add-command.d.ts +265 -34
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/add-interactive.d.ts +46 -0
- package/dist/commands/add-patch/add-interactive.d.ts.map +1 -0
- package/dist/commands/add-patch/add-patch.d.ts +139 -0
- package/dist/commands/add-patch/add-patch.d.ts.map +1 -0
- package/dist/commands/add-patch/index.d.ts +6 -0
- package/dist/commands/add-patch/index.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-backend.d.ts +80 -0
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-modes.d.ts +71 -0
- package/dist/commands/add-patch/patch-modes.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-session.d.ts +49 -0
- package/dist/commands/add-patch/patch-session.d.ts.map +1 -0
- package/dist/commands/am/am-command.d.ts +175 -0
- package/dist/commands/am/am-command.d.ts.map +1 -0
- package/dist/commands/am/index.d.ts +3 -0
- package/dist/commands/am/index.d.ts.map +1 -0
- package/dist/commands/am/mailinfo.d.ts +58 -0
- package/dist/commands/am/mailinfo.d.ts.map +1 -0
- package/dist/commands/am/patch-format.d.ts +24 -0
- package/dist/commands/am/patch-format.d.ts.map +1 -0
- package/dist/commands/apply/apply-command.d.ts +153 -0
- package/dist/commands/apply/apply-command.d.ts.map +1 -0
- package/dist/commands/apply/apply-engine.d.ts +195 -0
- package/dist/commands/apply/apply-engine.d.ts.map +1 -0
- package/dist/commands/apply/apply-parse.d.ts +86 -0
- package/dist/commands/apply/apply-parse.d.ts.map +1 -0
- package/dist/commands/apply/apply-types.d.ts +70 -0
- package/dist/commands/apply/apply-types.d.ts.map +1 -0
- package/dist/commands/apply/index.d.ts +6 -0
- package/dist/commands/apply/index.d.ts.map +1 -0
- package/dist/commands/apply/latin1.d.ts +32 -0
- package/dist/commands/apply/latin1.d.ts.map +1 -0
- package/dist/commands/apply/whitespace.d.ts +58 -0
- package/dist/commands/apply/whitespace.d.ts.map +1 -0
- package/dist/commands/attributes-source.d.ts +26 -0
- package/dist/commands/attributes-source.d.ts.map +1 -0
- package/dist/commands/backfill-command.d.ts +110 -0
- package/dist/commands/backfill-command.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-checkout.d.ts +64 -0
- package/dist/commands/bisect/bisect-checkout.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-command.d.ts +201 -0
- package/dist/commands/bisect/bisect-command.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-engine.d.ts +219 -0
- package/dist/commands/bisect/bisect-engine.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-graph.d.ts +127 -0
- package/dist/commands/bisect/bisect-graph.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-quote.d.ts +27 -0
- package/dist/commands/bisect/bisect-quote.d.ts.map +1 -0
- package/dist/commands/bisect/index.d.ts +5 -0
- package/dist/commands/bisect/index.d.ts.map +1 -0
- package/dist/commands/blame-command.d.ts +122 -131
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/branch-command.d.ts +52 -2
- package/dist/commands/branch-command.d.ts.map +1 -1
- package/dist/commands/branch-tracking.d.ts +98 -0
- package/dist/commands/branch-tracking.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts +300 -18
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-paths.d.ts +124 -0
- package/dist/commands/checkout-paths.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +50 -42
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +49 -16
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +117 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +311 -17
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/core-config.d.ts +78 -1
- package/dist/commands/core-config.d.ts.map +1 -1
- package/dist/commands/date-format.d.ts +58 -0
- package/dist/commands/date-format.d.ts.map +1 -0
- package/dist/commands/describe-command.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +377 -30
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/diff-textconv.d.ts +40 -0
- package/dist/commands/diff-textconv.d.ts.map +1 -0
- package/dist/commands/fetch-command.d.ts +149 -10
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/format-patch-command.d.ts +164 -0
- package/dist/commands/format-patch-command.d.ts.map +1 -0
- package/dist/commands/fsck/fetch-fsck.d.ts +60 -0
- package/dist/commands/fsck/fetch-fsck.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-command.d.ts +225 -0
- package/dist/commands/fsck/fsck-command.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-loose.d.ts +68 -0
- package/dist/commands/fsck/fsck-loose.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-msg-ids.d.ts +122 -0
- package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-object-checks.d.ts +148 -0
- package/dist/commands/fsck/fsck-object-checks.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-object-table.d.ts +132 -0
- package/dist/commands/fsck/fsck-object-table.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-pack.d.ts +115 -0
- package/dist/commands/fsck/fsck-pack.d.ts.map +1 -0
- package/dist/commands/fsck/index.d.ts +6 -0
- package/dist/commands/fsck/index.d.ts.map +1 -0
- package/dist/commands/fsck/verify-pack-command.d.ts +81 -0
- package/dist/commands/fsck/verify-pack-command.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +43 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-date.d.ts +66 -0
- package/dist/commands/git-date.d.ts.map +1 -0
- package/dist/commands/git-describe.d.ts +67 -0
- package/dist/commands/git-describe.d.ts.map +1 -0
- package/dist/commands/git-hooks.d.ts +416 -0
- package/dist/commands/git-hooks.d.ts.map +1 -0
- package/dist/commands/git-ident.d.ts +128 -0
- package/dist/commands/git-ident.d.ts.map +1 -0
- package/dist/commands/hook-command.d.ts +96 -0
- package/dist/commands/hook-command.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +231 -0
- package/dist/commands/index-adder.d.ts.map +1 -0
- package/dist/commands/index-host.d.ts +86 -0
- package/dist/commands/index-host.d.ts.map +1 -0
- package/dist/commands/index.d.ts +54 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -2
- package/dist/commands/init-command.d.ts +12 -1
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/local-clone.d.ts +60 -0
- package/dist/commands/local-clone.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts +117 -0
- package/dist/commands/local-transport.d.ts.map +1 -0
- package/dist/commands/log-command.d.ts +216 -24
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +120 -0
- package/dist/commands/log-graph.d.ts.map +1 -0
- package/dist/commands/log-output.d.ts +323 -0
- package/dist/commands/log-output.d.ts.map +1 -0
- package/dist/commands/ls-remote-command.d.ts +23 -7
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/mailmap.d.ts +31 -0
- package/dist/commands/mailmap.d.ts.map +1 -0
- package/dist/commands/merge-bases.d.ts +85 -0
- package/dist/commands/merge-bases.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +209 -74
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-config.d.ts +13 -0
- package/dist/commands/merge-config.d.ts.map +1 -0
- package/dist/commands/merge-drivers.d.ts +130 -0
- package/dist/commands/merge-drivers.d.ts.map +1 -0
- package/dist/commands/merge-support.d.ts +252 -0
- package/dist/commands/merge-support.d.ts.map +1 -0
- package/dist/commands/message-cleanup.d.ts +86 -0
- package/dist/commands/message-cleanup.d.ts.map +1 -0
- package/dist/commands/mv-command.d.ts +94 -0
- package/dist/commands/mv-command.d.ts.map +1 -0
- package/dist/commands/notes-command.d.ts +256 -0
- package/dist/commands/notes-command.d.ts.map +1 -0
- package/dist/commands/notes-commands.d.ts +41 -0
- package/dist/commands/notes-commands.d.ts.map +1 -0
- package/dist/commands/notes-merge-command.d.ts +105 -0
- package/dist/commands/notes-merge-command.d.ts.map +1 -0
- package/dist/commands/notes-support.d.ts +125 -0
- package/dist/commands/notes-support.d.ts.map +1 -0
- package/dist/commands/notes-tree.d.ts +106 -0
- package/dist/commands/notes-tree.d.ts.map +1 -0
- package/dist/commands/object-id-input.d.ts +20 -0
- package/dist/commands/object-id-input.d.ts.map +1 -0
- package/dist/commands/octopus-merge.d.ts +59 -0
- package/dist/commands/octopus-merge.d.ts.map +1 -0
- package/dist/commands/ort-merge.d.ts +126 -0
- package/dist/commands/ort-merge.d.ts.map +1 -0
- package/dist/commands/ort-recursive.d.ts +53 -0
- package/dist/commands/ort-recursive.d.ts.map +1 -0
- package/dist/commands/pack-refs-command.d.ts +20 -0
- package/dist/commands/pack-refs-command.d.ts.map +1 -1
- package/dist/commands/patch-id.d.ts +41 -0
- package/dist/commands/patch-id.d.ts.map +1 -0
- package/dist/commands/pathspec-attributes.d.ts +64 -0
- package/dist/commands/pathspec-attributes.d.ts.map +1 -0
- package/dist/commands/pathspec.d.ts +324 -0
- package/dist/commands/pathspec.d.ts.map +1 -0
- package/dist/commands/post-index-change.d.ts +33 -0
- package/dist/commands/post-index-change.d.ts.map +1 -0
- package/dist/commands/pretty-format.d.ts +222 -0
- package/dist/commands/pretty-format.d.ts.map +1 -0
- package/dist/commands/promisor-remote.d.ts +80 -0
- package/dist/commands/promisor-remote.d.ts.map +1 -0
- package/dist/commands/pull-command.d.ts +41 -8
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +24 -8
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/read-tree-command.d.ts +112 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -0
- package/dist/commands/rebase-command.d.ts +507 -75
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/rebase-todo.d.ts +130 -0
- package/dist/commands/rebase-todo.d.ts.map +1 -0
- package/dist/commands/ref-decoration-filter.d.ts +53 -0
- package/dist/commands/ref-decoration-filter.d.ts.map +1 -0
- package/dist/commands/reflog-messages.d.ts +98 -0
- package/dist/commands/reflog-messages.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +31 -0
- package/dist/commands/remote-command.d.ts.map +1 -1
- package/dist/commands/remote-transport.d.ts +120 -0
- package/dist/commands/remote-transport.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +161 -7
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +103 -0
- package/dist/commands/restore-command.d.ts.map +1 -0
- package/dist/commands/rev-list-command.d.ts +78 -0
- package/dist/commands/rev-list-command.d.ts.map +1 -0
- package/dist/commands/rev-parse-command.d.ts +80 -0
- package/dist/commands/rev-parse-command.d.ts.map +1 -0
- package/dist/commands/revert-command.d.ts +46 -38
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-filenames.d.ts +95 -0
- package/dist/commands/revision-filenames.d.ts.map +1 -0
- package/dist/commands/revision-range.d.ts +67 -0
- package/dist/commands/revision-range.d.ts.map +1 -0
- package/dist/commands/revision-resolver.d.ts +321 -0
- package/dist/commands/revision-resolver.d.ts.map +1 -0
- package/dist/commands/rm-command.d.ts +69 -7
- package/dist/commands/rm-command.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +191 -0
- package/dist/commands/sequencer-pick.d.ts.map +1 -0
- package/dist/commands/sequencer-support.d.ts +125 -0
- package/dist/commands/sequencer-support.d.ts.map +1 -0
- package/dist/commands/serve-repository.d.ts +52 -0
- package/dist/commands/serve-repository.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-command.d.ts +190 -0
- package/dist/commands/sparse-checkout-command.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-support.d.ts +268 -0
- package/dist/commands/sparse-checkout-support.d.ts.map +1 -0
- package/dist/commands/stash-apply-command.d.ts +42 -8
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-create-command.d.ts +155 -1
- package/dist/commands/stash-create-command.d.ts.map +1 -1
- package/dist/commands/stash-drop-command.d.ts +2 -0
- package/dist/commands/stash-drop-command.d.ts.map +1 -1
- package/dist/commands/stash-working-tree.d.ts +23 -0
- package/dist/commands/stash-working-tree.d.ts.map +1 -1
- package/dist/commands/status-command.d.ts +300 -15
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/status-format.d.ts +155 -0
- package/dist/commands/status-format.d.ts.map +1 -0
- package/dist/commands/status-header.d.ts +64 -0
- package/dist/commands/status-header.d.ts.map +1 -0
- package/dist/commands/strerror.d.ts +7 -0
- package/dist/commands/strerror.d.ts.map +1 -0
- package/dist/commands/submodule-config.d.ts +38 -0
- package/dist/commands/submodule-config.d.ts.map +1 -0
- package/dist/commands/submodule-summary-command.d.ts +80 -0
- package/dist/commands/submodule-summary-command.d.ts.map +1 -0
- package/dist/commands/submodule-summary.d.ts +150 -0
- package/dist/commands/submodule-summary.d.ts.map +1 -0
- package/dist/commands/switch-command.d.ts +132 -0
- package/dist/commands/switch-command.d.ts.map +1 -0
- package/dist/commands/tag-command.d.ts +23 -2
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/tracking-info.d.ts +64 -0
- package/dist/commands/tracking-info.d.ts.map +1 -0
- package/dist/commands/trailers.d.ts +73 -0
- package/dist/commands/trailers.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +85 -1
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/untracked-cache-support.d.ts +53 -0
- package/dist/commands/untracked-cache-support.d.ts.map +1 -0
- package/dist/commands/worktree-add-command.d.ts +108 -0
- package/dist/commands/worktree-add-command.d.ts.map +1 -0
- package/dist/commands/worktree-list-command.d.ts +69 -0
- package/dist/commands/worktree-list-command.d.ts.map +1 -0
- package/dist/commands/worktree-lock-command.d.ts +44 -0
- package/dist/commands/worktree-lock-command.d.ts.map +1 -0
- package/dist/commands/worktree-overwrite-checks.d.ts +146 -6
- package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
- package/dist/commands/worktree-prune-command.d.ts +48 -0
- package/dist/commands/worktree-prune-command.d.ts.map +1 -0
- package/dist/commands/worktree-remove-command.d.ts +59 -0
- package/dist/commands/worktree-remove-command.d.ts.map +1 -0
- package/dist/commands/worktree-repair-command.d.ts +35 -0
- package/dist/commands/worktree-repair-command.d.ts.map +1 -0
- package/dist/commands/worktree-support.d.ts +64 -0
- package/dist/commands/worktree-support.d.ts.map +1 -0
- package/dist/commands-DnmlfwGV.js +61620 -0
- package/dist/core-commands/add.command.impl.d.ts.map +1 -1
- package/dist/errors/add-errors.d.ts +55 -0
- package/dist/errors/add-errors.d.ts.map +1 -1
- package/dist/errors/checkout-errors.d.ts +16 -0
- package/dist/errors/checkout-errors.d.ts.map +1 -1
- package/dist/errors/command-errors.d.ts +77 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/commit-errors.d.ts +9 -0
- package/dist/errors/commit-errors.d.ts.map +1 -1
- package/dist/errors/git-api-error.d.ts +59 -2
- package/dist/errors/git-api-error.d.ts.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +354 -19
- package/dist/errors/rebase-errors.d.ts +9 -0
- package/dist/errors/rebase-errors.d.ts.map +1 -1
- package/dist/errors/ref-errors.d.ts +32 -0
- package/dist/errors/ref-errors.d.ts.map +1 -1
- package/dist/errors/transport-errors.d.ts +12 -2
- package/dist/errors/transport-errors.d.ts.map +1 -1
- package/dist/errors/worktree-errors.d.ts +35 -0
- package/dist/errors/worktree-errors.d.ts.map +1 -0
- package/dist/git-command-DxvwPrPB.js +7612 -0
- package/dist/git-command.d.ts +413 -32
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +306 -3
- package/dist/git.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/remote-config/remote-config-store.d.ts +105 -3
- package/dist/remote-config/remote-config-store.d.ts.map +1 -1
- package/dist/remote-config/remote-refs.d.ts +7 -3
- package/dist/remote-config/remote-refs.d.ts.map +1 -1
- package/dist/rename/detect-renames.d.ts +148 -0
- package/dist/rename/detect-renames.d.ts.map +1 -0
- package/dist/rename/git-similarity.d.ts +44 -0
- package/dist/rename/git-similarity.d.ts.map +1 -0
- package/dist/rename/index.d.ts +2 -0
- package/dist/rename/index.d.ts.map +1 -1
- package/dist/results/binary-patch.d.ts +11 -0
- package/dist/results/binary-patch.d.ts.map +1 -0
- package/dist/results/blame-format.d.ts +55 -0
- package/dist/results/blame-format.d.ts.map +1 -0
- package/dist/results/cherry-pick-result.d.ts +10 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -1
- package/dist/results/clone-result.d.ts +10 -0
- package/dist/results/clone-result.d.ts.map +1 -1
- package/dist/results/combined-diff.d.ts +77 -0
- package/dist/results/combined-diff.d.ts.map +1 -0
- package/dist/results/diff-entry.d.ts +32 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts +34 -60
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-order.d.ts +25 -0
- package/dist/results/diff-order.d.ts.map +1 -0
- package/dist/results/diff-output.d.ts +249 -0
- package/dist/results/diff-output.d.ts.map +1 -0
- package/dist/results/fetch-result.d.ts +15 -0
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.d.ts +5 -0
- package/dist/results/index.d.ts.map +1 -1
- package/dist/results/index.js +2 -252
- package/dist/results/merge-result.d.ts +15 -1
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/pull-result.d.ts +12 -3
- package/dist/results/pull-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +42 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/quote-path.d.ts +27 -0
- package/dist/results/quote-path.d.ts.map +1 -0
- package/dist/results/rebase-result.d.ts +28 -1
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/revert-result.d.ts +10 -0
- package/dist/results/revert-result.d.ts.map +1 -1
- package/dist/results/stash-result.d.ts +5 -0
- package/dist/results/stash-result.d.ts.map +1 -1
- package/dist/results/status-result.d.ts +60 -6
- package/dist/results/status-result.d.ts.map +1 -1
- package/dist/results-BZGa2Z3I.js +2934 -0
- package/dist/transport-command.d.ts +44 -1
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +15 -11
- package/src/commands/add-command.ts +1291 -226
- package/src/commands/add-patch/add-interactive.ts +941 -0
- package/src/commands/add-patch/add-patch.ts +1169 -0
- package/src/commands/add-patch/index.ts +5 -0
- package/src/commands/add-patch/patch-backend.ts +239 -0
- package/src/commands/add-patch/patch-modes.ts +249 -0
- package/src/commands/add-patch/patch-session.ts +159 -0
- package/src/commands/am/am-command.ts +1111 -0
- package/src/commands/am/index.ts +2 -0
- package/src/commands/am/mailinfo.ts +1015 -0
- package/src/commands/am/patch-format.ts +121 -0
- package/src/commands/apply/apply-command.ts +832 -0
- package/src/commands/apply/apply-engine.ts +1603 -0
- package/src/commands/apply/apply-parse.ts +1209 -0
- package/src/commands/apply/apply-types.ts +112 -0
- package/src/commands/apply/index.ts +5 -0
- package/src/commands/apply/latin1.ts +171 -0
- package/src/commands/apply/whitespace.ts +260 -0
- package/src/commands/attributes-source.ts +96 -0
- package/src/commands/backfill-command.ts +694 -0
- package/src/commands/bisect/bisect-checkout.ts +217 -0
- package/src/commands/bisect/bisect-command.ts +788 -0
- package/src/commands/bisect/bisect-engine.ts +1079 -0
- package/src/commands/bisect/bisect-graph.ts +595 -0
- package/src/commands/bisect/bisect-quote.ts +92 -0
- package/src/commands/bisect/index.ts +4 -0
- package/src/commands/blame-command.ts +711 -986
- package/src/commands/branch-command.ts +354 -32
- package/src/commands/branch-tracking.ts +331 -0
- package/src/commands/checkout-command.ts +1290 -243
- package/src/commands/checkout-paths.ts +784 -0
- package/src/commands/cherry-pick-command.ts +156 -396
- package/src/commands/clean-command.ts +504 -156
- package/src/commands/clone-command.ts +634 -67
- package/src/commands/commit-command.ts +1781 -166
- package/src/commands/core-config.ts +161 -6
- package/src/commands/date-format.ts +668 -0
- package/src/commands/describe-command.ts +2 -0
- package/src/commands/diff-command.ts +1898 -110
- package/src/commands/diff-textconv.ts +50 -0
- package/src/commands/fetch-command.ts +606 -66
- package/src/commands/format-patch-command.ts +969 -0
- package/src/commands/fsck/fetch-fsck.ts +229 -0
- package/src/commands/fsck/fsck-command.ts +3347 -0
- package/src/commands/fsck/fsck-loose.ts +287 -0
- package/src/commands/fsck/fsck-msg-ids.ts +176 -0
- package/src/commands/fsck/fsck-object-checks.ts +1044 -0
- package/src/commands/fsck/fsck-object-table.ts +363 -0
- package/src/commands/fsck/fsck-pack.ts +604 -0
- package/src/commands/fsck/index.ts +5 -0
- package/src/commands/fsck/verify-pack-command.ts +249 -0
- package/src/commands/gc-command.ts +147 -1
- package/src/commands/git-date.ts +895 -0
- package/src/commands/git-describe.ts +316 -0
- package/src/commands/git-hooks.ts +1472 -0
- package/src/commands/git-ident.ts +344 -0
- package/src/commands/hook-command.ts +247 -0
- package/src/commands/index-adder.ts +706 -0
- package/src/commands/index-host.ts +291 -0
- package/src/commands/index.ts +82 -0
- package/src/commands/init-command.ts +28 -4
- package/src/commands/local-clone.ts +183 -0
- package/src/commands/local-transport.ts +762 -0
- package/src/commands/log-command.ts +1915 -170
- package/src/commands/log-graph.ts +671 -0
- package/src/commands/log-output.ts +1359 -0
- package/src/commands/ls-remote-command.ts +101 -58
- package/src/commands/mailmap.ts +129 -0
- package/src/commands/merge-bases.ts +296 -0
- package/src/commands/merge-command.ts +1386 -491
- package/src/commands/merge-config.ts +25 -0
- package/src/commands/merge-drivers.ts +306 -0
- package/src/commands/merge-support.ts +1198 -0
- package/src/commands/message-cleanup.ts +275 -0
- package/src/commands/mv-command.ts +976 -0
- package/src/commands/notes-command.ts +890 -0
- package/src/commands/notes-commands.ts +87 -0
- package/src/commands/notes-merge-command.ts +768 -0
- package/src/commands/notes-support.ts +402 -0
- package/src/commands/notes-tree.ts +602 -0
- package/src/commands/object-id-input.ts +27 -0
- package/src/commands/octopus-merge.ts +377 -0
- package/src/commands/ort-merge.ts +1660 -0
- package/src/commands/ort-recursive.ts +160 -0
- package/src/commands/pack-refs-command.ts +39 -22
- package/src/commands/patch-id.ts +196 -0
- package/src/commands/pathspec-attributes.ts +162 -0
- package/src/commands/pathspec.ts +1199 -0
- package/src/commands/post-index-change.ts +62 -0
- package/src/commands/pretty-format.ts +1431 -0
- package/src/commands/promisor-remote.ts +298 -0
- package/src/commands/pull-command.ts +207 -22
- package/src/commands/push-command.ts +236 -23
- package/src/commands/read-tree-command.ts +857 -0
- package/src/commands/rebase-command.ts +3808 -371
- package/src/commands/rebase-todo.ts +584 -0
- package/src/commands/ref-decoration-filter.ts +118 -0
- package/src/commands/reflog-messages.ts +177 -0
- package/src/commands/remote-command.ts +93 -22
- package/src/commands/remote-transport.ts +383 -0
- package/src/commands/reset-command.ts +827 -103
- package/src/commands/restore-command.ts +350 -0
- package/src/commands/rev-list-command.ts +167 -0
- package/src/commands/rev-parse-command.ts +277 -0
- package/src/commands/revert-command.ts +152 -399
- package/src/commands/revision-filenames.ts +254 -0
- package/src/commands/revision-range.ts +222 -0
- package/src/commands/revision-resolver.ts +1379 -0
- package/src/commands/rm-command.ts +613 -67
- package/src/commands/sequencer-pick.ts +869 -0
- package/src/commands/sequencer-support.ts +869 -0
- package/src/commands/serve-repository.ts +125 -0
- package/src/commands/sparse-checkout-command.ts +1389 -0
- package/src/commands/sparse-checkout-support.ts +793 -0
- package/src/commands/stash-apply-command.ts +376 -343
- package/src/commands/stash-create-command.ts +625 -42
- package/src/commands/stash-drop-command.ts +15 -2
- package/src/commands/stash-working-tree.ts +168 -24
- package/src/commands/status-command.ts +1328 -105
- package/src/commands/status-format.ts +775 -0
- package/src/commands/status-header.ts +330 -0
- package/src/commands/strerror.ts +29 -0
- package/src/commands/submodule-config.ts +94 -0
- package/src/commands/submodule-summary-command.ts +334 -0
- package/src/commands/submodule-summary.ts +446 -0
- package/src/commands/switch-command.ts +402 -0
- package/src/commands/tag-command.ts +129 -41
- package/src/commands/tracking-info.ts +201 -0
- package/src/commands/trailers.ts +417 -0
- package/src/commands/tree-restore.ts +204 -4
- package/src/commands/untracked-cache-support.ts +194 -0
- package/src/commands/worktree-add-command.ts +458 -0
- package/src/commands/worktree-list-command.ts +208 -0
- package/src/commands/worktree-lock-command.ts +96 -0
- package/src/commands/worktree-overwrite-checks.ts +452 -26
- package/src/commands/worktree-prune-command.ts +99 -0
- package/src/commands/worktree-remove-command.ts +186 -0
- package/src/commands/worktree-repair-command.ts +59 -0
- package/src/commands/worktree-support.ts +214 -0
- package/src/core-commands/add.command.impl.ts +7 -1
- package/src/errors/add-errors.ts +45 -0
- package/src/errors/checkout-errors.ts +26 -2
- package/src/errors/command-errors.ts +101 -1
- package/src/errors/commit-errors.ts +18 -2
- package/src/errors/git-api-error.ts +82 -2
- package/src/errors/index.ts +1 -0
- package/src/errors/merge-errors.ts +2 -2
- package/src/errors/rebase-errors.ts +12 -0
- package/src/errors/ref-errors.ts +56 -2
- package/src/errors/remote-errors.ts +2 -2
- package/src/errors/stash-errors.ts +1 -1
- package/src/errors/transport-errors.ts +20 -4
- package/src/errors/worktree-errors.ts +49 -0
- package/src/git-command.ts +1177 -118
- package/src/git.ts +523 -10
- package/src/index.ts +1 -1
- package/src/remote-config/remote-config-store.ts +242 -8
- package/src/remote-config/remote-refs.ts +22 -6
- package/src/rename/detect-renames.ts +711 -0
- package/src/rename/git-similarity.ts +116 -0
- package/src/rename/index.ts +2 -0
- package/src/results/binary-patch.ts +401 -0
- package/src/results/blame-format.ts +239 -0
- package/src/results/cherry-pick-result.ts +10 -0
- package/src/results/clone-result.ts +12 -0
- package/src/results/combined-diff.ts +585 -0
- package/src/results/diff-entry.ts +35 -0
- package/src/results/diff-formatter.ts +152 -288
- package/src/results/diff-order.ts +64 -0
- package/src/results/diff-output.ts +1051 -0
- package/src/results/fetch-result.ts +15 -0
- package/src/results/index.ts +5 -0
- package/src/results/merge-result.ts +15 -1
- package/src/results/pull-result.ts +12 -3
- package/src/results/push-result.ts +43 -0
- package/src/results/quote-path.ts +103 -0
- package/src/results/rebase-result.ts +37 -0
- package/src/results/revert-result.ts +10 -0
- package/src/results/stash-result.ts +6 -0
- package/src/results/status-result.ts +123 -45
- package/src/transport-command.ts +121 -2
- package/dist/commands-CsLNyvZ1.js +0 -12587
- package/dist/status-result-BpyUK1Sg.js +0 -519
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git's similarity estimate of two files (`diffcore-delta.c` and `estimate_similarity` in
|
|
3
|
+
* `diffcore-rename.c`), the score `git status` and `git diff -M` report as `R<score>`.
|
|
4
|
+
*
|
|
5
|
+
* Each file is cut into spans (a line, or 64 bytes when a line is longer), each span hashed;
|
|
6
|
+
* the score is how many bytes of the destination's spans the source also has, against the
|
|
7
|
+
* larger file's size. Text files ignore the CR of a CRLF, as git does.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** git's full score (`MAX_SCORE`): 100%. */
|
|
11
|
+
export const GIT_MAX_SCORE = 60000;
|
|
12
|
+
|
|
13
|
+
/** git's default rename threshold (`DEFAULT_RENAME_SCORE`): 50%. */
|
|
14
|
+
export const GIT_DEFAULT_RENAME_SCORE = 30000;
|
|
15
|
+
|
|
16
|
+
const HASHBASE = 107927;
|
|
17
|
+
|
|
18
|
+
/** Whether the bytes are binary to git (`buffer_is_binary`: a NUL in the first 8000). */
|
|
19
|
+
export function isBinaryContent(content: Uint8Array): boolean {
|
|
20
|
+
const n = Math.min(content.length, 8000);
|
|
21
|
+
for (let i = 0; i < n; i++) if (content[i] === 0) return true;
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The span counts of a file (git's `hash_chars`): hash value to bytes, sorted by hash. */
|
|
26
|
+
export type SpanCounts = Array<[hash: number, count: number]>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Cuts the content into spans and counts the bytes of each span hash (`hash_chars`). A last
|
|
30
|
+
* span without a newline (shorter than 64 bytes) counts, as in current git (2.5x); git
|
|
31
|
+
* 2.43 and older left it out (`countLastSpan: false`).
|
|
32
|
+
*/
|
|
33
|
+
export function spanCounts(
|
|
34
|
+
content: Uint8Array,
|
|
35
|
+
options: { countLastSpan?: boolean } = {},
|
|
36
|
+
): SpanCounts {
|
|
37
|
+
const isText = !isBinaryContent(content);
|
|
38
|
+
const counts = new Map<number, number>();
|
|
39
|
+
const add = (accum1: number, accum2: number, n: number) => {
|
|
40
|
+
const hash = ((accum1 + Math.imul(accum2, 0x61)) >>> 0) % HASHBASE;
|
|
41
|
+
counts.set(hash, (counts.get(hash) ?? 0) + n);
|
|
42
|
+
};
|
|
43
|
+
let n = 0;
|
|
44
|
+
let accum1 = 0;
|
|
45
|
+
let accum2 = 0;
|
|
46
|
+
const size = content.length;
|
|
47
|
+
for (let i = 0; i < size; i++) {
|
|
48
|
+
const c = content[i];
|
|
49
|
+
// the CR of a CRLF does not count in a text file
|
|
50
|
+
if (isText && c === 0x0d && i + 1 < size && content[i + 1] === 0x0a) continue;
|
|
51
|
+
const old1 = accum1;
|
|
52
|
+
accum1 = ((accum1 << 7) ^ (accum2 >>> 25)) >>> 0;
|
|
53
|
+
accum2 = ((accum2 << 7) ^ (old1 >>> 25)) >>> 0;
|
|
54
|
+
accum1 = (accum1 + c) >>> 0;
|
|
55
|
+
if (++n < 64 && c !== 0x0a) continue;
|
|
56
|
+
add(accum1, accum2, n);
|
|
57
|
+
n = 0;
|
|
58
|
+
accum1 = 0;
|
|
59
|
+
accum2 = 0;
|
|
60
|
+
}
|
|
61
|
+
if (n > 0 && options.countLastSpan !== false) add(accum1, accum2, n);
|
|
62
|
+
return [...counts.entries()].sort((a, b) => a[0] - b[0]);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The bytes of `dst` the source has (`diffcore_count_changes`: `src_copied`), from the
|
|
67
|
+
* span counts of both.
|
|
68
|
+
*/
|
|
69
|
+
export function copiedBytes(src: SpanCounts, dst: SpanCounts): number {
|
|
70
|
+
let copied = 0;
|
|
71
|
+
let d = 0;
|
|
72
|
+
for (const [hash, srcCount] of src) {
|
|
73
|
+
while (d < dst.length && dst[d][0] < hash) d++;
|
|
74
|
+
let dstCount = 0;
|
|
75
|
+
if (d < dst.length && dst[d][0] === hash) {
|
|
76
|
+
dstCount = dst[d][1];
|
|
77
|
+
d++;
|
|
78
|
+
}
|
|
79
|
+
copied += Math.min(srcCount, dstCount);
|
|
80
|
+
}
|
|
81
|
+
return copied;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** One side of a similarity estimate: its mode, size and (lazily) its span counts. */
|
|
85
|
+
export interface SimilaritySide {
|
|
86
|
+
mode: number;
|
|
87
|
+
size: number;
|
|
88
|
+
spans(): Promise<SpanCounts>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const isRegular = (mode: number) => (mode & 0o170000) === 0o100000;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* git's `estimate_similarity`: 0..{@link GIT_MAX_SCORE}. Only regular files are compared
|
|
95
|
+
* (links and submodules are renamed only when exact); a size change too large for
|
|
96
|
+
* `minimumScore` scores 0 without reading either file.
|
|
97
|
+
*/
|
|
98
|
+
export async function estimateSimilarity(
|
|
99
|
+
src: SimilaritySide,
|
|
100
|
+
dst: SimilaritySide,
|
|
101
|
+
minimumScore: number = GIT_DEFAULT_RENAME_SCORE,
|
|
102
|
+
): Promise<number> {
|
|
103
|
+
if (!isRegular(src.mode) || !isRegular(dst.mode)) return 0;
|
|
104
|
+
const maxSize = Math.max(src.size, dst.size);
|
|
105
|
+
const baseSize = Math.min(src.size, dst.size);
|
|
106
|
+
const deltaSize = maxSize - baseSize;
|
|
107
|
+
if (maxSize * (GIT_MAX_SCORE - minimumScore) < deltaSize * GIT_MAX_SCORE) return 0;
|
|
108
|
+
if (!dst.size) return 0;
|
|
109
|
+
const copied = copiedBytes(await src.spans(), await dst.spans());
|
|
110
|
+
return Math.floor((copied * GIT_MAX_SCORE) / maxSize);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The percentage git prints for a score (`R87`). */
|
|
114
|
+
export function scorePercent(score: number): number {
|
|
115
|
+
return Math.floor((score * 100) / GIT_MAX_SCORE);
|
|
116
|
+
}
|
package/src/rename/index.ts
CHANGED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git's binary patch body (diff.c's `emit_binary_diff`): the postimage deflated (zlib
|
|
3
|
+
* level 1, git's default `core.compression` for loose data) or a deflated delta of it
|
|
4
|
+
* against the preimage (diff-delta.c, ported with its Rabin fingerprint tables so the
|
|
5
|
+
* deltas are git's bytes), whichever is smaller, in base85 lines of up to 52 bytes.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { compressBlockPako } from "@statewalker/vcs-utils";
|
|
9
|
+
|
|
10
|
+
const HASH_LIMIT = 64;
|
|
11
|
+
const RABIN_SHIFT = 23;
|
|
12
|
+
const RABIN_WINDOW = 16;
|
|
13
|
+
const MAX_OP_SIZE = 5 + 5 + 1 + RABIN_WINDOW + 7;
|
|
14
|
+
|
|
15
|
+
// biome-ignore format: git's table
|
|
16
|
+
const T = new Uint32Array([
|
|
17
|
+
0x00000000, 0xab59b4d1, 0x56b369a2, 0xfdeadd73, 0x063f6795, 0xad66d344,
|
|
18
|
+
0x508c0e37, 0xfbd5bae6, 0x0c7ecf2a, 0xa7277bfb, 0x5acda688, 0xf1941259,
|
|
19
|
+
0x0a41a8bf, 0xa1181c6e, 0x5cf2c11d, 0xf7ab75cc, 0x18fd9e54, 0xb3a42a85,
|
|
20
|
+
0x4e4ef7f6, 0xe5174327, 0x1ec2f9c1, 0xb59b4d10, 0x48719063, 0xe32824b2,
|
|
21
|
+
0x1483517e, 0xbfdae5af, 0x423038dc, 0xe9698c0d, 0x12bc36eb, 0xb9e5823a,
|
|
22
|
+
0x440f5f49, 0xef56eb98, 0x31fb3ca8, 0x9aa28879, 0x6748550a, 0xcc11e1db,
|
|
23
|
+
0x37c45b3d, 0x9c9defec, 0x6177329f, 0xca2e864e, 0x3d85f382, 0x96dc4753,
|
|
24
|
+
0x6b369a20, 0xc06f2ef1, 0x3bba9417, 0x90e320c6, 0x6d09fdb5, 0xc6504964,
|
|
25
|
+
0x2906a2fc, 0x825f162d, 0x7fb5cb5e, 0xd4ec7f8f, 0x2f39c569, 0x846071b8,
|
|
26
|
+
0x798aaccb, 0xd2d3181a, 0x25786dd6, 0x8e21d907, 0x73cb0474, 0xd892b0a5,
|
|
27
|
+
0x23470a43, 0x881ebe92, 0x75f463e1, 0xdeadd730, 0x63f67950, 0xc8afcd81,
|
|
28
|
+
0x354510f2, 0x9e1ca423, 0x65c91ec5, 0xce90aa14, 0x337a7767, 0x9823c3b6,
|
|
29
|
+
0x6f88b67a, 0xc4d102ab, 0x393bdfd8, 0x92626b09, 0x69b7d1ef, 0xc2ee653e,
|
|
30
|
+
0x3f04b84d, 0x945d0c9c, 0x7b0be704, 0xd05253d5, 0x2db88ea6, 0x86e13a77,
|
|
31
|
+
0x7d348091, 0xd66d3440, 0x2b87e933, 0x80de5de2, 0x7775282e, 0xdc2c9cff,
|
|
32
|
+
0x21c6418c, 0x8a9ff55d, 0x714a4fbb, 0xda13fb6a, 0x27f92619, 0x8ca092c8,
|
|
33
|
+
0x520d45f8, 0xf954f129, 0x04be2c5a, 0xafe7988b, 0x5432226d, 0xff6b96bc,
|
|
34
|
+
0x02814bcf, 0xa9d8ff1e, 0x5e738ad2, 0xf52a3e03, 0x08c0e370, 0xa39957a1,
|
|
35
|
+
0x584ced47, 0xf3155996, 0x0eff84e5, 0xa5a63034, 0x4af0dbac, 0xe1a96f7d,
|
|
36
|
+
0x1c43b20e, 0xb71a06df, 0x4ccfbc39, 0xe79608e8, 0x1a7cd59b, 0xb125614a,
|
|
37
|
+
0x468e1486, 0xedd7a057, 0x103d7d24, 0xbb64c9f5, 0x40b17313, 0xebe8c7c2,
|
|
38
|
+
0x16021ab1, 0xbd5bae60, 0x6cb54671, 0xc7ecf2a0, 0x3a062fd3, 0x915f9b02,
|
|
39
|
+
0x6a8a21e4, 0xc1d39535, 0x3c394846, 0x9760fc97, 0x60cb895b, 0xcb923d8a,
|
|
40
|
+
0x3678e0f9, 0x9d215428, 0x66f4eece, 0xcdad5a1f, 0x3047876c, 0x9b1e33bd,
|
|
41
|
+
0x7448d825, 0xdf116cf4, 0x22fbb187, 0x89a20556, 0x7277bfb0, 0xd92e0b61,
|
|
42
|
+
0x24c4d612, 0x8f9d62c3, 0x7836170f, 0xd36fa3de, 0x2e857ead, 0x85dcca7c,
|
|
43
|
+
0x7e09709a, 0xd550c44b, 0x28ba1938, 0x83e3ade9, 0x5d4e7ad9, 0xf617ce08,
|
|
44
|
+
0x0bfd137b, 0xa0a4a7aa, 0x5b711d4c, 0xf028a99d, 0x0dc274ee, 0xa69bc03f,
|
|
45
|
+
0x5130b5f3, 0xfa690122, 0x0783dc51, 0xacda6880, 0x570fd266, 0xfc5666b7,
|
|
46
|
+
0x01bcbbc4, 0xaae50f15, 0x45b3e48d, 0xeeea505c, 0x13008d2f, 0xb85939fe,
|
|
47
|
+
0x438c8318, 0xe8d537c9, 0x153feaba, 0xbe665e6b, 0x49cd2ba7, 0xe2949f76,
|
|
48
|
+
0x1f7e4205, 0xb427f6d4, 0x4ff24c32, 0xe4abf8e3, 0x19412590, 0xb2189141,
|
|
49
|
+
0x0f433f21, 0xa41a8bf0, 0x59f05683, 0xf2a9e252, 0x097c58b4, 0xa225ec65,
|
|
50
|
+
0x5fcf3116, 0xf49685c7, 0x033df00b, 0xa86444da, 0x558e99a9, 0xfed72d78,
|
|
51
|
+
0x0502979e, 0xae5b234f, 0x53b1fe3c, 0xf8e84aed, 0x17bea175, 0xbce715a4,
|
|
52
|
+
0x410dc8d7, 0xea547c06, 0x1181c6e0, 0xbad87231, 0x4732af42, 0xec6b1b93,
|
|
53
|
+
0x1bc06e5f, 0xb099da8e, 0x4d7307fd, 0xe62ab32c, 0x1dff09ca, 0xb6a6bd1b,
|
|
54
|
+
0x4b4c6068, 0xe015d4b9, 0x3eb80389, 0x95e1b758, 0x680b6a2b, 0xc352defa,
|
|
55
|
+
0x3887641c, 0x93ded0cd, 0x6e340dbe, 0xc56db96f, 0x32c6cca3, 0x999f7872,
|
|
56
|
+
0x6475a501, 0xcf2c11d0, 0x34f9ab36, 0x9fa01fe7, 0x624ac294, 0xc9137645,
|
|
57
|
+
0x26459ddd, 0x8d1c290c, 0x70f6f47f, 0xdbaf40ae, 0x207afa48, 0x8b234e99,
|
|
58
|
+
0x76c993ea, 0xdd90273b, 0x2a3b52f7, 0x8162e626, 0x7c883b55, 0xd7d18f84,
|
|
59
|
+
0x2c043562, 0x875d81b3, 0x7ab75cc0, 0xd1eee811,
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
// biome-ignore format: git's table
|
|
63
|
+
const U = new Uint32Array([
|
|
64
|
+
0x00000000, 0x7eb5200d, 0x5633f4cb, 0x2886d4c6, 0x073e5d47, 0x798b7d4a,
|
|
65
|
+
0x510da98c, 0x2fb88981, 0x0e7cba8e, 0x70c99a83, 0x584f4e45, 0x26fa6e48,
|
|
66
|
+
0x0942e7c9, 0x77f7c7c4, 0x5f711302, 0x21c4330f, 0x1cf9751c, 0x624c5511,
|
|
67
|
+
0x4aca81d7, 0x347fa1da, 0x1bc7285b, 0x65720856, 0x4df4dc90, 0x3341fc9d,
|
|
68
|
+
0x1285cf92, 0x6c30ef9f, 0x44b63b59, 0x3a031b54, 0x15bb92d5, 0x6b0eb2d8,
|
|
69
|
+
0x4388661e, 0x3d3d4613, 0x39f2ea38, 0x4747ca35, 0x6fc11ef3, 0x11743efe,
|
|
70
|
+
0x3eccb77f, 0x40799772, 0x68ff43b4, 0x164a63b9, 0x378e50b6, 0x493b70bb,
|
|
71
|
+
0x61bda47d, 0x1f088470, 0x30b00df1, 0x4e052dfc, 0x6683f93a, 0x1836d937,
|
|
72
|
+
0x250b9f24, 0x5bbebf29, 0x73386bef, 0x0d8d4be2, 0x2235c263, 0x5c80e26e,
|
|
73
|
+
0x740636a8, 0x0ab316a5, 0x2b7725aa, 0x55c205a7, 0x7d44d161, 0x03f1f16c,
|
|
74
|
+
0x2c4978ed, 0x52fc58e0, 0x7a7a8c26, 0x04cfac2b, 0x73e5d470, 0x0d50f47d,
|
|
75
|
+
0x25d620bb, 0x5b6300b6, 0x74db8937, 0x0a6ea93a, 0x22e87dfc, 0x5c5d5df1,
|
|
76
|
+
0x7d996efe, 0x032c4ef3, 0x2baa9a35, 0x551fba38, 0x7aa733b9, 0x041213b4,
|
|
77
|
+
0x2c94c772, 0x5221e77f, 0x6f1ca16c, 0x11a98161, 0x392f55a7, 0x479a75aa,
|
|
78
|
+
0x6822fc2b, 0x1697dc26, 0x3e1108e0, 0x40a428ed, 0x61601be2, 0x1fd53bef,
|
|
79
|
+
0x3753ef29, 0x49e6cf24, 0x665e46a5, 0x18eb66a8, 0x306db26e, 0x4ed89263,
|
|
80
|
+
0x4a173e48, 0x34a21e45, 0x1c24ca83, 0x6291ea8e, 0x4d29630f, 0x339c4302,
|
|
81
|
+
0x1b1a97c4, 0x65afb7c9, 0x446b84c6, 0x3adea4cb, 0x1258700d, 0x6ced5000,
|
|
82
|
+
0x4355d981, 0x3de0f98c, 0x15662d4a, 0x6bd30d47, 0x56ee4b54, 0x285b6b59,
|
|
83
|
+
0x00ddbf9f, 0x7e689f92, 0x51d01613, 0x2f65361e, 0x07e3e2d8, 0x7956c2d5,
|
|
84
|
+
0x5892f1da, 0x2627d1d7, 0x0ea10511, 0x7014251c, 0x5facac9d, 0x21198c90,
|
|
85
|
+
0x099f5856, 0x772a785b, 0x4c921c31, 0x32273c3c, 0x1aa1e8fa, 0x6414c8f7,
|
|
86
|
+
0x4bac4176, 0x3519617b, 0x1d9fb5bd, 0x632a95b0, 0x42eea6bf, 0x3c5b86b2,
|
|
87
|
+
0x14dd5274, 0x6a687279, 0x45d0fbf8, 0x3b65dbf5, 0x13e30f33, 0x6d562f3e,
|
|
88
|
+
0x506b692d, 0x2ede4920, 0x06589de6, 0x78edbdeb, 0x5755346a, 0x29e01467,
|
|
89
|
+
0x0166c0a1, 0x7fd3e0ac, 0x5e17d3a3, 0x20a2f3ae, 0x08242768, 0x76910765,
|
|
90
|
+
0x59298ee4, 0x279caee9, 0x0f1a7a2f, 0x71af5a22, 0x7560f609, 0x0bd5d604,
|
|
91
|
+
0x235302c2, 0x5de622cf, 0x725eab4e, 0x0ceb8b43, 0x246d5f85, 0x5ad87f88,
|
|
92
|
+
0x7b1c4c87, 0x05a96c8a, 0x2d2fb84c, 0x539a9841, 0x7c2211c0, 0x029731cd,
|
|
93
|
+
0x2a11e50b, 0x54a4c506, 0x69998315, 0x172ca318, 0x3faa77de, 0x411f57d3,
|
|
94
|
+
0x6ea7de52, 0x1012fe5f, 0x38942a99, 0x46210a94, 0x67e5399b, 0x19501996,
|
|
95
|
+
0x31d6cd50, 0x4f63ed5d, 0x60db64dc, 0x1e6e44d1, 0x36e89017, 0x485db01a,
|
|
96
|
+
0x3f77c841, 0x41c2e84c, 0x69443c8a, 0x17f11c87, 0x38499506, 0x46fcb50b,
|
|
97
|
+
0x6e7a61cd, 0x10cf41c0, 0x310b72cf, 0x4fbe52c2, 0x67388604, 0x198da609,
|
|
98
|
+
0x36352f88, 0x48800f85, 0x6006db43, 0x1eb3fb4e, 0x238ebd5d, 0x5d3b9d50,
|
|
99
|
+
0x75bd4996, 0x0b08699b, 0x24b0e01a, 0x5a05c017, 0x728314d1, 0x0c3634dc,
|
|
100
|
+
0x2df207d3, 0x534727de, 0x7bc1f318, 0x0574d315, 0x2acc5a94, 0x54797a99,
|
|
101
|
+
0x7cffae5f, 0x024a8e52, 0x06852279, 0x78300274, 0x50b6d6b2, 0x2e03f6bf,
|
|
102
|
+
0x01bb7f3e, 0x7f0e5f33, 0x57888bf5, 0x293dabf8, 0x08f998f7, 0x764cb8fa,
|
|
103
|
+
0x5eca6c3c, 0x207f4c31, 0x0fc7c5b0, 0x7172e5bd, 0x59f4317b, 0x27411176,
|
|
104
|
+
0x1a7c5765, 0x64c97768, 0x4c4fa3ae, 0x32fa83a3, 0x1d420a22, 0x63f72a2f,
|
|
105
|
+
0x4b71fee9, 0x35c4dee4, 0x1400edeb, 0x6ab5cde6, 0x42331920, 0x3c86392d,
|
|
106
|
+
0x133eb0ac, 0x6d8b90a1, 0x450d4467, 0x3bb8646a,
|
|
107
|
+
]);
|
|
108
|
+
|
|
109
|
+
interface DeltaIndex {
|
|
110
|
+
src: Uint8Array;
|
|
111
|
+
mask: number;
|
|
112
|
+
/** bucket b holds entries [start[b], start[b + 1]) */
|
|
113
|
+
start: Int32Array;
|
|
114
|
+
ptr: Int32Array;
|
|
115
|
+
val: Uint32Array;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** `create_delta_index`. */
|
|
119
|
+
function createDeltaIndex(buf: Uint8Array): DeltaIndex | undefined {
|
|
120
|
+
const bufsize = buf.length;
|
|
121
|
+
if (!bufsize) return undefined;
|
|
122
|
+
let entries = Math.floor((bufsize - 1) / RABIN_WINDOW);
|
|
123
|
+
let hsize = Math.floor(entries / 4);
|
|
124
|
+
let i = 4;
|
|
125
|
+
while (2 ** i < hsize) i++;
|
|
126
|
+
hsize = 2 ** i;
|
|
127
|
+
const hmask = hsize - 1;
|
|
128
|
+
// unpacked entries: linked lists per bucket, newest first
|
|
129
|
+
const ePtr = new Int32Array(entries);
|
|
130
|
+
const eVal = new Uint32Array(entries);
|
|
131
|
+
const eNext = new Int32Array(entries).fill(-1);
|
|
132
|
+
const hash = new Int32Array(hsize).fill(-1);
|
|
133
|
+
const hashCount = new Uint32Array(hsize);
|
|
134
|
+
let n = 0;
|
|
135
|
+
let prevVal = 0xffffffff;
|
|
136
|
+
for (let data = entries * RABIN_WINDOW - RABIN_WINDOW; data >= 0; data -= RABIN_WINDOW) {
|
|
137
|
+
let val = 0;
|
|
138
|
+
for (let k = 1; k <= RABIN_WINDOW; k++)
|
|
139
|
+
val = (((val << 8) | (buf[data + k] as number)) ^ (T[val >>> RABIN_SHIFT] as number)) >>> 0;
|
|
140
|
+
if (val === prevVal) {
|
|
141
|
+
ePtr[n - 1] = data + RABIN_WINDOW;
|
|
142
|
+
entries--;
|
|
143
|
+
} else {
|
|
144
|
+
prevVal = val;
|
|
145
|
+
const b = val & hmask;
|
|
146
|
+
ePtr[n] = data + RABIN_WINDOW;
|
|
147
|
+
eVal[n] = val;
|
|
148
|
+
eNext[n] = hash[b] as number;
|
|
149
|
+
hash[b] = n;
|
|
150
|
+
n++;
|
|
151
|
+
hashCount[b] = (hashCount[b] as number) + 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
for (let b = 0; b < hsize; b++) {
|
|
155
|
+
const count = hashCount[b] as number;
|
|
156
|
+
if (count <= HASH_LIMIT) continue;
|
|
157
|
+
entries -= count - HASH_LIMIT;
|
|
158
|
+
let entry = hash[b] as number;
|
|
159
|
+
let acc = 0;
|
|
160
|
+
do {
|
|
161
|
+
acc += count - HASH_LIMIT;
|
|
162
|
+
if (acc > 0) {
|
|
163
|
+
const keep = entry;
|
|
164
|
+
do {
|
|
165
|
+
entry = eNext[entry] as number;
|
|
166
|
+
acc -= HASH_LIMIT;
|
|
167
|
+
} while (acc > 0);
|
|
168
|
+
eNext[keep] = eNext[entry] as number;
|
|
169
|
+
}
|
|
170
|
+
entry = eNext[entry] as number;
|
|
171
|
+
} while (entry >= 0);
|
|
172
|
+
}
|
|
173
|
+
const start = new Int32Array(hsize + 1);
|
|
174
|
+
const ptr = new Int32Array(entries);
|
|
175
|
+
const valOut = new Uint32Array(entries);
|
|
176
|
+
let p = 0;
|
|
177
|
+
for (let b = 0; b < hsize; b++) {
|
|
178
|
+
start[b] = p;
|
|
179
|
+
for (let e = hash[b] as number; e >= 0; e = eNext[e] as number) {
|
|
180
|
+
ptr[p] = ePtr[e] as number;
|
|
181
|
+
valOut[p] = eVal[e] as number;
|
|
182
|
+
p++;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
start[hsize] = p;
|
|
186
|
+
return { src: buf, mask: hmask, start, ptr, val: valOut };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** `create_delta`: undefined when the delta would exceed `maxSize` (0: no limit). */
|
|
190
|
+
function createDelta(index: DeltaIndex, trg: Uint8Array, maxSize: number): Uint8Array | undefined {
|
|
191
|
+
const trgSize = trg.length;
|
|
192
|
+
if (!trgSize) return undefined;
|
|
193
|
+
let out = new Uint8Array(8192);
|
|
194
|
+
let outsize = 8192;
|
|
195
|
+
if (maxSize && outsize >= maxSize) {
|
|
196
|
+
outsize = maxSize + MAX_OP_SIZE + 1;
|
|
197
|
+
out = new Uint8Array(outsize);
|
|
198
|
+
}
|
|
199
|
+
let outpos = 0;
|
|
200
|
+
const grow = (size: number) => {
|
|
201
|
+
const next = new Uint8Array(size);
|
|
202
|
+
next.set(out.subarray(0, Math.min(out.length, size)));
|
|
203
|
+
out = next;
|
|
204
|
+
};
|
|
205
|
+
let l = index.src.length;
|
|
206
|
+
while (l >= 0x80) {
|
|
207
|
+
out[outpos++] = (l | 0x80) & 0xff;
|
|
208
|
+
l = Math.floor(l / 128);
|
|
209
|
+
}
|
|
210
|
+
out[outpos++] = l;
|
|
211
|
+
l = trgSize;
|
|
212
|
+
while (l >= 0x80) {
|
|
213
|
+
out[outpos++] = (l | 0x80) & 0xff;
|
|
214
|
+
l = Math.floor(l / 128);
|
|
215
|
+
}
|
|
216
|
+
out[outpos++] = l;
|
|
217
|
+
const ref = index.src;
|
|
218
|
+
const refTop = ref.length;
|
|
219
|
+
let data = 0;
|
|
220
|
+
const top = trgSize;
|
|
221
|
+
outpos++;
|
|
222
|
+
let val = 0;
|
|
223
|
+
let i = 0;
|
|
224
|
+
for (; i < RABIN_WINDOW && data < top; i++, data++) {
|
|
225
|
+
out[outpos++] = trg[data] as number;
|
|
226
|
+
val = (((val << 8) | (trg[data] as number)) ^ (T[val >>> RABIN_SHIFT] as number)) >>> 0;
|
|
227
|
+
}
|
|
228
|
+
let inscnt = i;
|
|
229
|
+
let moff = 0;
|
|
230
|
+
let msize = 0;
|
|
231
|
+
while (data < top) {
|
|
232
|
+
if (msize < 4096) {
|
|
233
|
+
val = (val ^ (U[trg[data - RABIN_WINDOW] as number] as number)) >>> 0;
|
|
234
|
+
val = (((val << 8) | (trg[data] as number)) ^ (T[val >>> RABIN_SHIFT] as number)) >>> 0;
|
|
235
|
+
const b = val & index.mask;
|
|
236
|
+
for (let e = index.start[b] as number; e < (index.start[b + 1] as number); e++) {
|
|
237
|
+
const entryPtr = index.ptr[e] as number;
|
|
238
|
+
let r = entryPtr;
|
|
239
|
+
let src = data;
|
|
240
|
+
let refSize = refTop - r;
|
|
241
|
+
if (index.val[e] !== val) continue;
|
|
242
|
+
if (refSize > top - src) refSize = top - src;
|
|
243
|
+
if (refSize <= msize) break;
|
|
244
|
+
while (refSize-- && trg[src++] === ref[r]) r++;
|
|
245
|
+
if (msize < r - entryPtr) {
|
|
246
|
+
msize = r - entryPtr;
|
|
247
|
+
moff = entryPtr;
|
|
248
|
+
if (msize >= 4096) break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (msize < 4) {
|
|
253
|
+
if (!inscnt) outpos++;
|
|
254
|
+
out[outpos++] = trg[data++] as number;
|
|
255
|
+
inscnt++;
|
|
256
|
+
if (inscnt === 0x7f) {
|
|
257
|
+
out[outpos - inscnt - 1] = inscnt;
|
|
258
|
+
inscnt = 0;
|
|
259
|
+
}
|
|
260
|
+
msize = 0;
|
|
261
|
+
} else {
|
|
262
|
+
if (inscnt) {
|
|
263
|
+
while (moff && ref[moff - 1] === trg[data - 1]) {
|
|
264
|
+
msize++;
|
|
265
|
+
moff--;
|
|
266
|
+
data--;
|
|
267
|
+
outpos--;
|
|
268
|
+
if (--inscnt) continue;
|
|
269
|
+
outpos--;
|
|
270
|
+
inscnt--;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
out[outpos - inscnt - 1] = inscnt & 0xff;
|
|
274
|
+
inscnt = 0;
|
|
275
|
+
}
|
|
276
|
+
const left = msize < 0x10000 ? 0 : msize - 0x10000;
|
|
277
|
+
msize -= left;
|
|
278
|
+
const op = outpos++;
|
|
279
|
+
let cmd = 0x80;
|
|
280
|
+
if (moff & 0xff) {
|
|
281
|
+
out[outpos++] = moff & 0xff;
|
|
282
|
+
cmd |= 0x01;
|
|
283
|
+
}
|
|
284
|
+
if (moff & 0xff00) {
|
|
285
|
+
out[outpos++] = (moff >>> 8) & 0xff;
|
|
286
|
+
cmd |= 0x02;
|
|
287
|
+
}
|
|
288
|
+
if (moff & 0xff0000) {
|
|
289
|
+
out[outpos++] = (moff >>> 16) & 0xff;
|
|
290
|
+
cmd |= 0x04;
|
|
291
|
+
}
|
|
292
|
+
if (moff & 0xff000000) {
|
|
293
|
+
out[outpos++] = (moff >>> 24) & 0xff;
|
|
294
|
+
cmd |= 0x08;
|
|
295
|
+
}
|
|
296
|
+
if (msize & 0xff) {
|
|
297
|
+
out[outpos++] = msize & 0xff;
|
|
298
|
+
cmd |= 0x10;
|
|
299
|
+
}
|
|
300
|
+
if (msize & 0xff00) {
|
|
301
|
+
out[outpos++] = (msize >>> 8) & 0xff;
|
|
302
|
+
cmd |= 0x20;
|
|
303
|
+
}
|
|
304
|
+
out[op] = cmd;
|
|
305
|
+
data += msize;
|
|
306
|
+
moff += msize;
|
|
307
|
+
msize = left;
|
|
308
|
+
if (moff > 0xffffffff) msize = 0;
|
|
309
|
+
if (msize < 4096) {
|
|
310
|
+
val = 0;
|
|
311
|
+
for (let j = -RABIN_WINDOW; j < 0; j++)
|
|
312
|
+
val =
|
|
313
|
+
(((val << 8) | (trg[data + j] as number)) ^ (T[val >>> RABIN_SHIFT] as number)) >>> 0;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (outpos >= outsize - MAX_OP_SIZE) {
|
|
317
|
+
outsize = Math.floor((outsize * 3) / 2);
|
|
318
|
+
if (maxSize && outsize >= maxSize) outsize = maxSize + MAX_OP_SIZE + 1;
|
|
319
|
+
if (maxSize && outpos > maxSize) break;
|
|
320
|
+
grow(outsize);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (inscnt) out[outpos - inscnt - 1] = inscnt;
|
|
324
|
+
if (maxSize && outpos > maxSize) return undefined;
|
|
325
|
+
return out.slice(0, outpos);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/** `diff_delta`: the delta of `trg` against `src`, undefined past `maxSize`. */
|
|
329
|
+
export function gitDiffDelta(
|
|
330
|
+
src: Uint8Array,
|
|
331
|
+
trg: Uint8Array,
|
|
332
|
+
maxSize: number,
|
|
333
|
+
): Uint8Array | undefined {
|
|
334
|
+
const index = createDeltaIndex(src);
|
|
335
|
+
if (!index) return undefined;
|
|
336
|
+
return createDelta(index, trg, maxSize);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const EN85 =
|
|
340
|
+
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~";
|
|
341
|
+
|
|
342
|
+
/** base85.c's `encode_85` of `bytes` bytes at `at`. */
|
|
343
|
+
function encode85(data: Uint8Array, at: number, bytes: number): string {
|
|
344
|
+
let out = "";
|
|
345
|
+
while (bytes) {
|
|
346
|
+
let acc = 0;
|
|
347
|
+
for (let cnt = 24; cnt >= 0; cnt -= 8) {
|
|
348
|
+
const ch = data[at++] as number;
|
|
349
|
+
acc = (acc | (ch << cnt)) >>> 0;
|
|
350
|
+
if (--bytes === 0) break;
|
|
351
|
+
}
|
|
352
|
+
const chunk: string[] = [];
|
|
353
|
+
for (let cnt = 4; cnt >= 0; cnt--) {
|
|
354
|
+
const v = acc % 85;
|
|
355
|
+
acc = Math.floor(acc / 85);
|
|
356
|
+
chunk[cnt] = EN85[v] as string;
|
|
357
|
+
}
|
|
358
|
+
out += chunk.join("");
|
|
359
|
+
}
|
|
360
|
+
return out;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function deflateIt(data: Uint8Array): Uint8Array {
|
|
364
|
+
return compressBlockPako(data, { level: 1 });
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** `emit_binary_diff_body`: one direction (`one` to `two`). */
|
|
368
|
+
function binaryDiffBody(one: Uint8Array, two: Uint8Array): string {
|
|
369
|
+
const deflated = deflateIt(two);
|
|
370
|
+
let delta: Uint8Array | undefined;
|
|
371
|
+
let origSize = 0;
|
|
372
|
+
if (one.length && two.length) {
|
|
373
|
+
const raw = gitDiffDelta(one, two, deflated.length);
|
|
374
|
+
if (raw) {
|
|
375
|
+
origSize = raw.length;
|
|
376
|
+
delta = deflateIt(raw);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
let out: string;
|
|
380
|
+
let data: Uint8Array;
|
|
381
|
+
if (delta && delta.length < deflated.length) {
|
|
382
|
+
out = `delta ${origSize}\n`;
|
|
383
|
+
data = delta;
|
|
384
|
+
} else {
|
|
385
|
+
out = `literal ${two.length}\n`;
|
|
386
|
+
data = deflated;
|
|
387
|
+
}
|
|
388
|
+
for (let at = 0; at < data.length; ) {
|
|
389
|
+
const bytes = Math.min(52, data.length - at);
|
|
390
|
+
const lead =
|
|
391
|
+
bytes <= 26 ? String.fromCharCode(bytes + 64) : String.fromCharCode(bytes - 26 + 96);
|
|
392
|
+
out += `${lead}${encode85(data, at, bytes)}\n`;
|
|
393
|
+
at += bytes;
|
|
394
|
+
}
|
|
395
|
+
return `${out}\n`;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** `emit_binary_diff`: "GIT binary patch", the forward and the reverse hunks. */
|
|
399
|
+
export function gitBinaryPatch(one: Uint8Array, two: Uint8Array): string {
|
|
400
|
+
return `GIT binary patch\n${binaryDiffBody(one, two)}${binaryDiffBody(two, one)}`;
|
|
401
|
+
}
|