@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
|
@@ -315,7 +315,7 @@ export class ShowCommand extends GitCommand<ShowResult> {
|
|
|
315
315
|
const where = await this.blobPath(name);
|
|
316
316
|
if (where) {
|
|
317
317
|
const diff = new DiffCommand(this._workingCopy).setOptions(this.diffOptions);
|
|
318
|
-
const converted = await diff.textconvBlob(where.path, where.mode, read);
|
|
318
|
+
const converted = await diff.textconvBlob(where.path, where.mode, read, id);
|
|
319
319
|
if (converted) return converted;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `git show-ref` (builtin/show-ref.c): the refs and their ids, matched by patterns, checked by
|
|
3
|
+
* exact name (`--verify`), tested for existence (`--exists`), or the lines of a remote's
|
|
4
|
+
* listing the repository lacks (`--exclude-existing`).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // git show-ref --tags -d
|
|
9
|
+
* const { stdout } = await git.showRef().setTags(true).setDereference(true).callOutput();
|
|
10
|
+
* // git show-ref --verify -q refs/heads/main
|
|
11
|
+
* const { exitCode } = await git.showRef().setVerify(true).setQuiet(true).addPattern("refs/heads/main").call();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
compareRefNames,
|
|
17
|
+
isSymbolicRef,
|
|
18
|
+
isValidRefName,
|
|
19
|
+
type ObjectId,
|
|
20
|
+
} from "@statewalker/vcs-core";
|
|
21
|
+
|
|
22
|
+
import { RemoteConfigStore } from "../remote-config/index.js";
|
|
23
|
+
import { PlumbingCommand, PlumbingError } from "./plumbing-command.js";
|
|
24
|
+
|
|
25
|
+
/** git's MINIMUM_ABBREV */
|
|
26
|
+
const MINIMUM_ABBREV = 4;
|
|
27
|
+
/** DEFAULT_ABBREV: the automatic length (`core.abbrev`) */
|
|
28
|
+
const DEFAULT_ABBREV = -1;
|
|
29
|
+
|
|
30
|
+
/** A listed ref and the id it resolves to. */
|
|
31
|
+
interface ListedRef {
|
|
32
|
+
name: string;
|
|
33
|
+
id: ObjectId;
|
|
34
|
+
/** What packed-refs says it peels to */
|
|
35
|
+
peeled?: ObjectId;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* `git show-ref`. Results are git's stdout ({@link setStdout}, {@link callOutput}), stderr
|
|
40
|
+
* and exit status: 1 when no ref matched (or `--verify -q` missed), 2 for `--exists` of a
|
|
41
|
+
* missing ref; deaths (`fatal:` lines, exit 128) are thrown as {@link PlumbingError}.
|
|
42
|
+
*
|
|
43
|
+
* Version differences (`setCompatibility`): the refusal of two sub-modes at once is 2.43's
|
|
44
|
+
* `only one of ... can be given`, 2.5x's `options ... cannot be used together`; 2.43's
|
|
45
|
+
* `--verify` reads only `refs/...` and HEAD (2.5x also other uppercase names, `ORIG_HEAD`); 2.43's `--exists`
|
|
46
|
+
* of a missing FETCH_HEAD or MERGE_HEAD says `failed to look up reference: Success` (exit 1).
|
|
47
|
+
* `--branches` is 2.46's name of `--heads` (both are {@link setBranches}).
|
|
48
|
+
*/
|
|
49
|
+
export class ShowRefCommand extends PlumbingCommand {
|
|
50
|
+
private readonly patterns: string[] = [];
|
|
51
|
+
private head = false;
|
|
52
|
+
private branches = false;
|
|
53
|
+
private tags = false;
|
|
54
|
+
private deref = false;
|
|
55
|
+
private hashOnly = false;
|
|
56
|
+
private abbrev = 0;
|
|
57
|
+
private quiet = false;
|
|
58
|
+
private verify = false;
|
|
59
|
+
private exists = false;
|
|
60
|
+
private excludeExisting = false;
|
|
61
|
+
private excludePattern?: string;
|
|
62
|
+
private stdin = "";
|
|
63
|
+
private compatibility: "2.43" | "2.56" = "2.56";
|
|
64
|
+
|
|
65
|
+
/** Patterns (tail-matched on whole components), or the refs of `--verify`/`--exists`. */
|
|
66
|
+
addPattern(...patterns: string[]): this {
|
|
67
|
+
this.checkCallable();
|
|
68
|
+
this.patterns.push(...patterns);
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** `--head`: HEAD listed first, whatever the patterns. */
|
|
73
|
+
setHead(head: boolean): this {
|
|
74
|
+
this.checkCallable();
|
|
75
|
+
this.head = head;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** `--branches` (2.46+; `--heads` before): only `refs/heads/`, with tags if asked too. */
|
|
80
|
+
setBranches(branches: boolean): this {
|
|
81
|
+
this.checkCallable();
|
|
82
|
+
this.branches = branches;
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** `--heads`, the name of {@link setBranches} before git 2.46. */
|
|
87
|
+
setHeads(heads: boolean): this {
|
|
88
|
+
return this.setBranches(heads);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** `--tags`: only `refs/tags/`, with branches if asked too. */
|
|
92
|
+
setTags(tags: boolean): this {
|
|
93
|
+
this.checkCallable();
|
|
94
|
+
this.tags = tags;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** `-d`/`--dereference`: a `<ref>^{}` line with what an annotated tag peels to. */
|
|
99
|
+
setDereference(deref: boolean): this {
|
|
100
|
+
this.checkCallable();
|
|
101
|
+
this.deref = deref;
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* `-s`/`--hash[=<n>]`: ids alone, abbreviated to `n` digits when given (0: whole; less than 4
|
|
107
|
+
* is 4).
|
|
108
|
+
*/
|
|
109
|
+
setHash(length?: number): this {
|
|
110
|
+
this.checkCallable();
|
|
111
|
+
this.hashOnly = true;
|
|
112
|
+
if (length !== undefined) this.abbrev = clampAbbrev(length);
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** `--abbrev[=<n>]`: ids abbreviated (no length: `core.abbrev`'s); `0` is `--no-abbrev`. */
|
|
117
|
+
setAbbrev(length?: number): this {
|
|
118
|
+
this.checkCallable();
|
|
119
|
+
this.abbrev = length === undefined ? DEFAULT_ABBREV : clampAbbrev(length);
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** `-q`/`--quiet`: nothing on stdout. */
|
|
124
|
+
setQuiet(quiet: boolean): this {
|
|
125
|
+
this.checkCallable();
|
|
126
|
+
this.quiet = quiet;
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** `--verify`: the patterns are full ref names (or HEAD and other root refs). */
|
|
131
|
+
setVerify(verify: boolean): this {
|
|
132
|
+
this.checkCallable();
|
|
133
|
+
this.verify = verify;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** `--exists`: whether the one ref given exists, without resolving it. */
|
|
138
|
+
setExists(exists: boolean): this {
|
|
139
|
+
this.checkCallable();
|
|
140
|
+
this.exists = exists;
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* `--exclude-existing[=<pattern>]`: the {@link setStdin} lines whose ref the repository
|
|
146
|
+
* lacks, only refs starting with `pattern` when given.
|
|
147
|
+
*/
|
|
148
|
+
setExcludeExisting(pattern?: string): this {
|
|
149
|
+
this.checkCallable();
|
|
150
|
+
this.excludeExisting = true;
|
|
151
|
+
this.excludePattern = pattern;
|
|
152
|
+
return this;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** git's stdin (`--exclude-existing`'s lines). */
|
|
156
|
+
setStdin(text: string): this {
|
|
157
|
+
this.checkCallable();
|
|
158
|
+
this.stdin = text;
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** The git version whose behaviour to follow (default 2.56). */
|
|
163
|
+
setCompatibility(version: "2.43" | "2.56"): this {
|
|
164
|
+
this.checkCallable();
|
|
165
|
+
this.compatibility = version;
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** It reads objects only: ids are abbreviated over cached listings. */
|
|
170
|
+
protected override writesNoObjects(): boolean {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
protected async run(): Promise<number> {
|
|
175
|
+
const modes: string[] = [];
|
|
176
|
+
if (this.excludeExisting) modes.push("--exclude-existing");
|
|
177
|
+
if (this.verify) modes.push("--verify");
|
|
178
|
+
if (this.exists) modes.push("--exists");
|
|
179
|
+
if (modes.length > 1) {
|
|
180
|
+
if (this.compatibility === "2.43") {
|
|
181
|
+
throw new PlumbingError(
|
|
182
|
+
"fatal: only one of '--exclude-existing', '--verify' or '--exists' can be given",
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
const quoted = modes.map((m) => `'${m}'`);
|
|
186
|
+
const list =
|
|
187
|
+
quoted.length === 2
|
|
188
|
+
? `${quoted[0]} and ${quoted[1]}`
|
|
189
|
+
: `${quoted.slice(0, -1).join(", ")}, and ${quoted[quoted.length - 1]}`;
|
|
190
|
+
throw new PlumbingError(`fatal: options ${list} cannot be used together`);
|
|
191
|
+
}
|
|
192
|
+
if (this.excludeExisting) return this.runExcludeExisting();
|
|
193
|
+
if (this.verify) return this.runVerify();
|
|
194
|
+
if (this.exists) return this.runExists();
|
|
195
|
+
return this.runPatterns();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** cmd_show_ref__patterns */
|
|
199
|
+
private async runPatterns(): Promise<number> {
|
|
200
|
+
let found = 0;
|
|
201
|
+
if (this.head) {
|
|
202
|
+
const id = await this.resolveName("HEAD");
|
|
203
|
+
if (id) {
|
|
204
|
+
found++;
|
|
205
|
+
await this.showOne({ name: "HEAD", id });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const prefixes =
|
|
209
|
+
this.branches || this.tags
|
|
210
|
+
? [...(this.branches ? ["refs/heads/"] : []), ...(this.tags ? ["refs/tags/"] : [])]
|
|
211
|
+
: ["refs/"];
|
|
212
|
+
for (const prefix of prefixes) {
|
|
213
|
+
for (const ref of await this.listRefs(prefix)) {
|
|
214
|
+
if (this.patterns.length > 0 && !this.patterns.some((p) => tailMatches(ref.name, p))) {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
found++;
|
|
218
|
+
await this.showOne(ref);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return found ? 0 : 1;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** cmd_show_ref__verify */
|
|
225
|
+
private async runVerify(): Promise<number> {
|
|
226
|
+
if (this.patterns.length === 0) throw new PlumbingError("fatal: --verify requires a reference");
|
|
227
|
+
for (const name of this.patterns) {
|
|
228
|
+
const id = this.verifiable(name) ? await this.resolveName(name) : undefined;
|
|
229
|
+
if (id) {
|
|
230
|
+
const peeled = await this.packedPeel(name);
|
|
231
|
+
await this.showOne({ name, id, ...(peeled ? { peeled } : {}) });
|
|
232
|
+
} else if (!this.quiet) {
|
|
233
|
+
throw new PlumbingError(`fatal: '${name}' - not a valid ref`);
|
|
234
|
+
} else {
|
|
235
|
+
return 1;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The names `--verify` reads: `refs/...` and HEAD, and from 2.45 any name refname_is_safe
|
|
243
|
+
* takes outside `refs/` (`CHERRY_PICK_HEAD`, `ORIG_HEAD`: uppercase letters and `_`).
|
|
244
|
+
*/
|
|
245
|
+
private verifiable(name: string): boolean {
|
|
246
|
+
if (name.startsWith("refs/") || name === "HEAD") return true;
|
|
247
|
+
return this.compatibility !== "2.43" && refnameIsSafe(name);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** cmd_show_ref__exists: refs_read_raw_ref, a symbolic ref not followed */
|
|
251
|
+
private async runExists(): Promise<number> {
|
|
252
|
+
const [name, more] = this.patterns;
|
|
253
|
+
if (name === undefined) throw new PlumbingError("fatal: --exists requires a reference");
|
|
254
|
+
if (more !== undefined) {
|
|
255
|
+
throw new PlumbingError("fatal: --exists requires exactly one reference");
|
|
256
|
+
}
|
|
257
|
+
let value: unknown;
|
|
258
|
+
try {
|
|
259
|
+
value = await this.refsStore.get(name);
|
|
260
|
+
} catch {
|
|
261
|
+
// unreadable content (files_read_raw_ref's EINVAL)
|
|
262
|
+
this.warn("error: failed to look up reference: Invalid argument");
|
|
263
|
+
return 1;
|
|
264
|
+
}
|
|
265
|
+
if (value) return 0;
|
|
266
|
+
const raw = await this.looseRefFile(name);
|
|
267
|
+
// 2.43 reports the files backend's EISDIR; 2.5x's read_ref_internal takes a directory
|
|
268
|
+
// for a missing ref (`reference does not exist`, exit 2)
|
|
269
|
+
if (raw === "directory" && this.compatibility === "2.43") {
|
|
270
|
+
this.warn("error: failed to look up reference: Is a directory");
|
|
271
|
+
return 1;
|
|
272
|
+
}
|
|
273
|
+
if (raw !== undefined && raw !== "directory") {
|
|
274
|
+
if (this.isObjectIdLine(raw)) return 0;
|
|
275
|
+
this.warn("error: failed to look up reference: Invalid argument");
|
|
276
|
+
return 1;
|
|
277
|
+
}
|
|
278
|
+
if (this.compatibility === "2.43" && (name === "FETCH_HEAD" || name === "MERGE_HEAD")) {
|
|
279
|
+
// 2.43's refs_read_special_head leaves failure_errno unset for a missing file
|
|
280
|
+
this.warn("error: failed to look up reference: Success");
|
|
281
|
+
return 1;
|
|
282
|
+
}
|
|
283
|
+
this.warn("error: reference does not exist");
|
|
284
|
+
return 2;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** cmd_show_ref__exclude_existing */
|
|
288
|
+
private async runExcludeExisting(): Promise<number> {
|
|
289
|
+
const existing = new Set((await this.listRefs("refs/")).map((r) => r.name));
|
|
290
|
+
const pattern = this.excludePattern;
|
|
291
|
+
for (const line of stdinLines(this.stdin)) {
|
|
292
|
+
let buf = line;
|
|
293
|
+
if (buf.length >= 3 && buf.endsWith("^{}")) buf = buf.slice(0, -3);
|
|
294
|
+
let start = buf.length;
|
|
295
|
+
while (start > 0 && !isSpace(buf.charCodeAt(start - 1))) start--;
|
|
296
|
+
const ref = buf.slice(start);
|
|
297
|
+
if (pattern !== undefined && !ref.startsWith(pattern)) continue;
|
|
298
|
+
if (!isValidRefName(ref)) {
|
|
299
|
+
this.warn(`warning: ref '${ref}' ignored`);
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (!existing.has(ref)) await this.write(`${buf}\n`);
|
|
303
|
+
}
|
|
304
|
+
return 0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** show_one: the ref's line (and its `^{}` line); a missing object is fatal. */
|
|
308
|
+
private async showOne(ref: ListedRef): Promise<void> {
|
|
309
|
+
const objects = this.workingCopy.history?.objects;
|
|
310
|
+
const present = objects ? await objects.has(ref.id).catch(() => false) : true;
|
|
311
|
+
if (!present) throw new PlumbingError(`fatal: git show-ref: bad ref ${ref.name} (${ref.id})`);
|
|
312
|
+
if (this.quiet) return;
|
|
313
|
+
const hex = await this.hexOf(ref.id);
|
|
314
|
+
await this.write(this.hashOnly ? `${hex}\n` : `${hex} ${ref.name}\n`);
|
|
315
|
+
if (!this.deref) return;
|
|
316
|
+
const peeled = ref.peeled ?? (await this.peel(ref.id));
|
|
317
|
+
if (peeled) await this.write(`${await this.hexOf(peeled)} ${ref.name}^{}\n`);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** peel_iterated_oid: what an annotated tag ends at, undefined for anything else. */
|
|
321
|
+
private async peel(id: ObjectId): Promise<ObjectId | undefined> {
|
|
322
|
+
const resolver = this.revisionResolver();
|
|
323
|
+
const type = await resolver.objectType(id).catch(() => undefined);
|
|
324
|
+
if (type !== "tag") return undefined;
|
|
325
|
+
const end = await resolver.peelTags(id).catch(() => undefined);
|
|
326
|
+
return end && end.id !== id ? end.id : undefined;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** repo_find_unique_abbrev with the command's length (0: the whole id). */
|
|
330
|
+
private async hexOf(id: ObjectId): Promise<string> {
|
|
331
|
+
if (this.abbrev === 0) return id;
|
|
332
|
+
if (this.abbrev === DEFAULT_ABBREV) return this.abbreviateObjectId(id);
|
|
333
|
+
const length = Math.min(this.abbrev, id.length);
|
|
334
|
+
const lengths = await this.idAbbreviator().lengths([id], length);
|
|
335
|
+
return id.slice(0, lengths.get(id) ?? length);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** The refs under `prefix` in name order, symbolic ones at their target's id, dangling ones left out. */
|
|
339
|
+
private async listRefs(prefix: string): Promise<ListedRef[]> {
|
|
340
|
+
const refs = this.refsStore;
|
|
341
|
+
const out: ListedRef[] = [];
|
|
342
|
+
for await (const entry of refs.list(prefix)) {
|
|
343
|
+
if (isSymbolicRef(entry)) {
|
|
344
|
+
const id = await this.resolveName(entry.name);
|
|
345
|
+
if (id) out.push({ name: entry.name, id });
|
|
346
|
+
} else if (entry.objectId) {
|
|
347
|
+
out.push({
|
|
348
|
+
name: entry.name,
|
|
349
|
+
id: entry.objectId,
|
|
350
|
+
...(entry.peeledObjectId ? { peeled: entry.peeledObjectId } : {}),
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return out.sort((a, b) => compareRefNames(a.name, b.name));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** What a ref name resolves to, symbolic refs followed (read_ref). */
|
|
358
|
+
private async resolveName(name: string): Promise<ObjectId | undefined> {
|
|
359
|
+
const ref = await this.refsStore.resolve(name).catch(() => undefined);
|
|
360
|
+
return ref?.objectId;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** The peeled id packed-refs records for `name`, if it is a direct packed ref. */
|
|
364
|
+
private async packedPeel(name: string): Promise<ObjectId | undefined> {
|
|
365
|
+
const value = await this.refsStore.get(name).catch(() => undefined);
|
|
366
|
+
return value && !isSymbolicRef(value) ? value.peeledObjectId : undefined;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* A loose ref's file in the files backend that the store does not read as a ref (a
|
|
371
|
+
* directory, FETCH_HEAD): `"directory"`, its text, or undefined when there is none (and
|
|
372
|
+
* always in a reftable repository).
|
|
373
|
+
*/
|
|
374
|
+
private async looseRefFile(name: string): Promise<string | "directory" | undefined> {
|
|
375
|
+
const config = RemoteConfigStore.from(this.workingCopy);
|
|
376
|
+
if (config.value("extensions.refStorage")?.toLowerCase() === "reftable") return undefined;
|
|
377
|
+
const perWorktree =
|
|
378
|
+
!name.startsWith("refs/") ||
|
|
379
|
+
["refs/bisect/", "refs/worktree/", "refs/rewritten/"].some((p) => name.startsWith(p));
|
|
380
|
+
const file = await (perWorktree
|
|
381
|
+
? this.hooks.gitFile(name)
|
|
382
|
+
: this.hooks.commonGitFile(name)
|
|
383
|
+
).catch(() => undefined);
|
|
384
|
+
if (!file) return undefined;
|
|
385
|
+
const stats = await file.files.stats(file.path).catch(() => undefined);
|
|
386
|
+
if (!stats) return undefined;
|
|
387
|
+
if (stats.kind === "directory") return "directory";
|
|
388
|
+
if (stats.kind !== "file") return undefined;
|
|
389
|
+
const chunks: Uint8Array[] = [];
|
|
390
|
+
for await (const chunk of file.files.read(file.path)) chunks.push(chunk);
|
|
391
|
+
let size = 0;
|
|
392
|
+
for (const c of chunks) size += c.length;
|
|
393
|
+
const bytes = new Uint8Array(size);
|
|
394
|
+
let at = 0;
|
|
395
|
+
for (const c of chunks) {
|
|
396
|
+
bytes.set(c, at);
|
|
397
|
+
at += c.length;
|
|
398
|
+
}
|
|
399
|
+
return new TextDecoder().decode(bytes);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** parse_loose_ref_contents of a direct value: the format's hex digits, then the end or a space. */
|
|
403
|
+
private isObjectIdLine(text: string): boolean {
|
|
404
|
+
const hex = this.objectFormat.hexLength;
|
|
405
|
+
if (!new RegExp(`^[0-9a-f]{${hex}}`).test(text)) return false;
|
|
406
|
+
const next = text.charAt(hex);
|
|
407
|
+
return next === "" || isSpace(next.charCodeAt(0));
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/** parse_opt_abbrev_cb: 0 stays (whole ids), less than 4 is 4; longer than any id is the id. */
|
|
412
|
+
function clampAbbrev(length: number): number {
|
|
413
|
+
if (length !== 0 && length < MINIMUM_ABBREV) return MINIMUM_ABBREV;
|
|
414
|
+
return length;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/** show_ref's pattern test: `pattern` is the whole name or its tail after a `/`. */
|
|
418
|
+
function tailMatches(name: string, pattern: string): boolean {
|
|
419
|
+
if (pattern.length > name.length || !name.endsWith(pattern)) return false;
|
|
420
|
+
return pattern.length === name.length || name.charAt(name.length - pattern.length - 1) === "/";
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** refs.c's refname_is_safe for a name outside `refs/`: uppercase letters and `_` only. */
|
|
424
|
+
function refnameIsSafe(name: string): boolean {
|
|
425
|
+
return /^[A-Z_]+$/.test(name);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** isspace in git's ctype: space, \t, \n, \v, \f, \r. */
|
|
429
|
+
function isSpace(code: number): boolean {
|
|
430
|
+
return code === 32 || (code >= 9 && code <= 13);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** fgets' lines: each without its newline, a last unterminated line included. */
|
|
434
|
+
function stdinLines(text: string): string[] {
|
|
435
|
+
if (text === "") return [];
|
|
436
|
+
const lines = text.split("\n");
|
|
437
|
+
if (lines[lines.length - 1] === "") lines.pop();
|
|
438
|
+
return lines;
|
|
439
|
+
}
|
|
@@ -23,12 +23,13 @@ import { type ObjectFormat, SHA1_OBJECT_FORMAT } from "@statewalker/vcs-utils";
|
|
|
23
23
|
import type {
|
|
24
24
|
SigningFormat,
|
|
25
25
|
VerificationOutcome,
|
|
26
|
+
Verifier,
|
|
26
27
|
WorkingCopy,
|
|
27
28
|
} from "@statewalker/vcs-working-tree";
|
|
28
29
|
|
|
29
30
|
import { GitApiError } from "../errors/index.js";
|
|
30
31
|
import { hostEnvironmentOf } from "./git-ident.js";
|
|
31
|
-
import { signingConfigOf } from "./signing.js";
|
|
32
|
+
import { type SigningConfig, signingConfigOf } from "./signing.js";
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* git's `sigc->result`: `G` good, `B` bad, `E` cannot be checked (missing key, several
|
|
@@ -80,7 +81,7 @@ export interface SignatureCheck {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
/** What is signed: the ident whose date ssh checks keys against. */
|
|
83
|
-
export type SignaturePayloadType = "commit" | "tag" | "other";
|
|
84
|
+
export type SignaturePayloadType = "commit" | "tag" | "push-cert" | "other";
|
|
84
85
|
|
|
85
86
|
/** The armor lines that start a signature of each format (gpg-interface.c's `sigs`). */
|
|
86
87
|
const SIGNATURE_STARTS: readonly [SigningFormat, string][] = [
|
|
@@ -242,10 +243,21 @@ function findHeader(bytes: Uint8Array, name: string): Uint8Array | undefined {
|
|
|
242
243
|
*/
|
|
243
244
|
function payloadTimestamp(payload: Uint8Array, type: SignaturePayloadType): number | undefined {
|
|
244
245
|
if (type === "other") return 0;
|
|
246
|
+
if (type === "push-cert") {
|
|
247
|
+
// parse_payload_metadata: the pusher's date when its line splits as an ident (a key id
|
|
248
|
+
// alone does not: no time then, and the check goes on)
|
|
249
|
+
const pusher = findHeader(payload, "pusher");
|
|
250
|
+
if (!pusher || pusher.length === 0) return 0;
|
|
251
|
+
return identTimestamp(decoder.decode(pusher)) ?? 0;
|
|
252
|
+
}
|
|
245
253
|
const ident = findHeader(payload, type === "commit" ? "committer" : "tagger");
|
|
246
254
|
if (!ident || ident.length === 0) return undefined;
|
|
255
|
+
return identTimestamp(decoder.decode(ident));
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** split_ident_line's date: after the last `>` following a `<` (undefined: no mail). */
|
|
259
|
+
function identTimestamp(text: string): number | undefined {
|
|
247
260
|
// split_ident_line: a mail between the last '<' ... '>' pair; the date after it
|
|
248
|
-
const text = decoder.decode(ident);
|
|
249
261
|
const lt = text.indexOf("<");
|
|
250
262
|
if (lt < 0) return undefined;
|
|
251
263
|
const gt = text.lastIndexOf(">");
|
|
@@ -431,6 +443,27 @@ export async function checkSignature(
|
|
|
431
443
|
payload: Uint8Array,
|
|
432
444
|
signature: Uint8Array,
|
|
433
445
|
options: CheckSignatureOptions = {},
|
|
446
|
+
): Promise<SignatureCheck> {
|
|
447
|
+
return checkSignatureWith(
|
|
448
|
+
() => signingConfigOf(workingCopy),
|
|
449
|
+
hostEnvironmentOf(workingCopy)?.verifier,
|
|
450
|
+
payload,
|
|
451
|
+
signature,
|
|
452
|
+
options,
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* {@link checkSignature} with the signing configuration (read only when the signature has a
|
|
458
|
+
* known format) and the verifier given: a served repository's (receive-pack's push
|
|
459
|
+
* certificates).
|
|
460
|
+
*/
|
|
461
|
+
export async function checkSignatureWith(
|
|
462
|
+
signingConfig: () => SigningConfig,
|
|
463
|
+
verifier: Verifier | undefined,
|
|
464
|
+
payload: Uint8Array,
|
|
465
|
+
signature: Uint8Array,
|
|
466
|
+
options: CheckSignatureOptions = {},
|
|
434
467
|
): Promise<SignatureCheck> {
|
|
435
468
|
const check: SignatureCheck = {
|
|
436
469
|
result: "N",
|
|
@@ -450,7 +483,7 @@ export async function checkSignature(
|
|
|
450
483
|
}
|
|
451
484
|
const time = payloadTimestamp(payload, options.payloadType ?? "other");
|
|
452
485
|
if (time === undefined) return check;
|
|
453
|
-
const config =
|
|
486
|
+
const config = signingConfig();
|
|
454
487
|
const program = config.programs[format];
|
|
455
488
|
let outcome: VerificationOutcome;
|
|
456
489
|
if (format === "ssh" && config.allowedSignersFile === undefined) {
|
|
@@ -459,7 +492,6 @@ export async function checkSignature(
|
|
|
459
492
|
);
|
|
460
493
|
return check;
|
|
461
494
|
}
|
|
462
|
-
const verifier = hostEnvironmentOf(workingCopy)?.verifier;
|
|
463
495
|
if (verifier) {
|
|
464
496
|
outcome = await verifier({
|
|
465
497
|
format,
|