@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
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
getWorktreeEntries,
|
|
13
13
|
IndexPathLookup,
|
|
14
14
|
type IndexStatUpdate,
|
|
15
|
+
invalidateUntrackedPath,
|
|
15
16
|
isCleanByStat,
|
|
16
17
|
modeFromWorktree,
|
|
17
18
|
readConvertedContent,
|
|
@@ -462,7 +463,8 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
462
463
|
/**
|
|
463
464
|
* Whether the stats refreshed while comparing (and a changed untracked cache) are written
|
|
464
465
|
* back to the index (default true, as `git status`). A caller holding the index with
|
|
465
|
-
* edits of its own (a commit's prepared index) passes false.
|
|
466
|
+
* edits of its own (a commit's prepared index) passes false. The environment's
|
|
467
|
+
* `optionalLocks: false` (`GIT_OPTIONAL_LOCKS=0`) turns the write off too.
|
|
466
468
|
*/
|
|
467
469
|
setWriteIndex(write: boolean): this {
|
|
468
470
|
this.checkCallable();
|
|
@@ -885,12 +887,20 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
885
887
|
// (git's preload_index), each entry then compared synchronously where its stat settles
|
|
886
888
|
// it, so only the few undecided ones (racy, changed, submodules) cost a promise
|
|
887
889
|
const matchAll = this.paths.length === 0;
|
|
890
|
+
// the file system monitor, asked once for this index (git's tweak_fsmonitor at read):
|
|
891
|
+
// entries it reported nothing for since its token are up to date without an lstat
|
|
892
|
+
const fsm = worktree ? await this.fsmonitorRefresh(this.staging) : undefined;
|
|
893
|
+
const fsmValid = (entry: StagingEntry) => !!fsm && fsm.state.isValid(entry);
|
|
894
|
+
// entries refresh_index replaces (stat stored): their directories' untracked lists go
|
|
895
|
+
// too (replace_index_entry's mark_fsmonitor_invalid, with the monitor on)
|
|
896
|
+
const replacedPaths: string[] = [];
|
|
888
897
|
const stated = (entry: StagingEntry) =>
|
|
889
898
|
!!worktree &&
|
|
890
899
|
entry.stage === 0 &&
|
|
891
900
|
!entry.skipWorktree &&
|
|
892
901
|
!entry.assumeValid &&
|
|
893
902
|
!isGitlink(entry.mode) &&
|
|
903
|
+
!fsmValid(entry) &&
|
|
894
904
|
(matchAll || this.matchesTracked(entry.path, entry.mode));
|
|
895
905
|
const all = this.staging.entryList?.() ?? (await collectEntries(this.staging.entries()));
|
|
896
906
|
// `:(attr:...)`: the attributes of the tracked paths the pathspec may match
|
|
@@ -957,12 +967,16 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
957
967
|
if (worktree && (entry.skipWorktree || entry.assumeValid)) {
|
|
958
968
|
// git's refresh takes these as up to date (CE_SKIP_WORKTREE, CE_VALID)
|
|
959
969
|
if (isIgnoreFilePath(entry.path)) upToDate.add(entry.path);
|
|
970
|
+
} else if (worktree && entry.stage === 0 && fsmValid(entry)) {
|
|
971
|
+
// CE_FSMONITOR_VALID: taken as up to date, never stat'ed (refresh_cache_ent)
|
|
972
|
+
if (isIgnoreFilePath(entry.path)) upToDate.add(entry.path);
|
|
960
973
|
} else if (
|
|
961
974
|
current !== undefined &&
|
|
962
975
|
isCleanByStat(entry, current, trust as WorktreeModeTrust, indexTime)
|
|
963
976
|
) {
|
|
964
977
|
// clean by its stat: nothing to report, nothing to refresh
|
|
965
978
|
if (isIgnoreFilePath(entry.path)) upToDate.add(entry.path);
|
|
979
|
+
if (!entry.intentToAdd) fsm?.state.markValid(entry);
|
|
966
980
|
} else if (worktree) {
|
|
967
981
|
const flags = isGitlink(entry.mode) ? await this.worktreeFlags(entry.path) : undefined;
|
|
968
982
|
if (!flags?.all) {
|
|
@@ -973,9 +987,18 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
973
987
|
worktreeMode = result.worktreeMode;
|
|
974
988
|
// proved clean only by hashing: its fresh stat goes into the index (git's refresh);
|
|
975
989
|
// changed behind a matching stat: smudged
|
|
990
|
+
let replaced = false;
|
|
976
991
|
if (result.hashedId !== undefined || result.smudge) {
|
|
977
992
|
const update = statUpdateOf(entry, result);
|
|
978
|
-
if (update)
|
|
993
|
+
if (update) {
|
|
994
|
+
refresh.push(update);
|
|
995
|
+
replaced = true;
|
|
996
|
+
if (fsm) replacedPaths.push(entry.path);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
// up to date and kept as it is: mark_fsmonitor_valid (a replaced entry is not)
|
|
1000
|
+
if (!result.kind && !replaced && !flags && !entry.intentToAdd) {
|
|
1001
|
+
fsm?.state.markValid(entry);
|
|
979
1002
|
}
|
|
980
1003
|
if (!result.kind && isIgnoreFilePath(entry.path)) upToDate.add(entry.path);
|
|
981
1004
|
if (flags && result.kind === "modified") commitChanged = true;
|
|
@@ -1041,7 +1064,7 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
1041
1064
|
}
|
|
1042
1065
|
|
|
1043
1066
|
const renamed = new Map<string, string>();
|
|
1044
|
-
const warnings: string[] = [];
|
|
1067
|
+
const warnings: string[] = (fsm?.warnings ?? []).map((w) => `warning: ${w}`);
|
|
1045
1068
|
const renameMode = this.renameMode();
|
|
1046
1069
|
if (renameMode) await this.pairRenames(files, renamed, worktree, warnings, renameMode);
|
|
1047
1070
|
|
|
@@ -1054,6 +1077,12 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
1054
1077
|
host,
|
|
1055
1078
|
this.objectFormat,
|
|
1056
1079
|
);
|
|
1080
|
+
// the directories of the paths the monitor reported (invalidated in the staging's cache
|
|
1081
|
+
// by the refresh) and of the entries refreshed are read again
|
|
1082
|
+
const fsmInvalidated = !!fsm && (fsm.untrackedPaths.length > 0 || replacedPaths.length > 0);
|
|
1083
|
+
if (fsm && untrackedCache.cache) {
|
|
1084
|
+
for (const path of replacedPaths) invalidateUntrackedPath(untrackedCache.cache, path);
|
|
1085
|
+
}
|
|
1057
1086
|
if (worktree && this.resolvedUntracked !== "no") {
|
|
1058
1087
|
// git's wt_status_collect_untracked: the dir flags of the modes
|
|
1059
1088
|
let flags =
|
|
@@ -1086,6 +1115,8 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
1086
1115
|
flags,
|
|
1087
1116
|
...(matchAll ? {} : { matcher: untrackedScanPathspec(this.pathspec, attributes) }),
|
|
1088
1117
|
...(cache ? { cache } : {}),
|
|
1118
|
+
// with the monitor's answer, the cache's valid directories are trusted unstat'ed
|
|
1119
|
+
...(cache && fsm?.state.useForUntracked ? { trustValidDirectories: true } : {}),
|
|
1089
1120
|
indexSeconds: Math.floor(indexTime / 1000),
|
|
1090
1121
|
...(trust ? { stat: { ctime: trust.ctime, fullStat: trust.fullStat } } : {}),
|
|
1091
1122
|
// git's "could not open directory" for each directory its scan cannot list
|
|
@@ -1102,12 +1133,18 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
1102
1133
|
}
|
|
1103
1134
|
|
|
1104
1135
|
// as git status: the refreshed stats written back when the index is free and unchanged,
|
|
1105
|
-
// with the untracked cache when it changed
|
|
1106
|
-
|
|
1136
|
+
// with the untracked cache when it changed; never under `GIT_OPTIONAL_LOCKS=0` (`git
|
|
1137
|
+
// --no-optional-locks`: cmd_status takes the index lock only when use_optional_locks())
|
|
1138
|
+
if (this.writeIndex && hostEnvironmentOf(this.workingCopy)?.optionalLocks !== false) {
|
|
1139
|
+
const changed = untrackedCache.changed();
|
|
1107
1140
|
await refreshIndexStats(
|
|
1108
1141
|
this.staging,
|
|
1109
1142
|
refresh,
|
|
1110
|
-
|
|
1143
|
+
changed
|
|
1144
|
+
? { untrackedCache: untrackedCache.cache ?? null }
|
|
1145
|
+
: fsmInvalidated && untrackedCache.cache
|
|
1146
|
+
? { carriedUntrackedCache: untrackedCache.cache }
|
|
1147
|
+
: undefined,
|
|
1111
1148
|
);
|
|
1112
1149
|
}
|
|
1113
1150
|
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `git stripspace` (builtin/stripspace.c): a message cleaned up as `strbuf_stripspace`
|
|
3
|
+
* cleans it (`-s` also drops comment lines), or every line commented out (`-c`,
|
|
4
|
+
* `strbuf_add_commented_lines`).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // printf 'a \n\n\n# c\nb' | git stripspace -s
|
|
9
|
+
* await git.stripspace().setInput("a \n\n\n# c\nb").setMode("strip-comments").call();
|
|
10
|
+
* // { exitCode: 0, stdout: "a\n\nb\n", stderr: "" }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { decodeGitPath } from "@statewalker/vcs-utils/encoding";
|
|
15
|
+
|
|
16
|
+
import { GitCommand } from "../git-command.js";
|
|
17
|
+
import { RemoteConfigStore } from "../remote-config/index.js";
|
|
18
|
+
import type { PlumbingTextOutput } from "./check-ref-format-command.js";
|
|
19
|
+
import { stripspace } from "./message-cleanup.js";
|
|
20
|
+
|
|
21
|
+
/** `git stripspace`'s modes: no option, `-s` (`--strip-comments`), `-c` (`--comment-lines`). */
|
|
22
|
+
export type StripspaceMode = "default" | "strip-comments" | "comment-lines";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* git's `add_lines` with a space after the prefix (`strbuf_add_commented_lines`): every
|
|
26
|
+
* line prefixed, a space between unless the line is empty or starts with a tab, the last
|
|
27
|
+
* line completed.
|
|
28
|
+
*/
|
|
29
|
+
export function commentLines(text: string, commentPrefix: string): string {
|
|
30
|
+
let out = "";
|
|
31
|
+
let i = 0;
|
|
32
|
+
while (i < text.length) {
|
|
33
|
+
const eol = text.indexOf("\n", i);
|
|
34
|
+
const next = eol < 0 ? text.length : eol + 1;
|
|
35
|
+
const first = text[i];
|
|
36
|
+
out += commentPrefix + (first !== "\n" && first !== "\t" ? " " : "") + text.slice(i, next);
|
|
37
|
+
i = next;
|
|
38
|
+
}
|
|
39
|
+
return out.length === 0 || out.endsWith("\n") ? out : `${out}\n`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* `git stripspace [-s | -c]` over {@link setInput} (git's stdin). The comment string of
|
|
44
|
+
* `-s` and `-c` is `core.commentChar` / `core.commentString` (the last value of either; `auto`
|
|
45
|
+
* is `#`); git dies reading a value it refuses (2.5x: empty or holding a newline; 2.43, which
|
|
46
|
+
* knows only `core.commentChar`: anything but one ASCII character), exit 128 with git's two
|
|
47
|
+
* lines. The default mode reads no configuration.
|
|
48
|
+
*/
|
|
49
|
+
export class StripspaceCommand extends GitCommand<PlumbingTextOutput> {
|
|
50
|
+
private input = "";
|
|
51
|
+
private mode: StripspaceMode = "default";
|
|
52
|
+
private compatibility: "2.43" | "2.56" = "2.56";
|
|
53
|
+
|
|
54
|
+
/** The text to clean up (git's stdin); bytes are read as git paths are (`decodeGitPath`). */
|
|
55
|
+
setInput(input: string | Uint8Array): this {
|
|
56
|
+
this.checkCallable();
|
|
57
|
+
this.input = typeof input === "string" ? input : decodeGitPath(input);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** `-s` / `-c`; the default only cleans up whitespace. */
|
|
62
|
+
setMode(mode: StripspaceMode): this {
|
|
63
|
+
this.checkCallable();
|
|
64
|
+
this.mode = mode;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The git version whose behaviour to follow (default 2.56). */
|
|
69
|
+
setCompatibility(version: "2.43" | "2.56"): this {
|
|
70
|
+
this.checkCallable();
|
|
71
|
+
this.compatibility = version;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async call(): Promise<PlumbingTextOutput> {
|
|
76
|
+
this.checkCallable();
|
|
77
|
+
this.setCallable(false);
|
|
78
|
+
if (this.mode === "default") {
|
|
79
|
+
return { exitCode: 0, stdout: stripspace(this.input), stderr: "" };
|
|
80
|
+
}
|
|
81
|
+
const prefix = this.commentString();
|
|
82
|
+
if (typeof prefix !== "string") return { exitCode: 128, stdout: "", stderr: prefix.error };
|
|
83
|
+
const stdout =
|
|
84
|
+
this.mode === "strip-comments"
|
|
85
|
+
? stripspace(this.input, prefix)
|
|
86
|
+
: commentLines(this.input, prefix);
|
|
87
|
+
return { exitCode: 0, stdout, stderr: "" };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** git_default_core_config's comment settings, each value checked in config order. */
|
|
91
|
+
private commentString(): string | { error: string } {
|
|
92
|
+
const legacy = this.compatibility === "2.43";
|
|
93
|
+
const keys = legacy ? ["core.commentchar"] : ["core.commentchar", "core.commentstring"];
|
|
94
|
+
const config = RemoteConfigStore.from(this._workingCopy);
|
|
95
|
+
let prefix = "#";
|
|
96
|
+
const entries =
|
|
97
|
+
config.entriesWithOriginFor(keys) ??
|
|
98
|
+
keys.flatMap((key) => config.valuesWithOrigin(key).map((where) => ({ key, ...where })));
|
|
99
|
+
for (const { key, text, file, line } of entries) {
|
|
100
|
+
const fatal =
|
|
101
|
+
file !== undefined && line !== undefined
|
|
102
|
+
? `fatal: bad config variable '${key}' in file '${file}' at line ${line}`
|
|
103
|
+
: `fatal: unable to parse '${key}' from command-line config`;
|
|
104
|
+
let error: string | undefined;
|
|
105
|
+
if (text === undefined) error = `error: missing value for '${key}'`;
|
|
106
|
+
else if (text.toLowerCase() === "auto") prefix = "#";
|
|
107
|
+
else if (legacy) {
|
|
108
|
+
if (text.length !== 1 || text.charCodeAt(0) >= 0x80)
|
|
109
|
+
error = "error: core.commentChar should only be one ASCII character";
|
|
110
|
+
else prefix = text;
|
|
111
|
+
} else if (text === "") error = `error: ${key} must have at least one character`;
|
|
112
|
+
else if (text.includes("\n")) error = `error: ${key} cannot contain newline`;
|
|
113
|
+
else prefix = text;
|
|
114
|
+
if (error) return { error: `${error}\n${fatal}\n` };
|
|
115
|
+
}
|
|
116
|
+
return prefix;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `submodule-model.ts` and the clone, checkout and add commands.
|
|
5
5
|
*/
|
|
6
6
|
import { FileMode } from "@statewalker/vcs-core";
|
|
7
|
-
import type { GitTransportRegistry } from "@statewalker/vcs-transport";
|
|
7
|
+
import type { GitTransportRegistry, HttpCredentialHelper } from "@statewalker/vcs-transport";
|
|
8
8
|
import { wildmatch } from "@statewalker/vcs-working-tree";
|
|
9
9
|
|
|
10
10
|
import { GitApiError } from "../errors/index.js";
|
|
@@ -154,6 +154,8 @@ export class SubmoduleAddCommand extends SubmoduleCommandBase {
|
|
|
154
154
|
private reference?: string;
|
|
155
155
|
private depth?: number;
|
|
156
156
|
private transports?: GitTransportRegistry;
|
|
157
|
+
private credentialHelper?: HttpCredentialHelper;
|
|
158
|
+
private warningCallback?: (line: string) => void;
|
|
157
159
|
|
|
158
160
|
/** `<repository>`: the URL to clone (absolute, or `./`/`../` relative to the remote). */
|
|
159
161
|
setURI(uri: string): this {
|
|
@@ -211,6 +213,23 @@ export class SubmoduleAddCommand extends SubmoduleCommandBase {
|
|
|
211
213
|
return this;
|
|
212
214
|
}
|
|
213
215
|
|
|
216
|
+
/**
|
|
217
|
+
* A credential helper, as git's `credential.helper` read by the child clone: asked with the
|
|
218
|
+
* submodule URL's host when its server answers 401.
|
|
219
|
+
*/
|
|
220
|
+
setCredentialHelper(helper: HttpCredentialHelper): this {
|
|
221
|
+
this.checkCallable();
|
|
222
|
+
this.credentialHelper = helper;
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Receives the `warning:` lines of the clone's HTTP client. */
|
|
227
|
+
setWarningCallback(callback: (line: string) => void): this {
|
|
228
|
+
this.checkCallable();
|
|
229
|
+
this.warningCallback = callback;
|
|
230
|
+
return this;
|
|
231
|
+
}
|
|
232
|
+
|
|
214
233
|
async call(): Promise<SubmoduleCommandResult> {
|
|
215
234
|
this.start();
|
|
216
235
|
if (!(await this.writingGitmodulesOk())) {
|
|
@@ -425,6 +444,8 @@ export class SubmoduleAddCommand extends SubmoduleCommandBase {
|
|
|
425
444
|
...(this.depth !== undefined ? { depth: this.depth } : {}),
|
|
426
445
|
...(this.reference !== undefined ? { references: [this.reference] } : {}),
|
|
427
446
|
...(this.transports ? { transports: this.transports } : {}),
|
|
447
|
+
...(this.credentialHelper ? { credentialHelper: this.credentialHelper } : {}),
|
|
448
|
+
...(this.warningCallback ? { warningCallback: this.warningCallback } : {}),
|
|
428
449
|
});
|
|
429
450
|
|
|
430
451
|
const inner = await worktree.openGitlink?.(path).catch(() => undefined);
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
* the commands: a native connector gets them for the URL just checked, and every smart-HTTP
|
|
20
20
|
* request carries them only when `new URL(request.url).origin` is the approved origin;
|
|
21
21
|
* redirects are followed by hand (`redirect: "manual"`) so a redirect to another origin
|
|
22
|
-
* goes out without them
|
|
22
|
+
* goes out without them; an opaque redirect (a browser's, whose target cannot be read) is
|
|
23
|
+
* asked again following it with none of them, and they go to where it ended only when
|
|
24
|
+
* that is the approved origin.
|
|
23
25
|
*
|
|
24
26
|
* @example
|
|
25
27
|
* ```typescript
|
|
@@ -217,6 +219,37 @@ function guardConnector(
|
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
const REDIRECTS = new Set([301, 302, 303, 307, 308]);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* A response the guard reached by following redirects itself, telling where it ended
|
|
225
|
+
* (`response.url`, which the client re-roots its later requests at) when the `fetch` that
|
|
226
|
+
* answered left it empty.
|
|
227
|
+
*/
|
|
228
|
+
function landedAt(response: Response, url: string): Response {
|
|
229
|
+
if (response.url) return response;
|
|
230
|
+
Object.defineProperty(response, "url", { value: url });
|
|
231
|
+
Object.defineProperty(response, "redirected", { value: true });
|
|
232
|
+
return response;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Headers that identify the user: never carried to another origin (curl's rule). */
|
|
236
|
+
const CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The caller's headers for the next hop of a redirect: whatever identifies the user (an
|
|
240
|
+
* `Authorization` from a credential helper or `http.extraHeader`, cookies) is dropped when
|
|
241
|
+
* the hop changes origin, as curl drops it when the host changes.
|
|
242
|
+
*/
|
|
243
|
+
function hopHeaders(headers: Headers, from: URL, to: URL): Headers {
|
|
244
|
+
const out = new Headers(headers);
|
|
245
|
+
if (from.origin !== to.origin) for (const name of CREDENTIAL_HEADERS) out.delete(name);
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** A redirect as the response shows it (a browser's `opaqueredirect` included). */
|
|
250
|
+
function isRedirect(response: Response): boolean {
|
|
251
|
+
return response.type === "opaqueredirect" || REDIRECTS.has(response.status);
|
|
252
|
+
}
|
|
220
253
|
const MAX_REDIRECTS = 20;
|
|
221
254
|
|
|
222
255
|
/**
|
|
@@ -239,14 +272,36 @@ function guardedFetch(
|
|
|
239
272
|
for (const name of added.keys()) headers.delete(name);
|
|
240
273
|
if (target.origin === origin) for (const [name, value] of added) headers.set(name, value);
|
|
241
274
|
const kept = current.clone();
|
|
275
|
+
const probe = current.clone();
|
|
242
276
|
const response = await fetchImpl(new Request(current, { headers, redirect: "manual" }));
|
|
277
|
+
// a request that follows no redirect (`http.followRedirects`) gets the redirect itself
|
|
278
|
+
if (request.redirect !== "follow" && isRedirect(response)) return response;
|
|
243
279
|
if (response.type === "opaqueredirect") {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
);
|
|
280
|
+
// a browser hides where it leads: ask again, following, with none of the guard's
|
|
281
|
+
// headers; the credentials go only to where that ended, on the approved origin
|
|
282
|
+
if (hops >= MAX_REDIRECTS) throw new TransportError("too many redirects");
|
|
283
|
+
const followed = await fetchImpl(new Request(probe, { redirect: "follow" }));
|
|
284
|
+
let landed: URL | undefined;
|
|
285
|
+
try {
|
|
286
|
+
landed = followed.url ? new URL(followed.url) : undefined;
|
|
287
|
+
} catch {
|
|
288
|
+
landed = undefined;
|
|
289
|
+
}
|
|
290
|
+
if (!landed || landed.href === target.href || landed.origin !== origin) return followed;
|
|
291
|
+
await followed.body?.cancel().catch(() => undefined);
|
|
292
|
+
const body = kept.method === "GET" || kept.method === "HEAD" ? null : kept.body;
|
|
293
|
+
current = new Request(landed, {
|
|
294
|
+
method: kept.method,
|
|
295
|
+
headers: hopHeaders(kept.headers, target, landed),
|
|
296
|
+
...(body ? { body, duplex: "half" } : {}),
|
|
297
|
+
signal: kept.signal,
|
|
298
|
+
} as RequestInit);
|
|
299
|
+
continue;
|
|
247
300
|
}
|
|
248
301
|
const location = response.headers.get("location");
|
|
249
|
-
if (!REDIRECTS.has(response.status) || location === null)
|
|
302
|
+
if (!REDIRECTS.has(response.status) || location === null) {
|
|
303
|
+
return hops > 0 ? landedAt(response, current.url) : response;
|
|
304
|
+
}
|
|
250
305
|
if (hops >= MAX_REDIRECTS) throw new TransportError("too many redirects");
|
|
251
306
|
await response.body?.cancel().catch(() => undefined);
|
|
252
307
|
const next = new URL(location, target);
|
|
@@ -257,7 +312,7 @@ function guardedFetch(
|
|
|
257
312
|
const body = toGet || method === "GET" || method === "HEAD" ? null : kept.body;
|
|
258
313
|
current = new Request(next, {
|
|
259
314
|
method,
|
|
260
|
-
headers: kept.headers,
|
|
315
|
+
headers: hopHeaders(kept.headers, target, next),
|
|
261
316
|
...(body ? { body, duplex: "half" } : {}),
|
|
262
317
|
signal: kept.signal,
|
|
263
318
|
} as RequestInit);
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { FileMode, type ObjectId, objectFormatOf } from "@statewalker/vcs-core";
|
|
10
10
|
import { isGitDirectory } from "@statewalker/vcs-store-files";
|
|
11
|
-
import type { GitTransportRegistry } from "@statewalker/vcs-transport";
|
|
11
|
+
import type { GitTransportRegistry, HttpCredentialHelper } from "@statewalker/vcs-transport";
|
|
12
12
|
import { decodeGitPath } from "@statewalker/vcs-utils/encoding";
|
|
13
|
-
import { type FilesApi,
|
|
13
|
+
import { type FilesApi, readFile } from "@statewalker/vcs-utils/files";
|
|
14
14
|
import { computeObjectId } from "@statewalker/vcs-utils/pack";
|
|
15
15
|
import type { GitHostEnvironment, WorkingCopy } from "@statewalker/vcs-working-tree";
|
|
16
16
|
|
|
@@ -73,6 +73,14 @@ export interface SubmoduleCloneOptions {
|
|
|
73
73
|
*/
|
|
74
74
|
transports?: GitTransportRegistry;
|
|
75
75
|
timeout?: number;
|
|
76
|
+
/**
|
|
77
|
+
* The credential helper (git's `credential.helper`, which the child clone reads): asked
|
|
78
|
+
* with the submodule's own URL after a 401, so it decides per host; the guarded transports
|
|
79
|
+
* drop what it gave on a redirect to another origin.
|
|
80
|
+
*/
|
|
81
|
+
credentialHelper?: HttpCredentialHelper;
|
|
82
|
+
/** git's `warning:` lines of the clone's HTTP client */
|
|
83
|
+
warningCallback?: (line: string) => void;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
/** What a submodule command printed, and its exit status. */
|
|
@@ -546,6 +554,8 @@ export abstract class SubmoduleCommandBase extends GitCommand<SubmoduleCommandRe
|
|
|
546
554
|
if (options.singleBranch !== undefined) clone.setSingleBranch(options.singleBranch);
|
|
547
555
|
if (options.transports) clone.setTransports(options.transports);
|
|
548
556
|
if (options.timeout !== undefined) clone.setTimeout(options.timeout);
|
|
557
|
+
if (options.credentialHelper) clone.setCredentialHelper(options.credentialHelper);
|
|
558
|
+
if (options.warningCallback) clone.setWarningCallback(options.warningCallback);
|
|
549
559
|
clone.shareHooksOf(this);
|
|
550
560
|
const result = await clone.call();
|
|
551
561
|
if (!this.quiet) {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type Credentials,
|
|
11
11
|
createDefaultTransports,
|
|
12
12
|
type GitTransportRegistry,
|
|
13
|
+
type HttpCredentialHelper,
|
|
13
14
|
} from "@statewalker/vcs-transport";
|
|
14
15
|
import type { PosixFilesApi } from "@statewalker/vcs-utils/files";
|
|
15
16
|
import { type WorkingCopy, wildmatch } from "@statewalker/vcs-working-tree";
|
|
@@ -254,6 +255,8 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
254
255
|
/** Set once at the top superproject, handed to nested updates unchanged */
|
|
255
256
|
private authPolicy?: SubmoduleAuthFor;
|
|
256
257
|
private timeout?: number;
|
|
258
|
+
private credentialHelper?: HttpCredentialHelper;
|
|
259
|
+
private warningCallback?: (line: string) => void;
|
|
257
260
|
|
|
258
261
|
/** A path (pathspec element) limiting the submodules; uninitialized ones are then reported. */
|
|
259
262
|
addPath(path: string): this {
|
|
@@ -453,6 +456,26 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
453
456
|
return this.authPolicy;
|
|
454
457
|
}
|
|
455
458
|
|
|
459
|
+
/**
|
|
460
|
+
* A credential helper, as git's `credential.helper` read by its child clones and fetches:
|
|
461
|
+
* asked with each submodule's own URL when its server answers 401 (so it decides per host,
|
|
462
|
+
* at any depth), told when the credentials worked or were refused. Unlike
|
|
463
|
+
* {@link setCredentials}, its answer for one host never goes to another: the client asks
|
|
464
|
+
* it per URL, and the guarded transports drop it on a redirect to another origin.
|
|
465
|
+
*/
|
|
466
|
+
setCredentialHelper(helper: HttpCredentialHelper): this {
|
|
467
|
+
this.checkCallable();
|
|
468
|
+
this.credentialHelper = helper;
|
|
469
|
+
return this;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/** Receives the `warning:` lines of the clones' and fetches' HTTP clients. */
|
|
473
|
+
setWarningCallback(callback: (line: string) => void): this {
|
|
474
|
+
this.checkCallable();
|
|
475
|
+
this.warningCallback = callback;
|
|
476
|
+
return this;
|
|
477
|
+
}
|
|
478
|
+
|
|
456
479
|
/** The timeout of clones and fetches, in milliseconds. */
|
|
457
480
|
setTimeout(timeout: number): this {
|
|
458
481
|
this.checkCallable();
|
|
@@ -643,6 +666,8 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
643
666
|
...(this.singleBranch !== undefined ? { singleBranch: this.singleBranch } : {}),
|
|
644
667
|
transports: await this.guardedTransports(),
|
|
645
668
|
...(this.timeout !== undefined ? { timeout: this.timeout } : {}),
|
|
669
|
+
...(this.credentialHelper ? { credentialHelper: this.credentialHelper } : {}),
|
|
670
|
+
...(this.warningCallback ? { warningCallback: this.warningCallback } : {}),
|
|
646
671
|
});
|
|
647
672
|
return true;
|
|
648
673
|
} catch (error) {
|
|
@@ -776,6 +801,8 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
776
801
|
const fetch = new FetchCommand(inner);
|
|
777
802
|
fetch.setTransports(await this.guardedTransports());
|
|
778
803
|
if (this.timeout !== undefined) fetch.setTimeout(this.timeout);
|
|
804
|
+
if (this.credentialHelper) fetch.setCredentialHelper(this.credentialHelper);
|
|
805
|
+
if (this.warningCallback) fetch.setWarningCallback(this.warningCallback);
|
|
779
806
|
if (this.depth) fetch.setDepth(this.depth);
|
|
780
807
|
// the remote named, so its URL is known: `git fetch` alone fetches the default remote
|
|
781
808
|
const remote = target?.remote ?? (await defaultRemoteOf(inner));
|
|
@@ -1003,6 +1030,8 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
1003
1030
|
// the top superproject's policy: a nested superproject's remote is no trusted origin
|
|
1004
1031
|
child.setAuthPolicy(await this.auth());
|
|
1005
1032
|
if (this.timeout !== undefined) child.setTimeout(this.timeout);
|
|
1033
|
+
if (this.credentialHelper) child.setCredentialHelper(this.credentialHelper);
|
|
1034
|
+
if (this.warningCallback) child.setWarningCallback(this.warningCallback);
|
|
1006
1035
|
let code: number;
|
|
1007
1036
|
try {
|
|
1008
1037
|
const result = await child.call();
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The textconv cache (`diff.<driver>.cachetextconv`), as git's notes-cache.c keeps it: the
|
|
3
|
+
* output of a driver's textconv command for a blob is a note on the blob in
|
|
4
|
+
* `refs/notes/textconv/<driver>`, valid while the subject of the ref's commit is the
|
|
5
|
+
* command (the cache's validity). Every entry added is committed at once (a parentless
|
|
6
|
+
* commit whose message is the command, the ref's reflog saying `update notes cache`), as
|
|
7
|
+
* `fill_textconv` writes the cache after each conversion.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const cache = await TextconvCache.open(ctx, "magic", "./helper");
|
|
12
|
+
* const text = (await cache?.get(blobId)) ?? (await run());
|
|
13
|
+
* await cache?.put(blobId, text);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import type { ObjectId } from "@statewalker/vcs-core";
|
|
17
|
+
|
|
18
|
+
import type { TextconvRequest, TextconvRunner } from "./diff-textconv.js";
|
|
19
|
+
import { initNotes, type NotesContext, type NotesHandle, updateNotesRef } from "./notes-support.js";
|
|
20
|
+
import { combineNotesOverwrite, readNoteBytes } from "./notes-tree.js";
|
|
21
|
+
|
|
22
|
+
/** pretty.c's `%s` of a message, trimmed: its first paragraph on one line. */
|
|
23
|
+
function subjectOf(message: string): string {
|
|
24
|
+
const lines = message.replace(/^\n+/, "").split("\n");
|
|
25
|
+
const paragraph: string[] = [];
|
|
26
|
+
for (const line of lines) {
|
|
27
|
+
if (line.trim() === "") break;
|
|
28
|
+
paragraph.push(line);
|
|
29
|
+
}
|
|
30
|
+
return paragraph.join(" ").trim();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class TextconvCache {
|
|
34
|
+
/** Puts in progress, one after the other (each commits the tree as it then is) */
|
|
35
|
+
private queue: Promise<void> = Promise.resolve();
|
|
36
|
+
|
|
37
|
+
private constructor(
|
|
38
|
+
private readonly ctx: NotesContext,
|
|
39
|
+
private readonly notes: NotesHandle,
|
|
40
|
+
private readonly validity: string,
|
|
41
|
+
) {}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* notes_cache_init: the cache of `driver`, empty unless the ref's commit was written for
|
|
45
|
+
* `validity`; undefined when the ref cannot hold a cache (git then caches nothing).
|
|
46
|
+
*/
|
|
47
|
+
static async open(
|
|
48
|
+
ctx: NotesContext,
|
|
49
|
+
driver: string,
|
|
50
|
+
validity: string,
|
|
51
|
+
): Promise<TextconvCache | undefined> {
|
|
52
|
+
const ref = `refs/notes/textconv/${driver}`;
|
|
53
|
+
try {
|
|
54
|
+
const id = (await ctx.refs.resolve(ref).catch(() => undefined))?.objectId ?? undefined;
|
|
55
|
+
const commit = id ? await ctx.commits.load(id).catch(() => undefined) : undefined;
|
|
56
|
+
const valid = commit !== undefined && subjectOf(commit.message) === validity;
|
|
57
|
+
const notes = await initNotes(ctx, ref, {
|
|
58
|
+
combine: combineNotesOverwrite,
|
|
59
|
+
writable: true,
|
|
60
|
+
empty: !valid,
|
|
61
|
+
});
|
|
62
|
+
return new TextconvCache(ctx, notes, validity);
|
|
63
|
+
} catch {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** notes_cache_get: the output cached for `blob`, if any. */
|
|
69
|
+
async get(blob: ObjectId): Promise<Uint8Array | undefined> {
|
|
70
|
+
await this.queue;
|
|
71
|
+
try {
|
|
72
|
+
const note = await this.notes.tree.get(blob);
|
|
73
|
+
return note ? await readNoteBytes(this.ctx.blobs, note) : undefined;
|
|
74
|
+
} catch {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* notes_cache_put and notes_cache_write: `output` noted for `blob` and committed; errors
|
|
81
|
+
* are ignored, as git ignores them (a read-only repository).
|
|
82
|
+
*/
|
|
83
|
+
put(blob: ObjectId, output: Uint8Array): Promise<void> {
|
|
84
|
+
this.queue = this.queue.then(async () => {
|
|
85
|
+
try {
|
|
86
|
+
const note = await this.ctx.blobs.store([output]);
|
|
87
|
+
await this.notes.tree.add(blob, note, combineNotesOverwrite);
|
|
88
|
+
if (!this.notes.tree.dirty || !this.notes.updateRef) return;
|
|
89
|
+
const tree = await this.notes.tree.write();
|
|
90
|
+
const commit = await this.ctx.commits.store({
|
|
91
|
+
tree,
|
|
92
|
+
parents: [],
|
|
93
|
+
author: this.ctx.author(),
|
|
94
|
+
committer: this.ctx.committer(),
|
|
95
|
+
message: this.validity,
|
|
96
|
+
});
|
|
97
|
+
await updateNotesRef(this.ctx, this.notes.updateRef, commit, "update notes cache");
|
|
98
|
+
} catch {
|
|
99
|
+
// as git: the cache is best effort
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return this.queue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* diff.c's fill_textconv over the drivers' caches of one command (git's per-process
|
|
108
|
+
* caches, by driver and command): the runner's output, read from and written to the
|
|
109
|
+
* driver's notes cache when it asks for one (`diff.<driver>.cachetextconv`) and the
|
|
110
|
+
* content has an object id git knows (a blob of a tree or the index, never a worktree
|
|
111
|
+
* file's).
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const caches = new TextconvCaches(() => this.notesContext());
|
|
116
|
+
* const text = await caches.run(runner, request, blobId);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export class TextconvCaches {
|
|
120
|
+
private readonly opened = new Map<string, Promise<TextconvCache | undefined>>();
|
|
121
|
+
|
|
122
|
+
constructor(private readonly context: () => NotesContext) {}
|
|
123
|
+
|
|
124
|
+
async run(
|
|
125
|
+
runner: TextconvRunner,
|
|
126
|
+
request: TextconvRequest,
|
|
127
|
+
id: ObjectId | undefined,
|
|
128
|
+
): Promise<Uint8Array> {
|
|
129
|
+
if (!request.cache || id === undefined) return runner(request);
|
|
130
|
+
const key = `${request.driver}\0${request.command}`;
|
|
131
|
+
let opened = this.opened.get(key);
|
|
132
|
+
if (!opened) {
|
|
133
|
+
opened = TextconvCache.open(this.context(), request.driver, request.command);
|
|
134
|
+
this.opened.set(key, opened);
|
|
135
|
+
}
|
|
136
|
+
const cache = await opened;
|
|
137
|
+
const cached = await cache?.get(id);
|
|
138
|
+
if (cached) return cached;
|
|
139
|
+
const output = await runner(request);
|
|
140
|
+
await cache?.put(id, output);
|
|
141
|
+
return output;
|
|
142
|
+
}
|
|
143
|
+
}
|