@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
|
@@ -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,
|
|
@@ -217,6 +218,22 @@ async function concat(chunks: AsyncIterable<Uint8Array> | Iterable<Uint8Array>)
|
|
|
217
218
|
export interface SubmoduleDirt {
|
|
218
219
|
modified?: boolean;
|
|
219
220
|
untracked?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* The repository could not be looked into because git opens it and we do not (an
|
|
223
|
+
* `extensions.objectStorage` payload): its warning lines. Its own changes are then unknown
|
|
224
|
+
* (no `modified`/`untracked`); a commit other than the index's still shows, read from refs.
|
|
225
|
+
*/
|
|
226
|
+
unreadable?: string[];
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* The warning lines for a submodule we cannot look into (git opens it, we do not), or
|
|
231
|
+
* undefined for any other failure, which stays fatal as git's child status dies on it.
|
|
232
|
+
*/
|
|
233
|
+
export function submoduleNotSupportedWarning(path: string, error: unknown): string[] | undefined {
|
|
234
|
+
if (!(error instanceof Error) || error.name !== "UnsupportedRepositoryFormatError") return;
|
|
235
|
+
if (!(error as { notSupportedHere?: boolean }).notSupportedHere) return;
|
|
236
|
+
return [`warning: cannot look into submodule '${path}': ${error.message}`];
|
|
220
237
|
}
|
|
221
238
|
|
|
222
239
|
/**
|
|
@@ -226,14 +243,23 @@ export interface SubmoduleDirt {
|
|
|
226
243
|
* untracked content; any other change, a nested submodule's included, is modified content.
|
|
227
244
|
* Nothing for a submodule that is not populated (or that the worktree cannot open). A
|
|
228
245
|
* configuration the inner status cannot read fails with its messages and git's
|
|
229
|
-
* `'git status --porcelain=2' failed in submodule <path>`.
|
|
246
|
+
* `'git status --porcelain=2' failed in submodule <path>`. A repository git opens and we do
|
|
247
|
+
* not (an `extensions.objectStorage` payload, statewalker/webrun-vcs#441) is no failure of
|
|
248
|
+
* the superproject: its state is `unreadable`, with a warning.
|
|
230
249
|
*/
|
|
231
250
|
export async function readSubmoduleDirt(
|
|
232
251
|
worktree: Worktree,
|
|
233
252
|
path: string,
|
|
234
253
|
ignoreUntracked: boolean,
|
|
235
254
|
): Promise<SubmoduleDirt> {
|
|
236
|
-
|
|
255
|
+
let inner: WorkingCopy | undefined;
|
|
256
|
+
try {
|
|
257
|
+
inner = await worktree.openGitlink?.(path);
|
|
258
|
+
} catch (error) {
|
|
259
|
+
const unreadable = submoduleNotSupportedWarning(path, error);
|
|
260
|
+
if (unreadable) return { unreadable };
|
|
261
|
+
throw error;
|
|
262
|
+
}
|
|
237
263
|
if (!inner) return {};
|
|
238
264
|
// `git status --porcelain=2` there, with `-uno` when untracked content is ignored
|
|
239
265
|
const command = new StatusCommand(inner).setRenames(false);
|
|
@@ -462,7 +488,8 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
462
488
|
/**
|
|
463
489
|
* Whether the stats refreshed while comparing (and a changed untracked cache) are written
|
|
464
490
|
* 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.
|
|
491
|
+
* edits of its own (a commit's prepared index) passes false. The environment's
|
|
492
|
+
* `optionalLocks: false` (`GIT_OPTIONAL_LOCKS=0`) turns the write off too.
|
|
466
493
|
*/
|
|
467
494
|
setWriteIndex(write: boolean): this {
|
|
468
495
|
this.checkCallable();
|
|
@@ -876,6 +903,8 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
876
903
|
const indexTime = this.staging.getUpdateTime();
|
|
877
904
|
const gitlinks = new Set<string>();
|
|
878
905
|
const refresh: IndexStatUpdate[] = [];
|
|
906
|
+
// submodules we cannot look into (a repository git opens and we do not)
|
|
907
|
+
const submoduleWarnings: string[] = [];
|
|
879
908
|
const unmerged = new Map<string, [StatusSide?, StatusSide?, StatusSide?]>();
|
|
880
909
|
// the `.gitignore` files whose entry is up to date (git's ce_uptodate after its refresh):
|
|
881
910
|
// the untracked cache takes their ids from the index
|
|
@@ -885,12 +914,20 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
885
914
|
// (git's preload_index), each entry then compared synchronously where its stat settles
|
|
886
915
|
// it, so only the few undecided ones (racy, changed, submodules) cost a promise
|
|
887
916
|
const matchAll = this.paths.length === 0;
|
|
917
|
+
// the file system monitor, asked once for this index (git's tweak_fsmonitor at read):
|
|
918
|
+
// entries it reported nothing for since its token are up to date without an lstat
|
|
919
|
+
const fsm = worktree ? await this.fsmonitorRefresh(this.staging) : undefined;
|
|
920
|
+
const fsmValid = (entry: StagingEntry) => !!fsm && fsm.state.isValid(entry);
|
|
921
|
+
// entries refresh_index replaces (stat stored): their directories' untracked lists go
|
|
922
|
+
// too (replace_index_entry's mark_fsmonitor_invalid, with the monitor on)
|
|
923
|
+
const replacedPaths: string[] = [];
|
|
888
924
|
const stated = (entry: StagingEntry) =>
|
|
889
925
|
!!worktree &&
|
|
890
926
|
entry.stage === 0 &&
|
|
891
927
|
!entry.skipWorktree &&
|
|
892
928
|
!entry.assumeValid &&
|
|
893
929
|
!isGitlink(entry.mode) &&
|
|
930
|
+
!fsmValid(entry) &&
|
|
894
931
|
(matchAll || this.matchesTracked(entry.path, entry.mode));
|
|
895
932
|
const all = this.staging.entryList?.() ?? (await collectEntries(this.staging.entries()));
|
|
896
933
|
// `:(attr:...)`: the attributes of the tracked paths the pathspec may match
|
|
@@ -957,12 +994,16 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
957
994
|
if (worktree && (entry.skipWorktree || entry.assumeValid)) {
|
|
958
995
|
// git's refresh takes these as up to date (CE_SKIP_WORKTREE, CE_VALID)
|
|
959
996
|
if (isIgnoreFilePath(entry.path)) upToDate.add(entry.path);
|
|
997
|
+
} else if (worktree && entry.stage === 0 && fsmValid(entry)) {
|
|
998
|
+
// CE_FSMONITOR_VALID: taken as up to date, never stat'ed (refresh_cache_ent)
|
|
999
|
+
if (isIgnoreFilePath(entry.path)) upToDate.add(entry.path);
|
|
960
1000
|
} else if (
|
|
961
1001
|
current !== undefined &&
|
|
962
1002
|
isCleanByStat(entry, current, trust as WorktreeModeTrust, indexTime)
|
|
963
1003
|
) {
|
|
964
1004
|
// clean by its stat: nothing to report, nothing to refresh
|
|
965
1005
|
if (isIgnoreFilePath(entry.path)) upToDate.add(entry.path);
|
|
1006
|
+
if (!entry.intentToAdd) fsm?.state.markValid(entry);
|
|
966
1007
|
} else if (worktree) {
|
|
967
1008
|
const flags = isGitlink(entry.mode) ? await this.worktreeFlags(entry.path) : undefined;
|
|
968
1009
|
if (!flags?.all) {
|
|
@@ -973,15 +1014,25 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
973
1014
|
worktreeMode = result.worktreeMode;
|
|
974
1015
|
// proved clean only by hashing: its fresh stat goes into the index (git's refresh);
|
|
975
1016
|
// changed behind a matching stat: smudged
|
|
1017
|
+
let replaced = false;
|
|
976
1018
|
if (result.hashedId !== undefined || result.smudge) {
|
|
977
1019
|
const update = statUpdateOf(entry, result);
|
|
978
|
-
if (update)
|
|
1020
|
+
if (update) {
|
|
1021
|
+
refresh.push(update);
|
|
1022
|
+
replaced = true;
|
|
1023
|
+
if (fsm) replacedPaths.push(entry.path);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
// up to date and kept as it is: mark_fsmonitor_valid (a replaced entry is not)
|
|
1027
|
+
if (!result.kind && !replaced && !flags && !entry.intentToAdd) {
|
|
1028
|
+
fsm?.state.markValid(entry);
|
|
979
1029
|
}
|
|
980
1030
|
if (!result.kind && isIgnoreFilePath(entry.path)) upToDate.add(entry.path);
|
|
981
1031
|
if (flags && result.kind === "modified") commitChanged = true;
|
|
982
1032
|
// a populated submodule's own index and worktree (git's is_submodule_modified)
|
|
983
1033
|
if (flags && !flags.dirty && result.worktreeEntry?.isDirectory) {
|
|
984
1034
|
dirt = await readSubmoduleDirt(worktree, entry.path, flags.untracked);
|
|
1035
|
+
if (dirt.unreadable) submoduleWarnings.push(...dirt.unreadable);
|
|
985
1036
|
}
|
|
986
1037
|
if (result.kind === "deleted") {
|
|
987
1038
|
y = "D";
|
|
@@ -1041,7 +1092,8 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
1041
1092
|
}
|
|
1042
1093
|
|
|
1043
1094
|
const renamed = new Map<string, string>();
|
|
1044
|
-
const warnings: string[] = [];
|
|
1095
|
+
const warnings: string[] = (fsm?.warnings ?? []).map((w) => `warning: ${w}`);
|
|
1096
|
+
warnings.push(...submoduleWarnings);
|
|
1045
1097
|
const renameMode = this.renameMode();
|
|
1046
1098
|
if (renameMode) await this.pairRenames(files, renamed, worktree, warnings, renameMode);
|
|
1047
1099
|
|
|
@@ -1054,6 +1106,12 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
1054
1106
|
host,
|
|
1055
1107
|
this.objectFormat,
|
|
1056
1108
|
);
|
|
1109
|
+
// the directories of the paths the monitor reported (invalidated in the staging's cache
|
|
1110
|
+
// by the refresh) and of the entries refreshed are read again
|
|
1111
|
+
const fsmInvalidated = !!fsm && (fsm.untrackedPaths.length > 0 || replacedPaths.length > 0);
|
|
1112
|
+
if (fsm && untrackedCache.cache) {
|
|
1113
|
+
for (const path of replacedPaths) invalidateUntrackedPath(untrackedCache.cache, path);
|
|
1114
|
+
}
|
|
1057
1115
|
if (worktree && this.resolvedUntracked !== "no") {
|
|
1058
1116
|
// git's wt_status_collect_untracked: the dir flags of the modes
|
|
1059
1117
|
let flags =
|
|
@@ -1086,6 +1144,8 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
1086
1144
|
flags,
|
|
1087
1145
|
...(matchAll ? {} : { matcher: untrackedScanPathspec(this.pathspec, attributes) }),
|
|
1088
1146
|
...(cache ? { cache } : {}),
|
|
1147
|
+
// with the monitor's answer, the cache's valid directories are trusted unstat'ed
|
|
1148
|
+
...(cache && fsm?.state.useForUntracked ? { trustValidDirectories: true } : {}),
|
|
1089
1149
|
indexSeconds: Math.floor(indexTime / 1000),
|
|
1090
1150
|
...(trust ? { stat: { ctime: trust.ctime, fullStat: trust.fullStat } } : {}),
|
|
1091
1151
|
// git's "could not open directory" for each directory its scan cannot list
|
|
@@ -1102,12 +1162,18 @@ export class StatusCommand extends GitCommand<Status> {
|
|
|
1102
1162
|
}
|
|
1103
1163
|
|
|
1104
1164
|
// as git status: the refreshed stats written back when the index is free and unchanged,
|
|
1105
|
-
// with the untracked cache when it changed
|
|
1106
|
-
|
|
1165
|
+
// with the untracked cache when it changed; never under `GIT_OPTIONAL_LOCKS=0` (`git
|
|
1166
|
+
// --no-optional-locks`: cmd_status takes the index lock only when use_optional_locks())
|
|
1167
|
+
if (this.writeIndex && hostEnvironmentOf(this.workingCopy)?.optionalLocks !== false) {
|
|
1168
|
+
const changed = untrackedCache.changed();
|
|
1107
1169
|
await refreshIndexStats(
|
|
1108
1170
|
this.staging,
|
|
1109
1171
|
refresh,
|
|
1110
|
-
|
|
1172
|
+
changed
|
|
1173
|
+
? { untrackedCache: untrackedCache.cache ?? null }
|
|
1174
|
+
: fsmInvalidated && untrackedCache.cache
|
|
1175
|
+
? { carriedUntrackedCache: untrackedCache.cache }
|
|
1176
|
+
: undefined,
|
|
1111
1177
|
);
|
|
1112
1178
|
}
|
|
1113
1179
|
|
|
@@ -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
|
+
}
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
* `clone_submodule`, `configure_added_submodule`), over the submodule model of
|
|
4
4
|
* `submodule-model.ts` and the clone, checkout and add commands.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
import { FileMode } from "@statewalker/vcs-core";
|
|
7
|
-
import type { GitTransportRegistry } from "@statewalker/vcs-transport";
|
|
8
|
+
import type { GitTransportRegistry, HttpCredentialHelper } from "@statewalker/vcs-transport";
|
|
8
9
|
import { wildmatch } from "@statewalker/vcs-working-tree";
|
|
9
|
-
|
|
10
10
|
import { GitApiError } from "../errors/index.js";
|
|
11
11
|
import { RemoteConfigStore } from "../remote-config/index.js";
|
|
12
12
|
import { AddCommand } from "./add-command.js";
|
|
13
13
|
import { CheckoutCommand } from "./checkout-command.js";
|
|
14
|
+
import { unknownObjectStorageFormat } from "./default-branch.js";
|
|
14
15
|
import { checkSubmoduleName } from "./fsck/fsck-object-checks.js";
|
|
15
16
|
import { gitFileOf } from "./git-hooks.js";
|
|
16
17
|
import { DO_MATCH_DIRECTORY, matchPathspec, parsePathspec } from "./pathspec.js";
|
|
@@ -153,7 +154,10 @@ export class SubmoduleAddCommand extends SubmoduleCommandBase {
|
|
|
153
154
|
private force = false;
|
|
154
155
|
private reference?: string;
|
|
155
156
|
private depth?: number;
|
|
157
|
+
private objectStorageFormat?: string;
|
|
156
158
|
private transports?: GitTransportRegistry;
|
|
159
|
+
private credentialHelper?: HttpCredentialHelper;
|
|
160
|
+
private warningCallback?: (line: string) => void;
|
|
157
161
|
|
|
158
162
|
/** `<repository>`: the URL to clone (absolute, or `./`/`../` relative to the remote). */
|
|
159
163
|
setURI(uri: string): this {
|
|
@@ -197,6 +201,17 @@ export class SubmoduleAddCommand extends SubmoduleCommandBase {
|
|
|
197
201
|
return this;
|
|
198
202
|
}
|
|
199
203
|
|
|
204
|
+
/**
|
|
205
|
+
* `--object-storage-format=<name>` (git master): the object storage of the submodules
|
|
206
|
+
* cloned. Only `files` is a name git knows (the repository as always); anything else,
|
|
207
|
+
* `files://<dir>` included, dies `unknown object storage format '<v>'` before any work.
|
|
208
|
+
*/
|
|
209
|
+
setObjectStorageFormat(format: string): this {
|
|
210
|
+
this.checkCallable();
|
|
211
|
+
this.objectStorageFormat = format;
|
|
212
|
+
return this;
|
|
213
|
+
}
|
|
214
|
+
|
|
200
215
|
/** `--depth <n>`: a shallow clone (ignored, with git's warning, for a local path). */
|
|
201
216
|
setDepth(depth: number): this {
|
|
202
217
|
this.checkCallable();
|
|
@@ -211,8 +226,29 @@ export class SubmoduleAddCommand extends SubmoduleCommandBase {
|
|
|
211
226
|
return this;
|
|
212
227
|
}
|
|
213
228
|
|
|
229
|
+
/**
|
|
230
|
+
* A credential helper, as git's `credential.helper` read by the child clone: asked with the
|
|
231
|
+
* submodule URL's host when its server answers 401.
|
|
232
|
+
*/
|
|
233
|
+
setCredentialHelper(helper: HttpCredentialHelper): this {
|
|
234
|
+
this.checkCallable();
|
|
235
|
+
this.credentialHelper = helper;
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Receives the `warning:` lines of the clone's HTTP client. */
|
|
240
|
+
setWarningCallback(callback: (line: string) => void): this {
|
|
241
|
+
this.checkCallable();
|
|
242
|
+
this.warningCallback = callback;
|
|
243
|
+
return this;
|
|
244
|
+
}
|
|
245
|
+
|
|
214
246
|
async call(): Promise<SubmoduleCommandResult> {
|
|
215
247
|
this.start();
|
|
248
|
+
if (this.objectStorageFormat !== undefined) {
|
|
249
|
+
const unknown = unknownObjectStorageFormat(this.objectStorageFormat, "name");
|
|
250
|
+
if (unknown) this.die(unknown);
|
|
251
|
+
}
|
|
216
252
|
if (!(await this.writingGitmodulesOk())) {
|
|
217
253
|
this.die("fatal: please make sure that the .gitmodules file is in the working tree");
|
|
218
254
|
}
|
|
@@ -425,6 +461,8 @@ export class SubmoduleAddCommand extends SubmoduleCommandBase {
|
|
|
425
461
|
...(this.depth !== undefined ? { depth: this.depth } : {}),
|
|
426
462
|
...(this.reference !== undefined ? { references: [this.reference] } : {}),
|
|
427
463
|
...(this.transports ? { transports: this.transports } : {}),
|
|
464
|
+
...(this.credentialHelper ? { credentialHelper: this.credentialHelper } : {}),
|
|
465
|
+
...(this.warningCallback ? { warningCallback: this.warningCallback } : {}),
|
|
428
466
|
});
|
|
429
467
|
|
|
430
468
|
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) {
|
|
@@ -5,20 +5,22 @@
|
|
|
5
5
|
* `compute_rev_name`), over the submodule model of `submodule-model.ts`, the clone, fetch,
|
|
6
6
|
* checkout, merge and rebase commands.
|
|
7
7
|
*/
|
|
8
|
+
|
|
8
9
|
import type { ObjectId } from "@statewalker/vcs-core";
|
|
9
10
|
import {
|
|
10
11
|
type Credentials,
|
|
11
12
|
createDefaultTransports,
|
|
12
13
|
type GitTransportRegistry,
|
|
14
|
+
type HttpCredentialHelper,
|
|
13
15
|
} from "@statewalker/vcs-transport";
|
|
14
16
|
import type { PosixFilesApi } from "@statewalker/vcs-utils/files";
|
|
15
17
|
import { type WorkingCopy, wildmatch } from "@statewalker/vcs-working-tree";
|
|
16
|
-
|
|
17
18
|
import { GitApiError } from "../errors/index.js";
|
|
18
19
|
import { GitCommand } from "../git-command.js";
|
|
19
20
|
import { RemoteConfigStore } from "../remote-config/index.js";
|
|
20
21
|
import { CheckoutCommand, CheckoutStatus } from "./checkout-command.js";
|
|
21
22
|
import { createIdAbbreviator } from "./core-config.js";
|
|
23
|
+
import { unknownObjectStorageFormat } from "./default-branch.js";
|
|
22
24
|
import { DiffCommand } from "./diff-command.js";
|
|
23
25
|
import { FetchCommand } from "./fetch-command.js";
|
|
24
26
|
import { createDescriber } from "./git-describe.js";
|
|
@@ -243,6 +245,7 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
243
245
|
private requireInit = false;
|
|
244
246
|
/** `--filter=<spec>` of the clones */
|
|
245
247
|
private filter?: string;
|
|
248
|
+
private objectStorageFormat?: string;
|
|
246
249
|
/** `--[no-]single-branch` of the clones */
|
|
247
250
|
private singleBranch?: boolean;
|
|
248
251
|
private transports?: GitTransportRegistry;
|
|
@@ -254,6 +257,8 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
254
257
|
/** Set once at the top superproject, handed to nested updates unchanged */
|
|
255
258
|
private authPolicy?: SubmoduleAuthFor;
|
|
256
259
|
private timeout?: number;
|
|
260
|
+
private credentialHelper?: HttpCredentialHelper;
|
|
261
|
+
private warningCallback?: (line: string) => void;
|
|
257
262
|
|
|
258
263
|
/** A path (pathspec element) limiting the submodules; uninitialized ones are then reported. */
|
|
259
264
|
addPath(path: string): this {
|
|
@@ -328,6 +333,17 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
328
333
|
return this;
|
|
329
334
|
}
|
|
330
335
|
|
|
336
|
+
/**
|
|
337
|
+
* `--object-storage-format=<name>` (git master): the object storage of the submodules
|
|
338
|
+
* cloned. Only `files` is a name git knows (the repository as always); anything else,
|
|
339
|
+
* `files://<dir>` included, dies `unknown object storage format '<v>'` before any work.
|
|
340
|
+
*/
|
|
341
|
+
setObjectStorageFormat(format: string): this {
|
|
342
|
+
this.checkCallable();
|
|
343
|
+
this.objectStorageFormat = format;
|
|
344
|
+
return this;
|
|
345
|
+
}
|
|
346
|
+
|
|
331
347
|
/** `--filter=<spec>`: partial clones of the submodules (`CloneCommand.setFilter`). */
|
|
332
348
|
setFilter(spec: string | undefined): this {
|
|
333
349
|
this.checkCallable();
|
|
@@ -453,6 +469,26 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
453
469
|
return this.authPolicy;
|
|
454
470
|
}
|
|
455
471
|
|
|
472
|
+
/**
|
|
473
|
+
* A credential helper, as git's `credential.helper` read by its child clones and fetches:
|
|
474
|
+
* asked with each submodule's own URL when its server answers 401 (so it decides per host,
|
|
475
|
+
* at any depth), told when the credentials worked or were refused. Unlike
|
|
476
|
+
* {@link setCredentials}, its answer for one host never goes to another: the client asks
|
|
477
|
+
* it per URL, and the guarded transports drop it on a redirect to another origin.
|
|
478
|
+
*/
|
|
479
|
+
setCredentialHelper(helper: HttpCredentialHelper): this {
|
|
480
|
+
this.checkCallable();
|
|
481
|
+
this.credentialHelper = helper;
|
|
482
|
+
return this;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** Receives the `warning:` lines of the clones' and fetches' HTTP clients. */
|
|
486
|
+
setWarningCallback(callback: (line: string) => void): this {
|
|
487
|
+
this.checkCallable();
|
|
488
|
+
this.warningCallback = callback;
|
|
489
|
+
return this;
|
|
490
|
+
}
|
|
491
|
+
|
|
456
492
|
/** The timeout of clones and fetches, in milliseconds. */
|
|
457
493
|
setTimeout(timeout: number): this {
|
|
458
494
|
this.checkCallable();
|
|
@@ -462,6 +498,10 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
462
498
|
|
|
463
499
|
async call(): Promise<SubmoduleCommandResult> {
|
|
464
500
|
this.start();
|
|
501
|
+
if (this.objectStorageFormat !== undefined) {
|
|
502
|
+
const unknown = unknownObjectStorageFormat(this.objectStorageFormat, "name");
|
|
503
|
+
if (unknown) this.die(unknown);
|
|
504
|
+
}
|
|
465
505
|
if (this.requireInit) this.init = true;
|
|
466
506
|
const list = await this.moduleList(this.paths);
|
|
467
507
|
if (!list) return this.finish();
|
|
@@ -643,6 +683,8 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
643
683
|
...(this.singleBranch !== undefined ? { singleBranch: this.singleBranch } : {}),
|
|
644
684
|
transports: await this.guardedTransports(),
|
|
645
685
|
...(this.timeout !== undefined ? { timeout: this.timeout } : {}),
|
|
686
|
+
...(this.credentialHelper ? { credentialHelper: this.credentialHelper } : {}),
|
|
687
|
+
...(this.warningCallback ? { warningCallback: this.warningCallback } : {}),
|
|
646
688
|
});
|
|
647
689
|
return true;
|
|
648
690
|
} catch (error) {
|
|
@@ -776,6 +818,8 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
776
818
|
const fetch = new FetchCommand(inner);
|
|
777
819
|
fetch.setTransports(await this.guardedTransports());
|
|
778
820
|
if (this.timeout !== undefined) fetch.setTimeout(this.timeout);
|
|
821
|
+
if (this.credentialHelper) fetch.setCredentialHelper(this.credentialHelper);
|
|
822
|
+
if (this.warningCallback) fetch.setWarningCallback(this.warningCallback);
|
|
779
823
|
if (this.depth) fetch.setDepth(this.depth);
|
|
780
824
|
// the remote named, so its URL is known: `git fetch` alone fetches the default remote
|
|
781
825
|
const remote = target?.remote ?? (await defaultRemoteOf(inner));
|
|
@@ -1003,6 +1047,8 @@ export class SubmoduleUpdateCommand extends SubmoduleCommandBase {
|
|
|
1003
1047
|
// the top superproject's policy: a nested superproject's remote is no trusted origin
|
|
1004
1048
|
child.setAuthPolicy(await this.auth());
|
|
1005
1049
|
if (this.timeout !== undefined) child.setTimeout(this.timeout);
|
|
1050
|
+
if (this.credentialHelper) child.setCredentialHelper(this.credentialHelper);
|
|
1051
|
+
if (this.warningCallback) child.setWarningCallback(this.warningCallback);
|
|
1006
1052
|
let code: number;
|
|
1007
1053
|
try {
|
|
1008
1054
|
const result = await child.call();
|