@statewalker/vcs-commands 0.9.0 → 0.10.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 +135 -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 +19 -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 +42 -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 +58 -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-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 +44 -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 +22 -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 +136 -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/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 +9 -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 +12 -0
- 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 +22 -1
- 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 +2 -1
- 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 +10 -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 +13 -1
- package/dist/commands/submodule-update-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 +110 -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-Mlo1dxQN.js} +52078 -44471
- 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-CrhVMNIH.js} +184 -143
- package/dist/git-command.d.ts +58 -2
- 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-Bw21HEkH.js +13539 -0
- package/dist/{remote-transport-CCmBadm-.js → remote-transport-Bu4PGSMD.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-ERo9vELd.js} +28511 -25685
- package/dist/transport-command.d.ts +79 -1
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +12 -12
- 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 +163 -8
- 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 +857 -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 +39 -21
- 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 +208 -7
- 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 +99 -1
- package/src/commands/diff-command.ts +573 -46
- 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 +251 -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-refresh.ts +315 -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 +45 -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 +55 -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 +684 -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 +967 -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/rev-filter/commit-grep.ts +7 -2
- package/src/commands/rev-list-command.ts +9 -0
- package/src/commands/rev-parse-command.ts +62 -4
- package/src/commands/revert-command.ts +21 -1
- package/src/commands/revision-range.ts +7 -2
- package/src/commands/revision-resolver.ts +44 -3
- 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 +122 -16
- package/src/commands/stash-apply-command.ts +3 -0
- package/src/commands/stash-export-command.ts +397 -0
- package/src/commands/status-command.ts +43 -6
- package/src/commands/stripspace-command.ts +118 -0
- package/src/commands/submodule-add-command.ts +22 -1
- package/src/commands/submodule-auth.ts +61 -6
- package/src/commands/submodule-commands.ts +12 -2
- package/src/commands/submodule-update-command.ts +29 -0
- 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 +1016 -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 +131 -1
- 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
|
@@ -33,6 +33,8 @@ import {
|
|
|
33
33
|
} from "./blame-ignore.js";
|
|
34
34
|
import { parseGitColor } from "./config-value-types.js";
|
|
35
35
|
import { abbrevLengths } from "./core-config.js";
|
|
36
|
+
import { DiffCommand } from "./diff-command.js";
|
|
37
|
+
import { type TextconvRunner, textconvRunnerOf } from "./diff-textconv.js";
|
|
36
38
|
import { localTimezoneOffset } from "./git-date.js";
|
|
37
39
|
import { hostEnvironmentOf } from "./git-ident.js";
|
|
38
40
|
import { type Mailmap, readMailmapFile, readRepositoryMailmap } from "./mailmap.js";
|
|
@@ -230,6 +232,13 @@ export interface BlameContentsOptions {
|
|
|
230
232
|
* standard input, the index entry's mode at the path, else `100644`
|
|
231
233
|
*/
|
|
232
234
|
mode?: number;
|
|
235
|
+
/**
|
|
236
|
+
* The file's bytes as read, before the clean filters made `content` of them: what a
|
|
237
|
+
* textconv converts (git converts the file as it lies, then cleans the output with the
|
|
238
|
+
* blamed path's attributes); default `content`. Standard input (`name` `-`) is never
|
|
239
|
+
* converted.
|
|
240
|
+
*/
|
|
241
|
+
file?: Uint8Array;
|
|
233
242
|
}
|
|
234
243
|
|
|
235
244
|
/** A version of the file in a commit (`struct blame_origin`) */
|
|
@@ -600,6 +609,10 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
600
609
|
/** `--reverse`: the commit whose lines are followed forward */
|
|
601
610
|
private reverseFrom?: ObjectId;
|
|
602
611
|
private firstParent = false;
|
|
612
|
+
/** `--textconv` / `--no-textconv` (git's blame converts by default) */
|
|
613
|
+
private textconv = true;
|
|
614
|
+
/** The diff command whose textconv (and its caches) blame's reads go through */
|
|
615
|
+
private textconvDiff?: DiffCommand;
|
|
603
616
|
/** The buffer blamed instead of the start commit's file (`--contents`) */
|
|
604
617
|
private contents?: { content: Uint8Array } & BlameContentsOptions;
|
|
605
618
|
/** Commits older than this (committer time, seconds) are boundaries (`--since`) */
|
|
@@ -622,11 +635,14 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
622
635
|
private finalStarts: Int32Array = new Int32Array(1);
|
|
623
636
|
private finalAlnum: Int32Array = new Int32Array(1);
|
|
624
637
|
private originSeq = 0;
|
|
625
|
-
/**
|
|
626
|
-
|
|
638
|
+
/**
|
|
639
|
+
* Files looked in for copies, interned, the most recently used last (`copySourceText`),
|
|
640
|
+
* by `copyKey`
|
|
641
|
+
*/
|
|
642
|
+
private copySources = new Map<string, InternedText>();
|
|
627
643
|
private copySourceBytes = 0;
|
|
628
644
|
/** Line hashes of the files looked in for copies (null: over the big file threshold) */
|
|
629
|
-
private copyHashes = new Map<
|
|
645
|
+
private copyHashes = new Map<string, Int32Array | null>();
|
|
630
646
|
private copyHashBytes = 0;
|
|
631
647
|
private copyHashCacheBytes = COPY_HASH_CACHE_BYTES;
|
|
632
648
|
private copySourceCacheBytes = COPY_SOURCE_CACHE_BYTES;
|
|
@@ -848,6 +864,19 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
848
864
|
return this;
|
|
849
865
|
}
|
|
850
866
|
|
|
867
|
+
/**
|
|
868
|
+
* `--textconv` (the default) / `--no-textconv`: every version of a regular file is read
|
|
869
|
+
* through its `diff.<driver>.textconv` (blame.c's textconv_object, with the runner the
|
|
870
|
+
* host installed, `installTextconvRunner`), a blob through the driver's notes cache
|
|
871
|
+
* (`diff.<driver>.cachetextconv`); the `--contents` file too, unless read from standard
|
|
872
|
+
* input, without the cache.
|
|
873
|
+
*/
|
|
874
|
+
setTextconv(on: boolean): this {
|
|
875
|
+
this.checkCallable();
|
|
876
|
+
this.textconv = on;
|
|
877
|
+
return this;
|
|
878
|
+
}
|
|
879
|
+
|
|
851
880
|
/**
|
|
852
881
|
* Stop at commits older than `timestamp` (seconds, committer time; `--since`): they and
|
|
853
882
|
* their ancestors are boundaries, as git's `revs->max_age`
|
|
@@ -979,7 +1008,7 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
979
1008
|
const finalOrigin = this.getOrigin(startId, resultPath);
|
|
980
1009
|
finalOrigin.blobId = entry.id;
|
|
981
1010
|
finalOrigin.mode = entry.mode;
|
|
982
|
-
const content = await this.
|
|
1011
|
+
const content = await this.originBlob(entry.id, resultPath, entry.mode);
|
|
983
1012
|
finalOrigin.lines = this.lineInterner().text(content);
|
|
984
1013
|
const lineCount = countLines(content);
|
|
985
1014
|
if (this.detectMoves || this.copyLevel > 0) this.prepareLines(content, lineCount);
|
|
@@ -1403,11 +1432,12 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
1403
1432
|
? "standard input"
|
|
1404
1433
|
: contents.name;
|
|
1405
1434
|
const id = this.objectFormat.nullId;
|
|
1406
|
-
const blobId = await computeObjectId("blob", contents.content, this.objectFormat);
|
|
1407
|
-
this.pretend.set(blobId, contents.content);
|
|
1408
1435
|
// without a mode (standard input): the index's stage-0 entry's, else a regular file's
|
|
1409
1436
|
const staged = index.find((e) => e.path === path && e.stage === 0);
|
|
1410
1437
|
const mode = contents.mode ?? staged?.mode ?? 0o100644;
|
|
1438
|
+
const content = (await this.textconvContents(contents, path, mode)) ?? contents.content;
|
|
1439
|
+
const blobId = await computeObjectId("blob", content, this.objectFormat);
|
|
1440
|
+
this.pretend.set(blobId, content);
|
|
1411
1441
|
this.fakeEntry = { id: blobId, mode };
|
|
1412
1442
|
// the index with the path replaced: what git diffs the parents against (do_diff_cache)
|
|
1413
1443
|
const files = new Map<string, { id: ObjectId; mode: number }>();
|
|
@@ -1760,15 +1790,16 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
1760
1790
|
for (const c of candidates) {
|
|
1761
1791
|
// find_move already dealt with this path
|
|
1762
1792
|
if (porigin && c.path === porigin.path) continue;
|
|
1763
|
-
|
|
1793
|
+
const key = this.copyKey(c);
|
|
1794
|
+
let hashes = this.copyHashes.get(key);
|
|
1764
1795
|
let content: Uint8Array | undefined;
|
|
1765
1796
|
if (hashes === undefined) {
|
|
1766
1797
|
if (c.id !== target.blobId && (await this.isBig(c.id))) hashes = null;
|
|
1767
1798
|
else {
|
|
1768
|
-
content = await this.
|
|
1799
|
+
content = await this.originBlob(c.id, c.path, c.mode, true);
|
|
1769
1800
|
hashes = this.lineHashesOf(content);
|
|
1770
1801
|
}
|
|
1771
|
-
this.keepCopyHashes(
|
|
1802
|
+
this.keepCopyHashes(key, hashes);
|
|
1772
1803
|
}
|
|
1773
1804
|
if (hashes === null) continue;
|
|
1774
1805
|
if (!sharesLine(hashes, wanted)) {
|
|
@@ -1785,13 +1816,15 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
1785
1816
|
const file = {
|
|
1786
1817
|
text:
|
|
1787
1818
|
norigin.lines ??
|
|
1788
|
-
this.copySources.get(
|
|
1789
|
-
this.lineInterner().text(
|
|
1819
|
+
this.copySources.get(key) ??
|
|
1820
|
+
this.lineInterner().text(
|
|
1821
|
+
content ?? (await this.originBlob(c.id, c.path, c.mode, true)),
|
|
1822
|
+
),
|
|
1790
1823
|
};
|
|
1791
1824
|
for (const item of list) {
|
|
1792
1825
|
this.copySplitIfBetter(item.split, this.findCopyInBlob(item.ent, norigin, file));
|
|
1793
1826
|
}
|
|
1794
|
-
this.keepCopySourceText(
|
|
1827
|
+
this.keepCopySourceText(key, file.text);
|
|
1795
1828
|
}
|
|
1796
1829
|
for (const { ent, split } of list) {
|
|
1797
1830
|
if (split[1].suspect && this.copyScore < this.entryScore(split[1].lno, split[1].numLines)) {
|
|
@@ -1830,22 +1863,22 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
1830
1863
|
* the order the next one scans them, so evicting the oldest would evict every file before
|
|
1831
1864
|
* its next use
|
|
1832
1865
|
*/
|
|
1833
|
-
private keepCopyHashes(
|
|
1866
|
+
private keepCopyHashes(key: string, hashes: Int32Array | null): void {
|
|
1834
1867
|
const size = 64 + (hashes ? hashes.byteLength : 0);
|
|
1835
1868
|
if (this.copyHashBytes + size > this.copyHashCacheBytes) return;
|
|
1836
|
-
this.copyHashes.set(
|
|
1869
|
+
this.copyHashes.set(key, hashes);
|
|
1837
1870
|
this.copyHashBytes += size;
|
|
1838
1871
|
}
|
|
1839
1872
|
|
|
1840
1873
|
/** A file a copy was looked for in, interned, kept as `keepCopyHashes` keeps hashes */
|
|
1841
|
-
private keepCopySourceText(
|
|
1842
|
-
const old = this.copySources.get(
|
|
1874
|
+
private keepCopySourceText(key: string, text: InternedText): void {
|
|
1875
|
+
const old = this.copySources.get(key);
|
|
1843
1876
|
if (old) {
|
|
1844
|
-
this.copySources.set(
|
|
1877
|
+
this.copySources.set(key, text);
|
|
1845
1878
|
return;
|
|
1846
1879
|
}
|
|
1847
1880
|
if (this.copySourceBytes + text.content.length > this.copySourceCacheBytes) return;
|
|
1848
|
-
this.copySources.set(
|
|
1881
|
+
this.copySources.set(key, text);
|
|
1849
1882
|
this.copySourceBytes += text.content.length;
|
|
1850
1883
|
}
|
|
1851
1884
|
|
|
@@ -2107,7 +2140,7 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
2107
2140
|
}
|
|
2108
2141
|
|
|
2109
2142
|
private async originContent(o: Origin): Promise<InternedText> {
|
|
2110
|
-
o.lines ??= this.lineInterner().text(await this.
|
|
2143
|
+
o.lines ??= this.lineInterner().text(await this.originBlob(o.blobId, o.path, o.mode, true));
|
|
2111
2144
|
return o.lines;
|
|
2112
2145
|
}
|
|
2113
2146
|
|
|
@@ -2136,6 +2169,72 @@ export class BlameCommand extends GitCommand<BlameResult> {
|
|
|
2136
2169
|
return pretended ? pretended.length : this.blobs.size(blobId);
|
|
2137
2170
|
}
|
|
2138
2171
|
|
|
2172
|
+
/** The textconv runner blame reads through, if textconv is on and the host installed one */
|
|
2173
|
+
private textconvRunner(): TextconvRunner | undefined {
|
|
2174
|
+
return this.textconv ? textconvRunnerOf(this._workingCopy) : undefined;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
private textconvDiffCommand(): DiffCommand {
|
|
2178
|
+
this.textconvDiff ??= new DiffCommand(this._workingCopy);
|
|
2179
|
+
return this.textconvDiff;
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
/**
|
|
2183
|
+
* The key of a file looked in for copies: its blob, and with textconv its path and mode
|
|
2184
|
+
* too (the path's driver decides the converted content)
|
|
2185
|
+
*/
|
|
2186
|
+
private copyKey(c: { id: ObjectId; path: string; mode: number }): string {
|
|
2187
|
+
return this.textconvRunner() ? `${c.id}\0${c.path}\0${c.mode}` : c.id;
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* blame.c's fill_origin_blob: a version of the file as blame compares it, the blob
|
|
2192
|
+
* through the path's textconv (textconv_object, the driver's cache keyed by the blob)
|
|
2193
|
+
* when one applies; the `--contents` buffer as it was made
|
|
2194
|
+
*/
|
|
2195
|
+
private async originBlob(
|
|
2196
|
+
blobId: ObjectId,
|
|
2197
|
+
path: string,
|
|
2198
|
+
mode: number,
|
|
2199
|
+
shared = false,
|
|
2200
|
+
): Promise<Uint8Array> {
|
|
2201
|
+
if (this.pretend.has(blobId) || !this.textconvRunner()) return this.readBlob(blobId, shared);
|
|
2202
|
+
let raw: Uint8Array | undefined;
|
|
2203
|
+
const read = async () => {
|
|
2204
|
+
raw ??= await this.readBlob(blobId, shared);
|
|
2205
|
+
return raw;
|
|
2206
|
+
};
|
|
2207
|
+
const converted = await this.textconvDiffCommand().textconvBlob(path, mode, read, blobId);
|
|
2208
|
+
return converted ?? read();
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* fake_working_tree_commit's textconv: the `--contents` file (the working tree's at
|
|
2213
|
+
* `path`, or the named one; never standard input) through its textconv, the output then
|
|
2214
|
+
* cleaned as git's convert_to_git cleans it for `path`; undefined when none applies
|
|
2215
|
+
*/
|
|
2216
|
+
private async textconvContents(
|
|
2217
|
+
contents: { content: Uint8Array } & BlameContentsOptions,
|
|
2218
|
+
path: string,
|
|
2219
|
+
mode: number,
|
|
2220
|
+
): Promise<Uint8Array | undefined> {
|
|
2221
|
+
if (!this.textconvRunner()) return undefined;
|
|
2222
|
+
const from = contents.workingTree ? path : contents.name;
|
|
2223
|
+
if (from === undefined || from === "-") return undefined;
|
|
2224
|
+
const file = contents.file ?? contents.content;
|
|
2225
|
+
const converted = await this.textconvDiffCommand().textconvBlob(
|
|
2226
|
+
from,
|
|
2227
|
+
mode,
|
|
2228
|
+
async () => file,
|
|
2229
|
+
undefined,
|
|
2230
|
+
{ worktreeFile: true },
|
|
2231
|
+
);
|
|
2232
|
+
if (!converted) return undefined;
|
|
2233
|
+
const worktree = "worktree" in this._workingCopy ? this.worktreeAccess : undefined;
|
|
2234
|
+
const conversion = await worktree?.contentFilter?.checkin(path);
|
|
2235
|
+
return conversion ? conversion.apply(converted) : converted;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2139
2238
|
/**
|
|
2140
2239
|
* A blob's content; `shared` (for content only read here) takes a single chunk as it
|
|
2141
2240
|
* comes (a resolved pack object) instead of copying it
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `git bundle create` (bundle.c's `create_bundle`): the commits the rev-list arguments name,
|
|
3
|
+
* their objects in a pack, behind a header listing the refs named and the boundary commits
|
|
4
|
+
* the pack needs.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // git bundle create repo.bundle --all
|
|
9
|
+
* const { bundle } = await git.bundleCreate().addArgument("--all").call();
|
|
10
|
+
* // git bundle create --version=3 incr.bundle v1..main
|
|
11
|
+
* await git.bundleCreate().setVersion(3).addArgument("v1..main").call();
|
|
12
|
+
* // echo main | git bundle create stdin.bundle --stdin
|
|
13
|
+
* await git.bundleCreate().addArgument("--stdin").setStdin("main\n").call();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
historyWithoutLazyFetch,
|
|
19
|
+
ObjectFilterError,
|
|
20
|
+
type ObjectId,
|
|
21
|
+
parseObjectFilter,
|
|
22
|
+
} from "@statewalker/vcs-core";
|
|
23
|
+
import { createRepositoryFacade } from "@statewalker/vcs-transport";
|
|
24
|
+
|
|
25
|
+
import { GitApiError, RevisionError } from "../../errors/index.js";
|
|
26
|
+
import { GitCommand } from "../../git-command.js";
|
|
27
|
+
import { approxidateCareful } from "../git-date.js";
|
|
28
|
+
import { RevListCommand } from "../rev-list-command.js";
|
|
29
|
+
import { unknownRevisionMessage } from "../revision-range.js";
|
|
30
|
+
import { commitSubject } from "../shortlog.js";
|
|
31
|
+
import {
|
|
32
|
+
type BundleHeader,
|
|
33
|
+
type BundlePrerequisite,
|
|
34
|
+
type BundleRef,
|
|
35
|
+
encodeBundleHeader,
|
|
36
|
+
} from "./bundle-format.js";
|
|
37
|
+
import type { BundleCommandResult } from "./bundle-verify.js";
|
|
38
|
+
|
|
39
|
+
/** What {@link BundleCreateCommand} made. */
|
|
40
|
+
export interface BundleCreateResult extends BundleCommandResult {
|
|
41
|
+
/** The bundle's bytes (header and pack); undefined when git dies or fails */
|
|
42
|
+
bundle?: Uint8Array;
|
|
43
|
+
/** Its header */
|
|
44
|
+
header?: BundleHeader;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const USAGE = [
|
|
48
|
+
"usage: git bundle create [-q | --quiet | --progress]",
|
|
49
|
+
" [--version=<version>] <file> <git-rev-list-args>",
|
|
50
|
+
].join("\n");
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* `git bundle create [--version=<n>] <file> <git-rev-list-args>`: the arguments are read as
|
|
54
|
+
* `setup_revisions` reads them (revisions, ranges, `--all`, `--branches`, `--tags`, `--not`,
|
|
55
|
+
* `--stdin`, `--ignore-missing`, `-<n>`/`-n`/`--max-count`, `--since`/`--after`,
|
|
56
|
+
* `--until`/`--before`, `--first-parent`, `--no-merges`, `--objects`, `--filter=<spec>`), the
|
|
57
|
+
* walk lists the commits and its boundary (`-<id> <subject>` lines, the pack's thin bases), each
|
|
58
|
+
* positive argument naming exactly one ref becomes a ref line (`HEAD` named as such, a branch by
|
|
59
|
+
* its full name; a commit the rev-list options left out is skipped with git's warning, a tag
|
|
60
|
+
* outside `--since`/`--until` dropped), and the pack holds what the positive arguments reach
|
|
61
|
+
* but the boundary and negative ones do not. Without refs git refuses (`Refusing to create
|
|
62
|
+
* empty bundle.`, exit 128).
|
|
63
|
+
*
|
|
64
|
+
* The version is 2 unless `setVersion(3)`, a SHA-256 repository or a filter asks for 3
|
|
65
|
+
* (`@object-format=`, `@filter=`). The bundle is returned (`result.bundle`); writing it (git's
|
|
66
|
+
* lock file, `-` for stdout) is the caller's. Progress (`--progress`, `-q`) is not printed.
|
|
67
|
+
*/
|
|
68
|
+
export class BundleCreateCommand extends GitCommand<BundleCreateResult> {
|
|
69
|
+
private version?: number;
|
|
70
|
+
private readonly args: string[] = [];
|
|
71
|
+
private stdin?: string;
|
|
72
|
+
private compatibility?: "2.43" | "2.56";
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The git version to follow (default: the hook runner's, else 2.56): 2.43 drops only later
|
|
76
|
+
* arguments naming the same object by the same name (`object_array_remove_duplicates`), so
|
|
77
|
+
* `--all main` lists refs/heads/main twice; 2.56 writes each ref once.
|
|
78
|
+
*/
|
|
79
|
+
setCompatibility(version: "2.43" | "2.56"): this {
|
|
80
|
+
this.checkCallable();
|
|
81
|
+
this.compatibility = version;
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** `--version=<n>`: 2 or 3; git refuses other numbers and 2 for a SHA-256 repository. */
|
|
86
|
+
setVersion(version: number): this {
|
|
87
|
+
this.checkCallable();
|
|
88
|
+
this.version = version;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** One of `<git-rev-list-args>`, as on git's command line. */
|
|
93
|
+
addArgument(arg: string): this {
|
|
94
|
+
this.checkCallable();
|
|
95
|
+
this.args.push(arg);
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** What `--stdin` reads (git's standard input). */
|
|
100
|
+
setStdin(text: string): this {
|
|
101
|
+
this.checkCallable();
|
|
102
|
+
this.stdin = text;
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async call(): Promise<BundleCreateResult> {
|
|
107
|
+
this.checkCallable();
|
|
108
|
+
this.setCallable(false);
|
|
109
|
+
let stderr = "";
|
|
110
|
+
const revList = new RevListCommand(this._workingCopy).setCommittish(false).setBoundary(true);
|
|
111
|
+
let filter: string | undefined;
|
|
112
|
+
let ignoreMissing = false;
|
|
113
|
+
const revisions: (string | { stdin: string })[] = [];
|
|
114
|
+
const args = this.args;
|
|
115
|
+
const takeValue = (i: number, name: string): string => {
|
|
116
|
+
const value = args[i + 1];
|
|
117
|
+
if (value === undefined) {
|
|
118
|
+
throw new GitApiError(`fatal: Option '--${name}' requires a value`, { exitCode: 128 });
|
|
119
|
+
}
|
|
120
|
+
return value;
|
|
121
|
+
};
|
|
122
|
+
const maxCount = (value: string) => {
|
|
123
|
+
if (!/^-?\d+$/.test(value)) {
|
|
124
|
+
throw new GitApiError(`fatal: '${value}': not an integer`, { exitCode: 128 });
|
|
125
|
+
}
|
|
126
|
+
revList.setMaxCount(Number.parseInt(value, 10));
|
|
127
|
+
};
|
|
128
|
+
const date = (value: string) => approxidateCareful(value).timestamp;
|
|
129
|
+
let sinceTime: number | undefined;
|
|
130
|
+
let untilTime: number | undefined;
|
|
131
|
+
let endOfOptions = false;
|
|
132
|
+
/** setup_revisions leaves an option it does not know in argv: git's error after the walk setup */
|
|
133
|
+
let unrecognized: string | undefined;
|
|
134
|
+
for (let i = 0; i < args.length; i++) {
|
|
135
|
+
const arg = args[i] as string;
|
|
136
|
+
if (endOfOptions || !arg.startsWith("-") || arg === "-" || arg.startsWith("^")) {
|
|
137
|
+
revisions.push(arg);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
/** The groups of the last pattern {@link take} matched */
|
|
141
|
+
let m: string[] = [];
|
|
142
|
+
const take = (re: RegExp): boolean => {
|
|
143
|
+
const found = re.exec(arg);
|
|
144
|
+
m = found ? [...found] : [];
|
|
145
|
+
return found !== null;
|
|
146
|
+
};
|
|
147
|
+
if (arg === "--end-of-options") {
|
|
148
|
+
endOfOptions = true;
|
|
149
|
+
revisions.push(arg);
|
|
150
|
+
} else if (
|
|
151
|
+
arg === "--not" ||
|
|
152
|
+
arg === "--all" ||
|
|
153
|
+
/^--(branches|tags|remotes)(=|$)/.test(arg)
|
|
154
|
+
) {
|
|
155
|
+
revisions.push(arg);
|
|
156
|
+
} else if (/^--(glob|exclude)=/.test(arg)) {
|
|
157
|
+
revisions.push(arg);
|
|
158
|
+
} else if (arg === "--glob" || arg === "--exclude") {
|
|
159
|
+
revisions.push(`${arg}=${takeValue(i, arg.slice(2))}`);
|
|
160
|
+
i++;
|
|
161
|
+
} else if (arg === "--stdin") {
|
|
162
|
+
revisions.push({ stdin: this.stdin ?? "" });
|
|
163
|
+
} else if (arg === "--ignore-missing") {
|
|
164
|
+
ignoreMissing = true;
|
|
165
|
+
} else if (take(/^--max-count=(.*)$/s)) {
|
|
166
|
+
maxCount(m[1] as string);
|
|
167
|
+
} else if (arg === "--max-count" || arg === "-n") {
|
|
168
|
+
maxCount(takeValue(i, "max-count"));
|
|
169
|
+
i++;
|
|
170
|
+
} else if (take(/^-n(\d+)$/) || take(/^-(\d+)$/)) {
|
|
171
|
+
maxCount(m[1] as string);
|
|
172
|
+
} else if (take(/^--(since|after|until|before)=(.*)$/s)) {
|
|
173
|
+
if (m[1] === "since" || m[1] === "after") sinceTime = date(m[2] as string);
|
|
174
|
+
else untilTime = date(m[2] as string);
|
|
175
|
+
} else if (take(/^--(since|after|until|before)$/)) {
|
|
176
|
+
const value = takeValue(i, m[1] as string);
|
|
177
|
+
i++;
|
|
178
|
+
if (m[1] === "since" || m[1] === "after") sinceTime = date(value);
|
|
179
|
+
else untilTime = date(value);
|
|
180
|
+
} else if (take(/^--max-age=(\d+)$/)) {
|
|
181
|
+
sinceTime = Number(m[1]);
|
|
182
|
+
} else if (take(/^--min-age=(\d+)$/)) {
|
|
183
|
+
untilTime = Number(m[1]);
|
|
184
|
+
} else if (take(/^--filter=(.*)$/s)) {
|
|
185
|
+
try {
|
|
186
|
+
const parsed = parseObjectFilter(m[1] as string);
|
|
187
|
+
// expand_list_objects_filter_spec: a blob limit in bytes
|
|
188
|
+
filter = parsed.choice === "blob:limit" ? `blob:limit=${parsed.limit}` : (m[1] as string);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
if (error instanceof ObjectFilterError) {
|
|
191
|
+
throw new GitApiError(`fatal: ${error.message}`, { exitCode: 128 });
|
|
192
|
+
}
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
} else if (arg === "--no-filter") {
|
|
196
|
+
filter = undefined;
|
|
197
|
+
} else if (arg === "--objects" || arg === "--objects-edge" || arg === "--quiet") {
|
|
198
|
+
// the pack lists objects anyway
|
|
199
|
+
} else if (arg === "--first-parent") {
|
|
200
|
+
revList.setFirstParent(true);
|
|
201
|
+
} else if (arg === "--no-merges") {
|
|
202
|
+
revList.setNoMerges(true);
|
|
203
|
+
} else if (arg === "--topo-order" || arg === "--date-order") {
|
|
204
|
+
revList.setOrder(arg === "--topo-order" ? "topo" : "date");
|
|
205
|
+
} else if (arg === "--boundary") {
|
|
206
|
+
// the walk lists its boundary anyway
|
|
207
|
+
} else if (arg === "--") {
|
|
208
|
+
break;
|
|
209
|
+
} else unrecognized ??= arg;
|
|
210
|
+
}
|
|
211
|
+
if (sinceTime !== undefined) revList.setSince(sinceTime);
|
|
212
|
+
if (untilTime !== undefined) revList.setUntil(untilTime);
|
|
213
|
+
|
|
214
|
+
// setup_revisions: the pending objects in order, with the names they were given
|
|
215
|
+
for (const revision of revisions) {
|
|
216
|
+
if (typeof revision === "string") revList.addRevision(revision);
|
|
217
|
+
else revList.addStdin(revision.stdin);
|
|
218
|
+
}
|
|
219
|
+
revList.setIgnoreMissing(ignoreMissing);
|
|
220
|
+
let entries: readonly { id: ObjectId; exclude: boolean; name?: string }[];
|
|
221
|
+
try {
|
|
222
|
+
entries = (await revList.resolve()).entries;
|
|
223
|
+
} catch (error) {
|
|
224
|
+
// a plain argument naming nothing: setup_revisions takes it for a path (none exists)
|
|
225
|
+
if (
|
|
226
|
+
error instanceof RevisionError &&
|
|
227
|
+
typeof error.revision === "string" &&
|
|
228
|
+
!error.revision.startsWith("^") &&
|
|
229
|
+
!error.revision.startsWith("-") &&
|
|
230
|
+
!error.revision.includes("..") &&
|
|
231
|
+
error.message.endsWith(`fatal: bad revision '${error.revision}'`) &&
|
|
232
|
+
revisions.includes(error.revision)
|
|
233
|
+
) {
|
|
234
|
+
throw new RevisionError(error.revision, unknownRevisionMessage(error.revision));
|
|
235
|
+
}
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
if (unrecognized !== undefined) {
|
|
239
|
+
return { exitCode: 1, stdout: "", stderr: `error: unrecognized argument: ${unrecognized}\n` };
|
|
240
|
+
}
|
|
241
|
+
const format = this.objectFormat;
|
|
242
|
+
const minVersion = format.name !== "sha1" || filter !== undefined ? 3 : 2;
|
|
243
|
+
const version = this.version ?? minVersion;
|
|
244
|
+
if (version < 2 || version > 3) {
|
|
245
|
+
throw new GitApiError(`fatal: unsupported bundle version ${version}`, { exitCode: 128 });
|
|
246
|
+
}
|
|
247
|
+
if (version < minVersion) {
|
|
248
|
+
throw new GitApiError(
|
|
249
|
+
`fatal: cannot write bundle version ${version} with algorithm ${format.name}`,
|
|
250
|
+
{ exitCode: 128 },
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// the walk (revs.boundary): the commits shown, then the boundary
|
|
255
|
+
const shown = new Set<ObjectId>();
|
|
256
|
+
const prerequisites: BundlePrerequisite[] = [];
|
|
257
|
+
const boundary: ObjectId[] = [];
|
|
258
|
+
for await (const commit of await revList.call()) {
|
|
259
|
+
if (commit.boundary) {
|
|
260
|
+
// write_bundle_prerequisites: `-<id> <oneline subject>`
|
|
261
|
+
prerequisites.push({ id: commit.id, comment: commitSubject(commit.message).trim() });
|
|
262
|
+
boundary.push(commit.id);
|
|
263
|
+
} else shown.add(commit.id);
|
|
264
|
+
}
|
|
265
|
+
stderr += revList
|
|
266
|
+
.getWarnings()
|
|
267
|
+
.map((w) => `${w}\n`)
|
|
268
|
+
.join("");
|
|
269
|
+
|
|
270
|
+
// write_bundle_refs over the pending objects
|
|
271
|
+
const resolver = this.revisionResolver();
|
|
272
|
+
const refs = this.refsStore;
|
|
273
|
+
const references: BundleRef[] = [];
|
|
274
|
+
const written = new Set<string>();
|
|
275
|
+
const wants: ObjectId[] = [];
|
|
276
|
+
const haves: ObjectId[] = [];
|
|
277
|
+
const uninteresting = new Set<number>();
|
|
278
|
+
const compatibility = this.compatibility ?? this.hooks.compatibility;
|
|
279
|
+
if (compatibility === "2.43") {
|
|
280
|
+
// object_array_remove_duplicates: the first entry of each object and name
|
|
281
|
+
const seen = new Set<string>();
|
|
282
|
+
entries = entries.filter((e) => {
|
|
283
|
+
const key = `${e.id}\0${e.name ?? ""}`;
|
|
284
|
+
if (seen.has(key)) return false;
|
|
285
|
+
seen.add(key);
|
|
286
|
+
return true;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
// the commits the walk marked UNINTERESTING: reachable from an excluded commit
|
|
290
|
+
const excludedCommits: ObjectId[] = [];
|
|
291
|
+
for (const entry of entries) {
|
|
292
|
+
if (!entry.exclude) continue;
|
|
293
|
+
const peeled = await resolver.peelTags(entry.id).catch(() => undefined);
|
|
294
|
+
if (peeled?.type === "commit") excludedCommits.push(peeled.id);
|
|
295
|
+
}
|
|
296
|
+
const commits = this.walkCommits;
|
|
297
|
+
const uninterestingCommit = async (id: ObjectId) => {
|
|
298
|
+
for (const excluded of excludedCommits) {
|
|
299
|
+
if (excluded === id) return true;
|
|
300
|
+
if (await commits.isAncestor(id, excluded).catch(() => false)) return true;
|
|
301
|
+
}
|
|
302
|
+
return false;
|
|
303
|
+
};
|
|
304
|
+
for (const [index, entry] of entries.entries()) {
|
|
305
|
+
if (entry.exclude) continue;
|
|
306
|
+
const name = entry.name;
|
|
307
|
+
if (name === undefined) continue;
|
|
308
|
+
const commitItem = (await this.objectTypeOf(entry.id)) === "commit";
|
|
309
|
+
if (commitItem && !shown.has(entry.id) && (await uninterestingCommit(entry.id))) continue;
|
|
310
|
+
const found = await resolver.dwimRef(name).catch(() => []);
|
|
311
|
+
if (found.length !== 1) continue;
|
|
312
|
+
const literal = await refs.get(name).catch(() => undefined);
|
|
313
|
+
const symbolic = literal !== undefined && "target" in literal;
|
|
314
|
+
const display = symbolic ? name : (found[0] as { ref: string }).ref;
|
|
315
|
+
if (compatibility !== "2.43" && written.has(display)) continue;
|
|
316
|
+
const objectType = await this.objectTypeOf(entry.id);
|
|
317
|
+
if (objectType === "tag" && !(await this.tagInDateRange(entry.id, sinceTime, untilTime))) {
|
|
318
|
+
uninteresting.add(index);
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
if (objectType === "commit" && !shown.has(entry.id)) {
|
|
322
|
+
stderr += `warning: ref '${name}' is excluded by the rev-list options\n`;
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
written.add(display);
|
|
326
|
+
references.push({ id: entry.id, name: display });
|
|
327
|
+
}
|
|
328
|
+
if (references.length === 0) {
|
|
329
|
+
throw new GitApiError(`${stderr}fatal: Refusing to create empty bundle.`, {
|
|
330
|
+
exitCode: 128,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
for (const [index, entry] of entries.entries()) {
|
|
334
|
+
if (!entry.exclude && !uninteresting.has(index)) {
|
|
335
|
+
wants.push(entry.id);
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
// pack-objects' `^<id>`: a tag excludes what it points at too
|
|
339
|
+
haves.push(entry.id);
|
|
340
|
+
const peeled = await resolver.peelTags(entry.id).catch(() => undefined);
|
|
341
|
+
if (peeled && peeled.id !== entry.id) haves.push(peeled.id);
|
|
342
|
+
}
|
|
343
|
+
haves.push(...boundary);
|
|
344
|
+
|
|
345
|
+
const header: BundleHeader = {
|
|
346
|
+
version: version as 2 | 3,
|
|
347
|
+
objectFormat: format,
|
|
348
|
+
...(version === 3 && filter !== undefined ? { filter } : {}),
|
|
349
|
+
prerequisites,
|
|
350
|
+
references,
|
|
351
|
+
};
|
|
352
|
+
// write_pack_data: pack-objects --thin --delta-base-offset over the pending objects
|
|
353
|
+
const facade = createRepositoryFacade({
|
|
354
|
+
history: historyWithoutLazyFetch(this._workingCopy.history),
|
|
355
|
+
});
|
|
356
|
+
const chunks: Uint8Array[] = [encodeBundleHeader(header)];
|
|
357
|
+
for await (const chunk of facade.exportPack(new Set(wants), new Set(haves), {
|
|
358
|
+
thin: true,
|
|
359
|
+
ofsDelta: true,
|
|
360
|
+
...(filter !== undefined ? { filterSpec: filter } : {}),
|
|
361
|
+
})) {
|
|
362
|
+
chunks.push(chunk);
|
|
363
|
+
}
|
|
364
|
+
return { exitCode: 0, stdout: "", stderr, bundle: concat(chunks), header };
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** The type of the object `id` names. */
|
|
368
|
+
private async objectTypeOf(id: ObjectId): Promise<string | undefined> {
|
|
369
|
+
const peeled = await this.revisionResolver()
|
|
370
|
+
.peelTags(id)
|
|
371
|
+
.catch(() => undefined);
|
|
372
|
+
if (peeled === undefined) return undefined;
|
|
373
|
+
return peeled.id === id ? peeled.type : "tag";
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/** bundle.c's `is_tag_in_date_range`: the tagger's date within `--since`/`--until`. */
|
|
377
|
+
private async tagInDateRange(
|
|
378
|
+
id: ObjectId,
|
|
379
|
+
since: number | undefined,
|
|
380
|
+
until: number | undefined,
|
|
381
|
+
): Promise<boolean> {
|
|
382
|
+
if (since === undefined && until === undefined) return true;
|
|
383
|
+
const tag = await this.tagsStore?.load(id).catch(() => undefined);
|
|
384
|
+
const date = tag?.tagger?.timestamp;
|
|
385
|
+
if (date === undefined) return true;
|
|
386
|
+
return (since === undefined || since < date) && (until === undefined || until > date);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** The usage text git prints for a bad option (exit 129). */
|
|
390
|
+
static usage(): string {
|
|
391
|
+
return USAGE;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function concat(chunks: Uint8Array[]): Uint8Array {
|
|
396
|
+
let length = 0;
|
|
397
|
+
for (const c of chunks) length += c.length;
|
|
398
|
+
const out = new Uint8Array(length);
|
|
399
|
+
let at = 0;
|
|
400
|
+
for (const c of chunks) {
|
|
401
|
+
out.set(c, at);
|
|
402
|
+
at += c.length;
|
|
403
|
+
}
|
|
404
|
+
return out;
|
|
405
|
+
}
|