@statewalker/vcs-commands 0.9.0 → 0.11.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 +1 -1
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-backend.d.ts +2 -0
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-modes.d.ts +6 -2
- package/dist/commands/add-patch/patch-modes.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-session.d.ts +4 -0
- package/dist/commands/add-patch/patch-session.d.ts.map +1 -1
- package/dist/commands/am/am-command.d.ts +41 -2
- package/dist/commands/am/am-command.d.ts.map +1 -1
- package/dist/commands/apply/index.d.ts +1 -1
- package/dist/commands/apply/index.d.ts.map +1 -1
- package/dist/commands/archive/archive-command.d.ts +169 -0
- package/dist/commands/archive/archive-command.d.ts.map +1 -0
- package/dist/commands/archive/archive-entry.d.ts +60 -0
- package/dist/commands/archive/archive-entry.d.ts.map +1 -0
- package/dist/commands/archive/index.d.ts +8 -0
- package/dist/commands/archive/index.d.ts.map +1 -0
- package/dist/commands/archive/remote-archive-command.d.ts +56 -0
- package/dist/commands/archive/remote-archive-command.d.ts.map +1 -0
- package/dist/commands/archive/tar-archive.d.ts +31 -0
- package/dist/commands/archive/tar-archive.d.ts.map +1 -0
- package/dist/commands/archive/tar-commit-id.d.ts +13 -0
- package/dist/commands/archive/tar-commit-id.d.ts.map +1 -0
- package/dist/commands/archive/upload-archive-writer.d.ts +48 -0
- package/dist/commands/archive/upload-archive-writer.d.ts.map +1 -0
- package/dist/commands/archive/zip-archive.d.ts +42 -0
- package/dist/commands/archive/zip-archive.d.ts.map +1 -0
- package/dist/commands/attributes-source.d.ts +10 -0
- package/dist/commands/attributes-source.d.ts.map +1 -1
- package/dist/commands/blame-command.d.ts +43 -1
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/bundle/bundle-create-command.d.ts +67 -0
- package/dist/commands/bundle/bundle-create-command.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-format.d.ts +89 -0
- package/dist/commands/bundle/bundle-format.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-list.d.ts +92 -0
- package/dist/commands/bundle/bundle-list.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-read-commands.d.ts +81 -0
- package/dist/commands/bundle/bundle-read-commands.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-support.d.ts +32 -0
- package/dist/commands/bundle/bundle-support.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-transport.d.ts +38 -0
- package/dist/commands/bundle/bundle-transport.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-uri-host.d.ts +43 -0
- package/dist/commands/bundle/bundle-uri-host.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-uri.d.ts +55 -0
- package/dist/commands/bundle/bundle-uri.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-verify.d.ts +63 -0
- package/dist/commands/bundle/bundle-verify.d.ts.map +1 -0
- package/dist/commands/bundle/index.d.ts +14 -0
- package/dist/commands/bundle/index.d.ts.map +1 -0
- package/dist/commands/cat-file/batch-format.d.ts +58 -0
- package/dist/commands/cat-file/batch-format.d.ts.map +1 -0
- package/dist/commands/cat-file/cat-file-command.d.ts +144 -0
- package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -0
- package/dist/commands/cat-file/index.d.ts +3 -0
- package/dist/commands/cat-file/index.d.ts.map +1 -0
- package/dist/commands/check-attr-command.d.ts +66 -0
- package/dist/commands/check-attr-command.d.ts.map +1 -0
- package/dist/commands/check-ignore-command.d.ts +58 -0
- package/dist/commands/check-ignore-command.d.ts.map +1 -0
- package/dist/commands/check-ref-format-command.d.ts +60 -0
- package/dist/commands/check-ref-format-command.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-index-command.d.ts +96 -0
- package/dist/commands/checkout-index-command.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +10 -0
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +28 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +9 -1
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/config-command.d.ts +2 -0
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/daemon-access-hook.d.ts +36 -0
- package/dist/commands/daemon-access-hook.d.ts.map +1 -0
- package/dist/commands/default-branch.d.ts +54 -0
- package/dist/commands/default-branch.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +132 -5
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/diff-external.d.ts +43 -0
- package/dist/commands/diff-external.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/diff-pairs-command.d.ts +27 -0
- package/dist/commands/diff-plumbing/diff-pairs-command.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/diff-plumbing-command.d.ts +129 -0
- package/dist/commands/diff-plumbing/diff-plumbing-command.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/index.d.ts +3 -0
- package/dist/commands/diff-plumbing/index.d.ts.map +1 -0
- package/dist/commands/diff-textconv.d.ts +5 -1
- package/dist/commands/diff-textconv.d.ts.map +1 -1
- package/dist/commands/fast-export/fast-export-command.d.ts +135 -0
- package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -0
- package/dist/commands/fast-export/fast-import-command.d.ts +182 -0
- package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -0
- package/dist/commands/fast-export/fast-stream-support.d.ts +64 -0
- package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -0
- package/dist/commands/fast-export/index.d.ts +4 -0
- package/dist/commands/fast-export/index.d.ts.map +1 -0
- package/dist/commands/fetch-command.d.ts +65 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/fetch-multiple-command.d.ts.map +1 -1
- package/dist/commands/format-rev-command.d.ts +60 -0
- package/dist/commands/format-rev-command.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-command.d.ts.map +1 -1
- package/dist/commands/fsck/fsck-msg-ids.d.ts +18 -3
- package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -1
- package/dist/commands/fsmonitor-ipc.d.ts +30 -0
- package/dist/commands/fsmonitor-ipc.d.ts.map +1 -0
- package/dist/commands/fsmonitor-refresh.d.ts +69 -0
- package/dist/commands/fsmonitor-refresh.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +5 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +32 -0
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/git-paths.d.ts +26 -0
- package/dist/commands/git-paths.d.ts.map +1 -0
- package/dist/commands/grep/grep-command.d.ts +2 -1
- package/dist/commands/grep/grep-command.d.ts.map +1 -1
- package/dist/commands/history-command.d.ts +156 -0
- package/dist/commands/history-command.d.ts.map +1 -0
- package/dist/commands/http-config.d.ts +38 -0
- package/dist/commands/http-config.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +12 -1
- package/dist/commands/index-adder.d.ts.map +1 -1
- package/dist/commands/index-host.d.ts.map +1 -1
- package/dist/commands/index.d.ts +45 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +6 -5
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/last-modified-command.d.ts +102 -0
- package/dist/commands/last-modified-command.d.ts.map +1 -0
- package/dist/commands/lfs/go-url.d.ts +43 -0
- package/dist/commands/lfs/go-url.d.ts.map +1 -0
- package/dist/commands/lfs/index.d.ts +3 -0
- package/dist/commands/lfs/index.d.ts.map +1 -0
- package/dist/commands/lfs/lfs-config.d.ts +174 -0
- package/dist/commands/lfs/lfs-config.d.ts.map +1 -0
- package/dist/commands/lfs/lfs-endpoint-command.d.ts +83 -0
- package/dist/commands/lfs/lfs-endpoint-command.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/log-command.d.ts +26 -0
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +28 -1
- package/dist/commands/log-output.d.ts.map +1 -1
- package/dist/commands/ls-files-command.d.ts +153 -0
- package/dist/commands/ls-files-command.d.ts.map +1 -0
- package/dist/commands/ls-remote-command.d.ts +5 -0
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/ls-tree-command.d.ts +105 -0
- package/dist/commands/ls-tree-command.d.ts.map +1 -0
- package/dist/commands/maintenance-run-command.d.ts +122 -0
- package/dist/commands/maintenance-run-command.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +7 -0
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-config.d.ts +7 -0
- package/dist/commands/merge-config.d.ts.map +1 -1
- package/dist/commands/merge-drivers.d.ts +67 -5
- package/dist/commands/merge-drivers.d.ts.map +1 -1
- package/dist/commands/merge-support.d.ts +6 -0
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/merge-tree-command.d.ts +122 -0
- package/dist/commands/merge-tree-command.d.ts.map +1 -0
- package/dist/commands/mktag-command.d.ts +51 -0
- package/dist/commands/mktag-command.d.ts.map +1 -0
- package/dist/commands/object-store/count-objects-command.d.ts +58 -0
- package/dist/commands/object-store/count-objects-command.d.ts.map +1 -0
- package/dist/commands/object-store/index.d.ts +5 -0
- package/dist/commands/object-store/index.d.ts.map +1 -0
- package/dist/commands/object-store/objects-directory.d.ts +12 -0
- package/dist/commands/object-store/objects-directory.d.ts.map +1 -0
- package/dist/commands/object-store/prune-command.d.ts +38 -0
- package/dist/commands/object-store/prune-command.d.ts.map +1 -0
- package/dist/commands/object-store/show-index-command.d.ts +23 -0
- package/dist/commands/object-store/show-index-command.d.ts.map +1 -0
- package/dist/commands/ort-merge.d.ts +24 -0
- package/dist/commands/ort-merge.d.ts.map +1 -1
- package/dist/commands/patch-id-command.d.ts +30 -0
- package/dist/commands/patch-id-command.d.ts.map +1 -0
- package/dist/commands/patch-id.d.ts +24 -0
- package/dist/commands/patch-id.d.ts.map +1 -1
- package/dist/commands/plumbing-command.d.ts +66 -0
- package/dist/commands/plumbing-command.d.ts.map +1 -0
- package/dist/commands/plumbing-input.d.ts +38 -0
- package/dist/commands/plumbing-input.d.ts.map +1 -0
- package/dist/commands/promisor-remote-reply.d.ts +35 -0
- package/dist/commands/promisor-remote-reply.d.ts.map +1 -0
- package/dist/commands/promisor-remote.d.ts.map +1 -1
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +17 -2
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +108 -2
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/refs-command.d.ts +81 -0
- package/dist/commands/refs-command.d.ts.map +1 -0
- package/dist/commands/remote-object-info-command.d.ts +55 -0
- package/dist/commands/remote-object-info-command.d.ts.map +1 -0
- package/dist/commands/remote-transport.d.ts +40 -3
- package/dist/commands/remote-transport.d.ts.map +1 -1
- package/dist/commands/repack-command.d.ts +115 -0
- package/dist/commands/repack-command.d.ts.map +1 -0
- package/dist/commands/replace-command.d.ts +143 -0
- package/dist/commands/replace-command.d.ts.map +1 -0
- package/dist/commands/replay-command.d.ts +117 -0
- package/dist/commands/replay-command.d.ts.map +1 -0
- package/dist/commands/repo-command.d.ts +158 -0
- package/dist/commands/repo-command.d.ts.map +1 -0
- package/dist/commands/request-pull-command.d.ts +82 -0
- package/dist/commands/request-pull-command.d.ts.map +1 -0
- package/dist/commands/rerere-command.d.ts +36 -0
- package/dist/commands/rerere-command.d.ts.map +1 -0
- package/dist/commands/rerere.d.ts +102 -0
- package/dist/commands/rerere.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +19 -2
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/rev-filter/commit-grep.d.ts +3 -1
- package/dist/commands/rev-filter/commit-grep.d.ts.map +1 -1
- package/dist/commands/rev-list-command.d.ts +3 -0
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/rev-parse-command.d.ts +5 -0
- package/dist/commands/rev-parse-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +10 -0
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +5 -0
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/revision-resolver.d.ts +27 -1
- package/dist/commands/revision-resolver.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +18 -0
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/serve-repository.d.ts +23 -1
- package/dist/commands/serve-repository.d.ts.map +1 -1
- package/dist/commands/session-id.d.ts +18 -0
- package/dist/commands/session-id.d.ts.map +1 -0
- package/dist/commands/show-branch-command.d.ts +59 -0
- package/dist/commands/show-branch-command.d.ts.map +1 -0
- package/dist/commands/show-ref-command.d.ts +112 -0
- package/dist/commands/show-ref-command.d.ts.map +1 -0
- package/dist/commands/signature-check.d.ts +9 -2
- package/dist/commands/signature-check.d.ts.map +1 -1
- package/dist/commands/signing.d.ts +30 -2
- package/dist/commands/signing.d.ts.map +1 -1
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-export-command.d.ts +115 -0
- package/dist/commands/stash-export-command.d.ts.map +1 -0
- package/dist/commands/status-command.d.ts +16 -2
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/stripspace-command.d.ts +44 -0
- package/dist/commands/stripspace-command.d.ts.map +1 -0
- package/dist/commands/submodule-add-command.d.ts +22 -1
- package/dist/commands/submodule-add-command.d.ts.map +1 -1
- package/dist/commands/submodule-auth.d.ts +3 -1
- package/dist/commands/submodule-auth.d.ts.map +1 -1
- package/dist/commands/submodule-commands.d.ts +9 -1
- package/dist/commands/submodule-commands.d.ts.map +1 -1
- package/dist/commands/submodule-update-command.d.ts +27 -1
- package/dist/commands/submodule-update-command.d.ts.map +1 -1
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/textconv-cache.d.ts +58 -0
- package/dist/commands/textconv-cache.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +5 -0
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/unpack-objects-command.d.ts +47 -0
- package/dist/commands/unpack-objects-command.d.ts.map +1 -0
- package/dist/commands/update-index-command.d.ts +131 -0
- package/dist/commands/update-index-command.d.ts.map +1 -0
- package/dist/commands/uri-protocols.d.ts +13 -0
- package/dist/commands/uri-protocols.d.ts.map +1 -0
- package/dist/commands/url-parse-command.d.ts +30 -0
- package/dist/commands/url-parse-command.d.ts.map +1 -0
- package/dist/commands/var-command.d.ts +42 -0
- package/dist/commands/var-command.d.ts.map +1 -0
- package/dist/{commands-CNvli5bl.js → commands-bQQ9OmCh.js} +52514 -44630
- package/dist/errors/command-errors.d.ts +33 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/index.js +39 -1
- package/dist/{fsck-CPeDh9fh.js → fsck-BHT9bUS-.js} +184 -143
- package/dist/git-command.d.ts +66 -4
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +532 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/guarded-transport-command.d.ts +3 -1
- package/dist/guarded-transport-command.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/maintenance-run-command-Cx2PlGV9.js +13544 -0
- package/dist/{remote-transport-CCmBadm-.js → remote-transport-BrQZfyHu.js} +1009 -10
- package/dist/results/cherry-pick-result.d.ts +6 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -1
- package/dist/results/diff-entry.d.ts +10 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-output.d.ts +49 -3
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/fetch-result.d.ts +12 -0
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.js +2 -2
- package/dist/results/merge-result.d.ts +5 -0
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +5 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/rebase-result.d.ts +7 -0
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/revert-result.d.ts +6 -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-BDuEgdLU.js → results-CNHQnU5Y.js} +13707 -10608
- package/dist/transport-command.d.ts +79 -1
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/commands/add-command.ts +3 -0
- package/src/commands/add-patch/patch-backend.ts +4 -1
- package/src/commands/add-patch/patch-modes.ts +26 -2
- package/src/commands/add-patch/patch-session.ts +6 -0
- package/src/commands/am/am-command.ts +193 -22
- package/src/commands/apply/index.ts +1 -0
- package/src/commands/archive/archive-command.ts +1148 -0
- package/src/commands/archive/archive-entry.ts +93 -0
- package/src/commands/archive/index.ts +7 -0
- package/src/commands/archive/remote-archive-command.ts +140 -0
- package/src/commands/archive/tar-archive.ts +207 -0
- package/src/commands/archive/tar-commit-id.ts +72 -0
- package/src/commands/archive/upload-archive-writer.ts +213 -0
- package/src/commands/archive/zip-archive.ts +317 -0
- package/src/commands/attributes-source.ts +26 -12
- package/src/commands/blame-command.ts +118 -19
- package/src/commands/bundle/bundle-create-command.ts +405 -0
- package/src/commands/bundle/bundle-format.ts +228 -0
- package/src/commands/bundle/bundle-list.ts +276 -0
- package/src/commands/bundle/bundle-read-commands.ts +157 -0
- package/src/commands/bundle/bundle-support.ts +85 -0
- package/src/commands/bundle/bundle-transport.ts +107 -0
- package/src/commands/bundle/bundle-uri-host.ts +204 -0
- package/src/commands/bundle/bundle-uri.ts +236 -0
- package/src/commands/bundle/bundle-verify.ts +152 -0
- package/src/commands/bundle/index.ts +14 -0
- package/src/commands/cat-file/batch-format.ts +193 -0
- package/src/commands/cat-file/cat-file-command.ts +895 -0
- package/src/commands/cat-file/index.ts +2 -0
- package/src/commands/check-attr-command.ts +333 -0
- package/src/commands/check-ignore-command.ts +261 -0
- package/src/commands/check-ref-format-command.ts +129 -0
- package/src/commands/checkout-command.ts +61 -22
- package/src/commands/checkout-index-command.ts +568 -0
- package/src/commands/checkout-paths.ts +7 -0
- package/src/commands/cherry-pick-command.ts +21 -1
- package/src/commands/clone-command.ts +249 -9
- package/src/commands/commit-command.ts +22 -4
- package/src/commands/config-command.ts +9 -0
- package/src/commands/daemon-access-hook.ts +78 -0
- package/src/commands/default-branch.ts +118 -1
- package/src/commands/diff-command.ts +592 -47
- package/src/commands/diff-external.ts +131 -0
- package/src/commands/diff-plumbing/diff-pairs-command.ts +193 -0
- package/src/commands/diff-plumbing/diff-plumbing-command.ts +424 -0
- package/src/commands/diff-plumbing/index.ts +2 -0
- package/src/commands/diff-textconv.ts +5 -1
- package/src/commands/fast-export/fast-export-command.ts +911 -0
- package/src/commands/fast-export/fast-import-command.ts +1553 -0
- package/src/commands/fast-export/fast-stream-support.ts +162 -0
- package/src/commands/fast-export/index.ts +3 -0
- package/src/commands/fetch-command.ts +312 -8
- package/src/commands/fetch-multiple-command.ts +4 -1
- package/src/commands/format-rev-command.ts +267 -0
- package/src/commands/fsck/fsck-command.ts +47 -20
- package/src/commands/fsck/fsck-msg-ids.ts +19 -3
- package/src/commands/fsck/fsck-pack.ts +2 -2
- package/src/commands/fsmonitor-ipc.ts +121 -0
- package/src/commands/fsmonitor-refresh.ts +320 -0
- package/src/commands/gc-command.ts +10 -0
- package/src/commands/git-hooks.ts +123 -6
- package/src/commands/git-paths.ts +136 -0
- package/src/commands/grep/grep-command.ts +38 -15
- package/src/commands/history-command.ts +617 -0
- package/src/commands/http-config.ts +139 -0
- package/src/commands/index-adder.ts +37 -3
- package/src/commands/index-host.ts +6 -1
- package/src/commands/index.ts +46 -0
- package/src/commands/init-command.ts +14 -0
- package/src/commands/last-modified-command.ts +804 -0
- package/src/commands/lfs/go-url.ts +370 -0
- package/src/commands/lfs/index.ts +2 -0
- package/src/commands/lfs/lfs-config.ts +738 -0
- package/src/commands/lfs/lfs-endpoint-command.ts +180 -0
- package/src/commands/local-transport.ts +252 -4
- package/src/commands/log-command.ts +104 -5
- package/src/commands/log-output.ts +66 -5
- package/src/commands/ls-files-command.ts +1177 -0
- package/src/commands/ls-remote-command.ts +6 -0
- package/src/commands/ls-tree-command.ts +708 -0
- package/src/commands/maintenance-run-command.ts +949 -0
- package/src/commands/merge-command.ts +78 -32
- package/src/commands/merge-config.ts +23 -1
- package/src/commands/merge-drivers.ts +109 -20
- package/src/commands/merge-support.ts +29 -5
- package/src/commands/merge-tree-command.ts +786 -0
- package/src/commands/mktag-command.ts +149 -0
- package/src/commands/object-store/count-objects-command.ts +404 -0
- package/src/commands/object-store/index.ts +4 -0
- package/src/commands/object-store/objects-directory.ts +24 -0
- package/src/commands/object-store/prune-command.ts +129 -0
- package/src/commands/object-store/show-index-command.ts +151 -0
- package/src/commands/ort-merge.ts +92 -25
- package/src/commands/patch-id-command.ts +65 -0
- package/src/commands/patch-id.ts +218 -0
- package/src/commands/plumbing-command.ts +141 -0
- package/src/commands/plumbing-input.ts +87 -0
- package/src/commands/promisor-remote-reply.ts +276 -0
- package/src/commands/promisor-remote.ts +25 -2
- package/src/commands/pull-command.ts +2 -0
- package/src/commands/push-command.ts +87 -5
- package/src/commands/rebase-command.ts +507 -19
- package/src/commands/refs-command.ts +274 -0
- package/src/commands/remote-object-info-command.ts +109 -0
- package/src/commands/remote-transport.ts +116 -1
- package/src/commands/repack-command.ts +383 -0
- package/src/commands/replace-command.ts +816 -0
- package/src/commands/replay-command.ts +674 -0
- package/src/commands/repo-command.ts +1066 -0
- package/src/commands/request-pull-command.ts +356 -0
- package/src/commands/rerere-command.ts +179 -0
- package/src/commands/rerere.ts +925 -0
- package/src/commands/reset-command.ts +75 -3
- package/src/commands/rev-filter/commit-grep.ts +7 -2
- package/src/commands/rev-list-command.ts +9 -0
- package/src/commands/rev-parse-command.ts +49 -5
- package/src/commands/revert-command.ts +21 -1
- package/src/commands/revision-range.ts +7 -2
- package/src/commands/revision-resolver.ts +97 -14
- package/src/commands/sequencer-pick.ts +47 -0
- package/src/commands/serve-repository.ts +65 -0
- package/src/commands/session-id.ts +31 -0
- package/src/commands/show-branch-command.ts +981 -0
- package/src/commands/show-command.ts +1 -1
- package/src/commands/show-ref-command.ts +439 -0
- package/src/commands/signature-check.ts +37 -5
- package/src/commands/signing.ts +176 -23
- package/src/commands/stash-apply-command.ts +3 -0
- package/src/commands/stash-export-command.ts +397 -0
- package/src/commands/status-command.ts +74 -8
- package/src/commands/stripspace-command.ts +118 -0
- package/src/commands/submodule-add-command.ts +40 -2
- package/src/commands/submodule-auth.ts +61 -6
- package/src/commands/submodule-commands.ts +12 -2
- package/src/commands/submodule-update-command.ts +47 -1
- package/src/commands/tag-command.ts +33 -11
- package/src/commands/textconv-cache.ts +143 -0
- package/src/commands/tree-restore.ts +14 -0
- package/src/commands/unpack-objects-command.ts +235 -0
- package/src/commands/update-index-command.ts +1148 -0
- package/src/commands/uri-protocols.ts +13 -0
- package/src/commands/url-parse-command.ts +67 -0
- package/src/commands/var-command.ts +219 -0
- package/src/errors/command-errors.ts +45 -0
- package/src/git-command.ts +177 -3
- package/src/git.ts +808 -1
- package/src/guarded-transport-command.ts +6 -1
- package/src/results/cherry-pick-result.ts +6 -0
- package/src/results/diff-entry.ts +12 -0
- package/src/results/diff-formatter.ts +7 -4
- package/src/results/diff-output.ts +117 -11
- package/src/results/diff-pickaxe.ts +1 -1
- package/src/results/fetch-result.ts +12 -0
- package/src/results/merge-result.ts +5 -0
- package/src/results/push-result.ts +5 -0
- package/src/results/rebase-result.ts +7 -0
- package/src/results/revert-result.ts +6 -0
- package/src/results/stash-result.ts +6 -0
- package/src/transport-command.ts +182 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the bundle commands share: bundle.c's `verify_bundle` and `unbundle` over the
|
|
3
|
+
* command's repository.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { historyWithoutLazyFetch, type ObjectId } from "@statewalker/vcs-core";
|
|
7
|
+
import { createRepositoryFacade } from "@statewalker/vcs-transport";
|
|
8
|
+
|
|
9
|
+
import { GitCommand } from "../../git-command.js";
|
|
10
|
+
import type { BundleHeader } from "./bundle-format.js";
|
|
11
|
+
import { type OpenedBundle, type VerifyBundleOptions, verifyBundleIn } from "./bundle-verify.js";
|
|
12
|
+
|
|
13
|
+
/** The commands reading a bundle against the repository. */
|
|
14
|
+
export abstract class BundleCommandBase<T> extends GitCommand<T> {
|
|
15
|
+
/**
|
|
16
|
+
* bundle.c's `verify_bundle` against this repository (see {@link verifyBundleIn}).
|
|
17
|
+
*/
|
|
18
|
+
protected async verifyBundle(
|
|
19
|
+
header: BundleHeader,
|
|
20
|
+
options: VerifyBundleOptions = {},
|
|
21
|
+
): Promise<{ ok: boolean; stdout: string; stderr: string }> {
|
|
22
|
+
return verifyBundleIn(
|
|
23
|
+
{
|
|
24
|
+
history: this._workingCopy.history,
|
|
25
|
+
refValues: () => this.allRefValues(),
|
|
26
|
+
shallow: () => this.shallowCommits(),
|
|
27
|
+
},
|
|
28
|
+
header,
|
|
29
|
+
options,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* bundle.c's `unbundle`: the bundle verified (git's lines on failure), then its pack
|
|
35
|
+
* indexed and kept (`index-pack --fix-thin --stdin`), a filtered bundle's marked as a
|
|
36
|
+
* promisor pack (`--promisor=from-bundle`).
|
|
37
|
+
*/
|
|
38
|
+
protected async unbundleInto(
|
|
39
|
+
bundle: OpenedBundle,
|
|
40
|
+
options: VerifyBundleOptions = {},
|
|
41
|
+
): Promise<{ ok: boolean; stderr: string; packId?: string }> {
|
|
42
|
+
const verified = await this.verifyBundle(bundle.header, options);
|
|
43
|
+
if (!verified.ok) return { ok: false, stderr: verified.stderr };
|
|
44
|
+
const history = historyWithoutLazyFetch(this._workingCopy.history);
|
|
45
|
+
const facade = createRepositoryFacade({ history });
|
|
46
|
+
const pack = bundle.pack;
|
|
47
|
+
let imported: { packId?: string };
|
|
48
|
+
try {
|
|
49
|
+
imported = await facade.importPack(
|
|
50
|
+
(async function* () {
|
|
51
|
+
yield pack;
|
|
52
|
+
})(),
|
|
53
|
+
{ keepPack: true },
|
|
54
|
+
);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
57
|
+
const fatal = message.startsWith("fatal: ") ? message : `fatal: ${message}`;
|
|
58
|
+
return { ok: false, stderr: `${fatal}\nerror: index-pack died\n` };
|
|
59
|
+
}
|
|
60
|
+
if (bundle.header.filter !== undefined && imported.packId !== undefined) {
|
|
61
|
+
await facade.markPromisorPack?.(imported.packId, "from-bundle\n");
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
ok: true,
|
|
65
|
+
stderr: "",
|
|
66
|
+
...(imported.packId !== undefined ? { packId: imported.packId } : {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** What `rev-list --all` starts from: every ref's value and HEAD's. */
|
|
71
|
+
protected async allRefValues(): Promise<ObjectId[]> {
|
|
72
|
+
const out = new Set<ObjectId>();
|
|
73
|
+
const refs = this.refsStore;
|
|
74
|
+
for await (const ref of refs.list()) {
|
|
75
|
+
const id =
|
|
76
|
+
"objectId" in ref && ref.objectId
|
|
77
|
+
? ref.objectId
|
|
78
|
+
: (await refs.resolve(ref.name).catch(() => undefined))?.objectId;
|
|
79
|
+
if (id) out.add(id);
|
|
80
|
+
}
|
|
81
|
+
const head = (await refs.resolve("HEAD").catch(() => undefined))?.objectId;
|
|
82
|
+
if (head) out.add(head);
|
|
83
|
+
return [...out];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git's bundle transport (transport.c's `bundle_vtable`): a remote URL that is a path to a
|
|
3
|
+
* bundle file is read as a repository whose refs are the bundle's and whose only pack is the
|
|
4
|
+
* bundle's. Fetch, clone, pull and ls-remote reach it through an upload-pack served in
|
|
5
|
+
* process from the bundle: its refs advertised (in git's order: the bundle's refs reversed,
|
|
6
|
+
* as `get_refs_from_bundle` prepends each), and any fetch answered with the bundle's pack,
|
|
7
|
+
* once the fetching repository has the bundle's prerequisites (`unbundle`'s `verify_bundle`).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
type Duplex,
|
|
12
|
+
openDuplexConnection,
|
|
13
|
+
type RefStore,
|
|
14
|
+
type RepositoryFacade,
|
|
15
|
+
serveOverDuplex,
|
|
16
|
+
type UploadPackConnection,
|
|
17
|
+
} from "@statewalker/vcs-transport";
|
|
18
|
+
|
|
19
|
+
import { TransportError } from "../../errors/index.js";
|
|
20
|
+
import type { BundleHeader } from "./bundle-format.js";
|
|
21
|
+
import type { OpenedBundle } from "./bundle-verify.js";
|
|
22
|
+
|
|
23
|
+
/** A bundle remote: its file read, and how to check it against the fetching repository. */
|
|
24
|
+
export interface BundleRemote {
|
|
25
|
+
readonly bundle: OpenedBundle;
|
|
26
|
+
/**
|
|
27
|
+
* `verify_bundle` against the repository fetching (its `error:` lines on failure), run
|
|
28
|
+
* before the pack is handed over
|
|
29
|
+
*/
|
|
30
|
+
verify(): Promise<{ ok: boolean; stderr: string }>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A fetch from a bundle the repository lacks the prerequisites of: `verify_bundle`'s lines
|
|
35
|
+
* (`git fetch` exits 1; `git clone` adds `fatal: remote transport reported error`, 128).
|
|
36
|
+
*/
|
|
37
|
+
export class BundlePrerequisitesError extends TransportError {
|
|
38
|
+
constructor(readonly lines: string) {
|
|
39
|
+
super(lines.replace(/\n$/, ""), undefined, { exitCode: 1 });
|
|
40
|
+
this.name = "BundlePrerequisitesError";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Bytes per chunk the served pack is cut into. */
|
|
45
|
+
const CHUNK = 64 * 1024;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Runs `run` over a connection to an upload-pack serving the bundle (protocol v0). A fetch
|
|
49
|
+
* that needs the pack verifies the bundle first: when the repository lacks its prerequisites
|
|
50
|
+
* the fetch fails with git's lines (exit 1, as `git fetch` returns).
|
|
51
|
+
*/
|
|
52
|
+
export async function withBundleUploadPack<T>(
|
|
53
|
+
remote: BundleRemote,
|
|
54
|
+
createPair: () => [Duplex, Duplex],
|
|
55
|
+
run: (connection: UploadPackConnection) => Promise<T>,
|
|
56
|
+
): Promise<T> {
|
|
57
|
+
const { header, pack } = remote.bundle;
|
|
58
|
+
let refused: string | undefined;
|
|
59
|
+
const facade: RepositoryFacade = {
|
|
60
|
+
objectFormat: header.objectFormat,
|
|
61
|
+
importPack: () => Promise.reject(new Error("a bundle cannot be written to")),
|
|
62
|
+
async *exportPack() {
|
|
63
|
+
const verified = await remote.verify();
|
|
64
|
+
if (!verified.ok) {
|
|
65
|
+
refused = verified.stderr;
|
|
66
|
+
throw new Error("bundle prerequisites missing");
|
|
67
|
+
}
|
|
68
|
+
for (let at = 0; at < pack.length; at += CHUNK) yield pack.subarray(at, at + CHUNK);
|
|
69
|
+
},
|
|
70
|
+
has: async (oid) => header.references.some((r) => r.id === oid),
|
|
71
|
+
async *walkAncestors() {},
|
|
72
|
+
};
|
|
73
|
+
const [client, server] = createPair();
|
|
74
|
+
const serving = serveOverDuplex({
|
|
75
|
+
duplex: server,
|
|
76
|
+
repository: facade,
|
|
77
|
+
refStore: bundleRefStore(header),
|
|
78
|
+
service: "git-upload-pack",
|
|
79
|
+
}).finally(() => server.close?.());
|
|
80
|
+
try {
|
|
81
|
+
const connection = await openDuplexConnection(client, { closeDuplex: true });
|
|
82
|
+
try {
|
|
83
|
+
return await run(connection);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
if (refused !== undefined) {
|
|
86
|
+
throw new BundlePrerequisitesError(refused);
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
} finally {
|
|
90
|
+
await connection.close();
|
|
91
|
+
}
|
|
92
|
+
} finally {
|
|
93
|
+
await client.close?.();
|
|
94
|
+
await serving.catch(() => undefined);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The refs a bundle advertises: read-only, in `get_refs_from_bundle`'s (reversed) order. */
|
|
99
|
+
function bundleRefStore(header: BundleHeader): RefStore {
|
|
100
|
+
const refs = [...header.references].reverse();
|
|
101
|
+
return {
|
|
102
|
+
get: async (name) => refs.find((r) => r.name === name)?.id,
|
|
103
|
+
update: () => Promise.reject(new Error("a bundle cannot be written to")),
|
|
104
|
+
listAll: async () => refs.map((r): [string, string] => [r.name, r.id]),
|
|
105
|
+
isRefTip: async (oid) => refs.some((r) => r.id === oid),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The repository side of bundle URIs for clone and fetch: downloads (`copy_uri_to_file`),
|
|
3
|
+
* `unbundle_from_file` (the bundle verified quietly, its pack indexed and kept, its refs
|
|
4
|
+
* written under `refs/bundles/`) and `fetch.bundleCreationToken`.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { historyWithoutLazyFetch, type ObjectId, type RefLogOptions } from "@statewalker/vcs-core";
|
|
8
|
+
import {
|
|
9
|
+
type Credentials,
|
|
10
|
+
createRepositoryFacade,
|
|
11
|
+
type HttpClientSettings,
|
|
12
|
+
type HttpCredentialHelper,
|
|
13
|
+
SmartHttpClient,
|
|
14
|
+
} from "@statewalker/vcs-transport";
|
|
15
|
+
|
|
16
|
+
import type { WorkingCopy } from "../../types.js";
|
|
17
|
+
import type { BundleUriHost } from "./bundle-uri.js";
|
|
18
|
+
import { openBundle, verifyBundleIn } from "./bundle-verify.js";
|
|
19
|
+
|
|
20
|
+
/** What {@link createBundleUriHost} works with. */
|
|
21
|
+
export interface BundleUriHostOptions {
|
|
22
|
+
workingCopy: WorkingCopy;
|
|
23
|
+
/** Writes a ref (no old value checked: git reads it right before) */
|
|
24
|
+
setRef(name: string, id: ObjectId, log: RefLogOptions): Promise<void>;
|
|
25
|
+
/** Reads a ref's value */
|
|
26
|
+
getRef(name: string): Promise<ObjectId | undefined>;
|
|
27
|
+
/** The reflog entry of a write (`fetched bundle`) */
|
|
28
|
+
reflogLine(message: string): RefLogOptions;
|
|
29
|
+
/**
|
|
30
|
+
* git 2.43 maps only `refs/heads/<name>` to `refs/bundles/<name>`; 2.5x maps every
|
|
31
|
+
* `refs/<name>` to `refs/bundles/<name>` (tags too)
|
|
32
|
+
*/
|
|
33
|
+
compatibility?: "2.43" | "2.56";
|
|
34
|
+
/** A local path's bytes (relative paths as the clone resolves its source) */
|
|
35
|
+
readLocalFile(path: string): Promise<Uint8Array | undefined>;
|
|
36
|
+
/** HTTP: the remote's URL; static credentials and headers go only to its origin */
|
|
37
|
+
remoteUrl?: string;
|
|
38
|
+
credentials?: Credentials;
|
|
39
|
+
headers?: Record<string, string>;
|
|
40
|
+
credentialHelper?: HttpCredentialHelper;
|
|
41
|
+
httpSettings?(url: string): HttpClientSettings;
|
|
42
|
+
fetchImpl?: (request: Request) => Promise<Response>;
|
|
43
|
+
/** Reads `fetch.bundleCreationToken` */
|
|
44
|
+
configValue(key: string): string | null | undefined;
|
|
45
|
+
/** Stores `fetch.bundleCreationToken` */
|
|
46
|
+
setConfigValue(key: string, value: string): Promise<void>;
|
|
47
|
+
message(line: string): void;
|
|
48
|
+
/** How the downloaded list file is named in errors */
|
|
49
|
+
tempFileName?(): string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The origin of a URL, or undefined for one `new URL` cannot read. */
|
|
53
|
+
function originOf(url: string): string | undefined {
|
|
54
|
+
try {
|
|
55
|
+
return new URL(url).origin;
|
|
56
|
+
} catch {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A host over a repository (see {@link BundleUriHostOptions}). */
|
|
62
|
+
export function createBundleUriHost(options: BundleUriHostOptions): BundleUriHost {
|
|
63
|
+
const history = options.workingCopy.history;
|
|
64
|
+
return {
|
|
65
|
+
async download(uri) {
|
|
66
|
+
if (/^https?:/.test(uri)) return downloadHttp(options, uri);
|
|
67
|
+
// copy_uri_to_file: `file://` dropped, anything else copied as a path
|
|
68
|
+
const path = uri.startsWith("file://") ? uri.slice("file://".length) : uri;
|
|
69
|
+
return options.readLocalFile(path).catch(() => undefined);
|
|
70
|
+
},
|
|
71
|
+
async unbundle(bytes) {
|
|
72
|
+
const opened = openBundle(bytes, "<bundle>");
|
|
73
|
+
if (!opened.ok) return false;
|
|
74
|
+
const { header, pack } = opened.bundle;
|
|
75
|
+
const objects = historyWithoutLazyFetch(history);
|
|
76
|
+
const verified = await verifyBundleIn(
|
|
77
|
+
{
|
|
78
|
+
history,
|
|
79
|
+
refValues: () => refValuesOf(history.refs),
|
|
80
|
+
shallow: async () => (await history.refs.getShallow?.().catch(() => undefined)) ?? [],
|
|
81
|
+
},
|
|
82
|
+
header,
|
|
83
|
+
{ quiet: true },
|
|
84
|
+
);
|
|
85
|
+
for (const line of verified.stderr.split("\n")) if (line) options.message(line);
|
|
86
|
+
if (!verified.ok) return false;
|
|
87
|
+
const facade = createRepositoryFacade({ history: objects });
|
|
88
|
+
let packId: string | undefined;
|
|
89
|
+
try {
|
|
90
|
+
const imported = await facade.importPack(
|
|
91
|
+
(async function* () {
|
|
92
|
+
yield pack;
|
|
93
|
+
})(),
|
|
94
|
+
{ keepPack: true },
|
|
95
|
+
);
|
|
96
|
+
packId = imported.packId;
|
|
97
|
+
} catch (error) {
|
|
98
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
99
|
+
options.message(message.startsWith("fatal: ") ? message : `fatal: ${message}`);
|
|
100
|
+
options.message("error: index-pack died");
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (header.filter !== undefined && packId !== undefined) {
|
|
104
|
+
await facade.markPromisorPack?.(packId, "from-bundle\n");
|
|
105
|
+
}
|
|
106
|
+
for (const ref of header.references) {
|
|
107
|
+
if (!ref.name.startsWith("refs/")) continue;
|
|
108
|
+
let target: string;
|
|
109
|
+
if (options.compatibility === "2.43") {
|
|
110
|
+
if (!ref.name.startsWith("refs/heads/")) continue;
|
|
111
|
+
target = `refs/bundles/${ref.name.slice("refs/heads/".length)}`;
|
|
112
|
+
} else {
|
|
113
|
+
target = `refs/bundles/${ref.name.slice("refs/".length)}`;
|
|
114
|
+
}
|
|
115
|
+
// refs_update_ref with UPDATE_REFS_MSG_ON_ERR: a failure is reported, not fatal
|
|
116
|
+
if (!(await objectExists(objects, ref.id))) {
|
|
117
|
+
options.message(
|
|
118
|
+
`error: trying to write ref '${target}' with nonexistent object ${ref.id}`,
|
|
119
|
+
);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
await options.setRef(target, ref.id, options.reflogLine("fetched bundle"));
|
|
124
|
+
} catch (error) {
|
|
125
|
+
options.message(`error: ${error instanceof Error ? error.message : String(error)}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
},
|
|
130
|
+
creationToken: () => options.configValue("fetch.bundleCreationToken"),
|
|
131
|
+
setCreationToken: (value) => options.setConfigValue("fetch.bundleCreationToken", value),
|
|
132
|
+
message: (line) => options.message(line),
|
|
133
|
+
...(options.tempFileName ? { tempFileName: options.tempFileName } : {}),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* `download_https_uri_to_file` (git-remote-https's `get`): a URI holding a space or a newline
|
|
139
|
+
* is refused (the remote helper's protocol separates on them); a response that is not 2xx
|
|
140
|
+
* fails. The command's static credentials and headers go only to the remote's own origin
|
|
141
|
+
* (the list is the server's content and may name any host); the credential helper is asked
|
|
142
|
+
* per URL, as git's helper is.
|
|
143
|
+
*/
|
|
144
|
+
async function downloadHttp(
|
|
145
|
+
options: BundleUriHostOptions,
|
|
146
|
+
uri: string,
|
|
147
|
+
): Promise<Uint8Array | undefined> {
|
|
148
|
+
if (/[ \n]/.test(uri)) {
|
|
149
|
+
options.message(`error: bundle-uri: URI is malformed: '${uri}'`);
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
const sameOrigin =
|
|
153
|
+
options.remoteUrl !== undefined &&
|
|
154
|
+
originOf(uri) !== undefined &&
|
|
155
|
+
originOf(uri) === originOf(options.remoteUrl);
|
|
156
|
+
const controller = new AbortController();
|
|
157
|
+
const client = new SmartHttpClient({
|
|
158
|
+
url: uri,
|
|
159
|
+
fetchImpl: options.fetchImpl ?? ((request) => fetch(request)),
|
|
160
|
+
signal: controller.signal,
|
|
161
|
+
...(sameOrigin && options.headers ? { headers: options.headers } : {}),
|
|
162
|
+
...(sameOrigin && options.credentials ? { auth: options.credentials } : {}),
|
|
163
|
+
...(options.httpSettings ? { settings: options.httpSettings(uri) } : {}),
|
|
164
|
+
...(options.credentialHelper ? { credentialHelper: options.credentialHelper } : {}),
|
|
165
|
+
});
|
|
166
|
+
try {
|
|
167
|
+
const response = await client.get(uri, (next) => next());
|
|
168
|
+
if (!response.ok) {
|
|
169
|
+
await response.body?.cancel().catch(() => undefined);
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
173
|
+
} catch {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Every ref's value and HEAD's (what `rev-list --all` starts from). */
|
|
179
|
+
async function refValuesOf(refs: WorkingCopy["history"]["refs"]): Promise<string[]> {
|
|
180
|
+
const out = new Set<string>();
|
|
181
|
+
for await (const ref of refs.list()) {
|
|
182
|
+
const id =
|
|
183
|
+
"objectId" in ref && ref.objectId
|
|
184
|
+
? ref.objectId
|
|
185
|
+
: (await refs.resolve(ref.name).catch(() => undefined))?.objectId;
|
|
186
|
+
if (id) out.add(id);
|
|
187
|
+
}
|
|
188
|
+
const head = (await refs.resolve("HEAD").catch(() => undefined))?.objectId;
|
|
189
|
+
if (head) out.add(head);
|
|
190
|
+
return [...out];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** git's `parse_object`-free existence check of an object. */
|
|
194
|
+
async function objectExists(
|
|
195
|
+
history: ReturnType<typeof historyWithoutLazyFetch>,
|
|
196
|
+
id: ObjectId,
|
|
197
|
+
): Promise<boolean> {
|
|
198
|
+
const objects = (history as { objects?: { has(id: ObjectId): Promise<boolean> } }).objects;
|
|
199
|
+
if (objects) return objects.has(id).catch(() => false);
|
|
200
|
+
for (const store of [history.commits, history.trees, history.blobs, history.tags]) {
|
|
201
|
+
if (await store.has(id).catch(() => false)) return true;
|
|
202
|
+
}
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle URIs on the client (bundle-uri.c): before a clone or a fetch talks to the remote,
|
|
3
|
+
* bundles are downloaded from a URI (`git clone --bundle-uri`, `fetch.bundleURI`) or from the
|
|
4
|
+
* list the server advertises (`transfer.bundleURI`, the v2 `bundle-uri` command) and
|
|
5
|
+
* unbundled into the repository, their refs written under `refs/bundles/`. The fetch that
|
|
6
|
+
* follows then has them as local tips, so it asks only for what they lack.
|
|
7
|
+
*
|
|
8
|
+
* The engine is the host's: {@link BundleUriHost} downloads a URI, unbundles bytes and reads
|
|
9
|
+
* and writes `fetch.bundleCreationToken`. {@link fetchBundleUri} and {@link fetchBundleList}
|
|
10
|
+
* follow git's walk, its recursion limit, `all`/`any` modes and the `creationToken`
|
|
11
|
+
* heuristic, and give git's warnings in order.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { parseBundleHeader } from "./bundle-format.js";
|
|
15
|
+
import { BundleList, parseBundleListConfig, type RemoteBundleInfo } from "./bundle-list.js";
|
|
16
|
+
|
|
17
|
+
/** What the walk needs of the repository and the network. */
|
|
18
|
+
export interface BundleUriHost {
|
|
19
|
+
/**
|
|
20
|
+
* `copy_uri_to_file`: the bytes at `uri` (an `http(s)://` URL, a `file://` URL or a path),
|
|
21
|
+
* or undefined when they cannot be had (git's warning follows)
|
|
22
|
+
*/
|
|
23
|
+
download(uri: string): Promise<Uint8Array | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* `unbundle_from_file`: the bundle verified (quietly) and its pack indexed, then its refs
|
|
26
|
+
* written under `refs/bundles/`; false when the header, the prerequisites or the pack fail
|
|
27
|
+
*/
|
|
28
|
+
unbundle(bytes: Uint8Array): Promise<boolean>;
|
|
29
|
+
/** `fetch.bundleCreationToken` as set (undefined: unset; null: set without a value) */
|
|
30
|
+
creationToken(): string | null | undefined;
|
|
31
|
+
/** Stores `fetch.bundleCreationToken` in the repository's config */
|
|
32
|
+
setCreationToken(value: string): Promise<void>;
|
|
33
|
+
/** A line git prints on stderr (`warning: ...`, `error: ...`) */
|
|
34
|
+
message(line: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* How git names a downloaded list in its `bad config line` error (its temporary file,
|
|
37
|
+
* `<objects>/bundles/tmp_uri_XXXXXX`)
|
|
38
|
+
*/
|
|
39
|
+
tempFileName?(): string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** bundle-uri.c's `max_bundle_uri_depth`. */
|
|
43
|
+
const MAX_BUNDLE_URI_DEPTH = 4;
|
|
44
|
+
|
|
45
|
+
/** Whether the bytes read as a bundle (`is_bundle`: the whole header parses). */
|
|
46
|
+
export function isBundle(bytes: Uint8Array): boolean {
|
|
47
|
+
return parseBundleHeader(bytes).ok;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* `fetch_bundle_uri_internal`: downloads `bundle`; a bundle is added to `global` (applied
|
|
52
|
+
* later), anything else is read as a bundle list and followed. True when it worked.
|
|
53
|
+
*/
|
|
54
|
+
async function fetchBundleUriInternal(
|
|
55
|
+
host: BundleUriHost,
|
|
56
|
+
bundle: RemoteBundleInfo,
|
|
57
|
+
depth: number,
|
|
58
|
+
global: BundleList,
|
|
59
|
+
): Promise<boolean> {
|
|
60
|
+
if (depth >= MAX_BUNDLE_URI_DEPTH) {
|
|
61
|
+
host.message(`warning: exceeded bundle URI recursion limit (${MAX_BUNDLE_URI_DEPTH})`);
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (bundle.uri === undefined) {
|
|
65
|
+
host.message(`error: bundle '${bundle.id}' has no uri`);
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const bytes = await host.download(bundle.uri);
|
|
69
|
+
if (bytes === undefined) {
|
|
70
|
+
bundle.file = null;
|
|
71
|
+
host.message(`warning: failed to download bundle from URI '${bundle.uri}'`);
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
bundle.file = bytes;
|
|
75
|
+
if (!isBundle(bytes)) {
|
|
76
|
+
const ok = await fetchBundleListInConfigFormat(host, global, bundle, bytes, depth);
|
|
77
|
+
if (!ok) {
|
|
78
|
+
bundle.file = null;
|
|
79
|
+
host.message(`warning: file at URI '${bundle.uri}' is not a bundle or bundle list`);
|
|
80
|
+
}
|
|
81
|
+
return ok;
|
|
82
|
+
}
|
|
83
|
+
global.add({ id: bundle.id, file: bytes, creationToken: 0n });
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** `fetch_bundle_list_in_config_format`: the downloaded list followed. */
|
|
88
|
+
async function fetchBundleListInConfigFormat(
|
|
89
|
+
host: BundleUriHost,
|
|
90
|
+
global: BundleList,
|
|
91
|
+
bundle: RemoteBundleInfo,
|
|
92
|
+
bytes: Uint8Array,
|
|
93
|
+
depth: number,
|
|
94
|
+
): Promise<boolean> {
|
|
95
|
+
const list = new BundleList();
|
|
96
|
+
const messages: string[] = [];
|
|
97
|
+
const parsed = await parseBundleListConfig(
|
|
98
|
+
bundle.uri ?? "",
|
|
99
|
+
bytes,
|
|
100
|
+
host.tempFileName?.() ?? "<bundle list>",
|
|
101
|
+
list,
|
|
102
|
+
messages,
|
|
103
|
+
);
|
|
104
|
+
for (const line of messages) host.message(line);
|
|
105
|
+
if (!parsed) return false;
|
|
106
|
+
// a creationToken list advertises bundles, not nested lists
|
|
107
|
+
if (list.heuristic === "creationToken") {
|
|
108
|
+
const ok = await fetchBundlesByToken(host, list);
|
|
109
|
+
global.heuristic = "creationToken";
|
|
110
|
+
return ok;
|
|
111
|
+
}
|
|
112
|
+
await downloadBundleList(host, list, global, depth);
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** `download_bundle_list`: each bundle of `local` fetched into `global` (one in `any` mode). */
|
|
117
|
+
async function downloadBundleList(
|
|
118
|
+
host: BundleUriHost,
|
|
119
|
+
local: BundleList,
|
|
120
|
+
global: BundleList,
|
|
121
|
+
depth: number,
|
|
122
|
+
): Promise<void> {
|
|
123
|
+
let count = 0;
|
|
124
|
+
for (const bundle of local.bundles()) {
|
|
125
|
+
if (local.mode === "any" && count > 0) continue;
|
|
126
|
+
// download_bundle_to_file recurses at ctx->depth + 1 with ctx->depth = depth + 1
|
|
127
|
+
if (await fetchBundleUriInternal(host, bundle, depth + 2, global)) count++;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* `fetch_bundles_by_token`: the bundles newest first, downloaded until one unbundles, then
|
|
133
|
+
* back towards the newest, applying each; `fetch.bundleCreationToken` stops the walk at what
|
|
134
|
+
* an earlier fetch applied, and is set to the newest token applied when the walk completes.
|
|
135
|
+
* False where git returns nonzero (the walk ran off the end of the list).
|
|
136
|
+
*/
|
|
137
|
+
async function fetchBundlesByToken(host: BundleUriHost, list: BundleList): Promise<boolean> {
|
|
138
|
+
const bundles = list.bundles();
|
|
139
|
+
if (bundles.length === 0) return true;
|
|
140
|
+
// QSORT (glibc's merge sort: stable) by creationToken, decreasing
|
|
141
|
+
bundles.sort((a, b) =>
|
|
142
|
+
a.creationToken > b.creationToken ? -1 : a.creationToken < b.creationToken ? 1 : 0,
|
|
143
|
+
);
|
|
144
|
+
let maxToken = 0n;
|
|
145
|
+
let newMaxToken = 0n;
|
|
146
|
+
const stored = host.creationToken();
|
|
147
|
+
if (stored !== undefined) {
|
|
148
|
+
const match = stored === null ? null : /^\s*(\d+)/.exec(stored);
|
|
149
|
+
maxToken = match ? BigInt(match[1] ?? "0") % (1n << 64n) : 0n;
|
|
150
|
+
if ((bundles[0]?.creationToken ?? 0n) <= maxToken) return true;
|
|
151
|
+
}
|
|
152
|
+
let cur = 0;
|
|
153
|
+
let direction = 0;
|
|
154
|
+
while (cur >= 0 && cur < bundles.length) {
|
|
155
|
+
const bundle = bundles[cur] as RemoteBundleInfo;
|
|
156
|
+
if (bundle.creationToken <= maxToken) break;
|
|
157
|
+
let skipUnbundle = false;
|
|
158
|
+
if (bundle.file === undefined) {
|
|
159
|
+
if (!(await fetchBundleUriInternal(host, bundle, 1, list))) {
|
|
160
|
+
bundle.unbundled = true;
|
|
161
|
+
direction = 1;
|
|
162
|
+
skipUnbundle = true;
|
|
163
|
+
} else if (!bundle.file || !isBundle(bundle.file)) {
|
|
164
|
+
host.message(`warning: file downloaded from '${bundle.uri}' is not a bundle`);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (!skipUnbundle && bundle.file && !bundle.unbundled) {
|
|
169
|
+
if (!(await host.unbundle(bundle.file))) {
|
|
170
|
+
direction = 1;
|
|
171
|
+
} else {
|
|
172
|
+
direction = -1;
|
|
173
|
+
bundle.unbundled = true;
|
|
174
|
+
if (bundle.creationToken > newMaxToken) newMaxToken = bundle.creationToken;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
cur += direction;
|
|
178
|
+
}
|
|
179
|
+
if (cur < 0) {
|
|
180
|
+
try {
|
|
181
|
+
await host.setCreationToken(String(newMaxToken));
|
|
182
|
+
} catch {
|
|
183
|
+
host.message("warning: failed to store maximum creation token");
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return cur < 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* `unbundle_all_bundles`: passes over the list applying what applies, until a pass applies
|
|
191
|
+
* nothing (a bundle may need another's objects first).
|
|
192
|
+
*/
|
|
193
|
+
async function unbundleAllBundles(host: BundleUriHost, list: BundleList): Promise<void> {
|
|
194
|
+
for (;;) {
|
|
195
|
+
let applied = false;
|
|
196
|
+
for (const bundle of list.bundles()) {
|
|
197
|
+
if (!bundle.file || bundle.unbundled) continue;
|
|
198
|
+
if (await host.unbundle(bundle.file)) {
|
|
199
|
+
bundle.unbundled = true;
|
|
200
|
+
applied = true;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (!applied) return;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* `fetch_bundle_uri`: the bundle (or bundle list) at `uri` downloaded and applied. An empty
|
|
210
|
+
* URI does nothing (a configured `fetch.bundleURI` turned off). `ok` false where git returns
|
|
211
|
+
* nonzero (its warnings already given); `hasHeuristic` when a list used `creationToken` (git's
|
|
212
|
+
* clone then stores the URI as `fetch.bundleURI`).
|
|
213
|
+
*/
|
|
214
|
+
export async function fetchBundleUri(
|
|
215
|
+
host: BundleUriHost,
|
|
216
|
+
uri: string,
|
|
217
|
+
): Promise<{ ok: boolean; hasHeuristic: boolean }> {
|
|
218
|
+
const list = new BundleList();
|
|
219
|
+
if (uri === "") return { ok: true, hasHeuristic: false };
|
|
220
|
+
const bundle: RemoteBundleInfo = { id: "", uri, creationToken: 0n };
|
|
221
|
+
const ok = await fetchBundleUriInternal(host, bundle, 0, list);
|
|
222
|
+
if (ok) await unbundleAllBundles(host, list);
|
|
223
|
+
return { ok, hasHeuristic: list.heuristic !== undefined };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* `fetch_bundle_list`: the list a server advertised, downloaded and applied (by token under
|
|
228
|
+
* the `creationToken` heuristic). False where git warns `failed to fetch advertised bundles`.
|
|
229
|
+
*/
|
|
230
|
+
export async function fetchBundleList(host: BundleUriHost, list: BundleList): Promise<boolean> {
|
|
231
|
+
if (list.heuristic === "creationToken") return fetchBundlesByToken(host, list);
|
|
232
|
+
const global = new BundleList();
|
|
233
|
+
await downloadBundleList(host, list, global, 0);
|
|
234
|
+
await unbundleAllBundles(host, global);
|
|
235
|
+
return true;
|
|
236
|
+
}
|