@statewalker/vcs-commands 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-backend.d.ts +2 -0
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-modes.d.ts +6 -2
- package/dist/commands/add-patch/patch-modes.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-session.d.ts +4 -0
- package/dist/commands/add-patch/patch-session.d.ts.map +1 -1
- package/dist/commands/am/am-command.d.ts +41 -2
- package/dist/commands/am/am-command.d.ts.map +1 -1
- package/dist/commands/apply/index.d.ts +1 -1
- package/dist/commands/apply/index.d.ts.map +1 -1
- package/dist/commands/archive/archive-command.d.ts +169 -0
- package/dist/commands/archive/archive-command.d.ts.map +1 -0
- package/dist/commands/archive/archive-entry.d.ts +60 -0
- package/dist/commands/archive/archive-entry.d.ts.map +1 -0
- package/dist/commands/archive/index.d.ts +8 -0
- package/dist/commands/archive/index.d.ts.map +1 -0
- package/dist/commands/archive/remote-archive-command.d.ts +56 -0
- package/dist/commands/archive/remote-archive-command.d.ts.map +1 -0
- package/dist/commands/archive/tar-archive.d.ts +31 -0
- package/dist/commands/archive/tar-archive.d.ts.map +1 -0
- package/dist/commands/archive/tar-commit-id.d.ts +13 -0
- package/dist/commands/archive/tar-commit-id.d.ts.map +1 -0
- package/dist/commands/archive/upload-archive-writer.d.ts +48 -0
- package/dist/commands/archive/upload-archive-writer.d.ts.map +1 -0
- package/dist/commands/archive/zip-archive.d.ts +42 -0
- package/dist/commands/archive/zip-archive.d.ts.map +1 -0
- package/dist/commands/attributes-source.d.ts +10 -0
- package/dist/commands/attributes-source.d.ts.map +1 -1
- package/dist/commands/blame-command.d.ts +43 -1
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/bundle/bundle-create-command.d.ts +67 -0
- package/dist/commands/bundle/bundle-create-command.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-format.d.ts +89 -0
- package/dist/commands/bundle/bundle-format.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-list.d.ts +92 -0
- package/dist/commands/bundle/bundle-list.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-read-commands.d.ts +81 -0
- package/dist/commands/bundle/bundle-read-commands.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-support.d.ts +32 -0
- package/dist/commands/bundle/bundle-support.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-transport.d.ts +38 -0
- package/dist/commands/bundle/bundle-transport.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-uri-host.d.ts +43 -0
- package/dist/commands/bundle/bundle-uri-host.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-uri.d.ts +55 -0
- package/dist/commands/bundle/bundle-uri.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-verify.d.ts +63 -0
- package/dist/commands/bundle/bundle-verify.d.ts.map +1 -0
- package/dist/commands/bundle/index.d.ts +14 -0
- package/dist/commands/bundle/index.d.ts.map +1 -0
- package/dist/commands/cat-file/batch-format.d.ts +58 -0
- package/dist/commands/cat-file/batch-format.d.ts.map +1 -0
- package/dist/commands/cat-file/cat-file-command.d.ts +144 -0
- package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -0
- package/dist/commands/cat-file/index.d.ts +3 -0
- package/dist/commands/cat-file/index.d.ts.map +1 -0
- package/dist/commands/check-attr-command.d.ts +66 -0
- package/dist/commands/check-attr-command.d.ts.map +1 -0
- package/dist/commands/check-ignore-command.d.ts +58 -0
- package/dist/commands/check-ignore-command.d.ts.map +1 -0
- package/dist/commands/check-ref-format-command.d.ts +60 -0
- package/dist/commands/check-ref-format-command.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-index-command.d.ts +96 -0
- package/dist/commands/checkout-index-command.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +10 -0
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +28 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +9 -1
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/config-command.d.ts +2 -0
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/daemon-access-hook.d.ts +36 -0
- package/dist/commands/daemon-access-hook.d.ts.map +1 -0
- package/dist/commands/default-branch.d.ts +54 -0
- package/dist/commands/default-branch.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +132 -5
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/diff-external.d.ts +43 -0
- package/dist/commands/diff-external.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/diff-pairs-command.d.ts +27 -0
- package/dist/commands/diff-plumbing/diff-pairs-command.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/diff-plumbing-command.d.ts +129 -0
- package/dist/commands/diff-plumbing/diff-plumbing-command.d.ts.map +1 -0
- package/dist/commands/diff-plumbing/index.d.ts +3 -0
- package/dist/commands/diff-plumbing/index.d.ts.map +1 -0
- package/dist/commands/diff-textconv.d.ts +5 -1
- package/dist/commands/diff-textconv.d.ts.map +1 -1
- package/dist/commands/fast-export/fast-export-command.d.ts +135 -0
- package/dist/commands/fast-export/fast-export-command.d.ts.map +1 -0
- package/dist/commands/fast-export/fast-import-command.d.ts +182 -0
- package/dist/commands/fast-export/fast-import-command.d.ts.map +1 -0
- package/dist/commands/fast-export/fast-stream-support.d.ts +64 -0
- package/dist/commands/fast-export/fast-stream-support.d.ts.map +1 -0
- package/dist/commands/fast-export/index.d.ts +4 -0
- package/dist/commands/fast-export/index.d.ts.map +1 -0
- package/dist/commands/fetch-command.d.ts +65 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/fetch-multiple-command.d.ts.map +1 -1
- package/dist/commands/format-rev-command.d.ts +60 -0
- package/dist/commands/format-rev-command.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-command.d.ts.map +1 -1
- package/dist/commands/fsck/fsck-msg-ids.d.ts +18 -3
- package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -1
- package/dist/commands/fsmonitor-ipc.d.ts +30 -0
- package/dist/commands/fsmonitor-ipc.d.ts.map +1 -0
- package/dist/commands/fsmonitor-refresh.d.ts +69 -0
- package/dist/commands/fsmonitor-refresh.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +5 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +32 -0
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/git-paths.d.ts +26 -0
- package/dist/commands/git-paths.d.ts.map +1 -0
- package/dist/commands/grep/grep-command.d.ts +2 -1
- package/dist/commands/grep/grep-command.d.ts.map +1 -1
- package/dist/commands/history-command.d.ts +156 -0
- package/dist/commands/history-command.d.ts.map +1 -0
- package/dist/commands/http-config.d.ts +38 -0
- package/dist/commands/http-config.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +12 -1
- package/dist/commands/index-adder.d.ts.map +1 -1
- package/dist/commands/index-host.d.ts.map +1 -1
- package/dist/commands/index.d.ts +45 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +6 -5
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/last-modified-command.d.ts +102 -0
- package/dist/commands/last-modified-command.d.ts.map +1 -0
- package/dist/commands/lfs/go-url.d.ts +43 -0
- package/dist/commands/lfs/go-url.d.ts.map +1 -0
- package/dist/commands/lfs/index.d.ts +3 -0
- package/dist/commands/lfs/index.d.ts.map +1 -0
- package/dist/commands/lfs/lfs-config.d.ts +174 -0
- package/dist/commands/lfs/lfs-config.d.ts.map +1 -0
- package/dist/commands/lfs/lfs-endpoint-command.d.ts +83 -0
- package/dist/commands/lfs/lfs-endpoint-command.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/log-command.d.ts +26 -0
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +28 -1
- package/dist/commands/log-output.d.ts.map +1 -1
- package/dist/commands/ls-files-command.d.ts +153 -0
- package/dist/commands/ls-files-command.d.ts.map +1 -0
- package/dist/commands/ls-remote-command.d.ts +5 -0
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/ls-tree-command.d.ts +105 -0
- package/dist/commands/ls-tree-command.d.ts.map +1 -0
- package/dist/commands/maintenance-run-command.d.ts +122 -0
- package/dist/commands/maintenance-run-command.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +7 -0
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-config.d.ts +7 -0
- package/dist/commands/merge-config.d.ts.map +1 -1
- package/dist/commands/merge-drivers.d.ts +67 -5
- package/dist/commands/merge-drivers.d.ts.map +1 -1
- package/dist/commands/merge-support.d.ts +6 -0
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/merge-tree-command.d.ts +122 -0
- package/dist/commands/merge-tree-command.d.ts.map +1 -0
- package/dist/commands/mktag-command.d.ts +51 -0
- package/dist/commands/mktag-command.d.ts.map +1 -0
- package/dist/commands/object-store/count-objects-command.d.ts +58 -0
- package/dist/commands/object-store/count-objects-command.d.ts.map +1 -0
- package/dist/commands/object-store/index.d.ts +5 -0
- package/dist/commands/object-store/index.d.ts.map +1 -0
- package/dist/commands/object-store/objects-directory.d.ts +12 -0
- package/dist/commands/object-store/objects-directory.d.ts.map +1 -0
- package/dist/commands/object-store/prune-command.d.ts +38 -0
- package/dist/commands/object-store/prune-command.d.ts.map +1 -0
- package/dist/commands/object-store/show-index-command.d.ts +23 -0
- package/dist/commands/object-store/show-index-command.d.ts.map +1 -0
- package/dist/commands/ort-merge.d.ts +24 -0
- package/dist/commands/ort-merge.d.ts.map +1 -1
- package/dist/commands/patch-id-command.d.ts +30 -0
- package/dist/commands/patch-id-command.d.ts.map +1 -0
- package/dist/commands/patch-id.d.ts +24 -0
- package/dist/commands/patch-id.d.ts.map +1 -1
- package/dist/commands/plumbing-command.d.ts +66 -0
- package/dist/commands/plumbing-command.d.ts.map +1 -0
- package/dist/commands/plumbing-input.d.ts +38 -0
- package/dist/commands/plumbing-input.d.ts.map +1 -0
- package/dist/commands/promisor-remote-reply.d.ts +35 -0
- package/dist/commands/promisor-remote-reply.d.ts.map +1 -0
- package/dist/commands/promisor-remote.d.ts.map +1 -1
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +17 -2
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +108 -2
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/refs-command.d.ts +81 -0
- package/dist/commands/refs-command.d.ts.map +1 -0
- package/dist/commands/remote-object-info-command.d.ts +55 -0
- package/dist/commands/remote-object-info-command.d.ts.map +1 -0
- package/dist/commands/remote-transport.d.ts +40 -3
- package/dist/commands/remote-transport.d.ts.map +1 -1
- package/dist/commands/repack-command.d.ts +115 -0
- package/dist/commands/repack-command.d.ts.map +1 -0
- package/dist/commands/replace-command.d.ts +143 -0
- package/dist/commands/replace-command.d.ts.map +1 -0
- package/dist/commands/replay-command.d.ts +117 -0
- package/dist/commands/replay-command.d.ts.map +1 -0
- package/dist/commands/repo-command.d.ts +158 -0
- package/dist/commands/repo-command.d.ts.map +1 -0
- package/dist/commands/request-pull-command.d.ts +82 -0
- package/dist/commands/request-pull-command.d.ts.map +1 -0
- package/dist/commands/rerere-command.d.ts +36 -0
- package/dist/commands/rerere-command.d.ts.map +1 -0
- package/dist/commands/rerere.d.ts +102 -0
- package/dist/commands/rerere.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +19 -2
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/rev-filter/commit-grep.d.ts +3 -1
- package/dist/commands/rev-filter/commit-grep.d.ts.map +1 -1
- package/dist/commands/rev-list-command.d.ts +3 -0
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/rev-parse-command.d.ts +5 -0
- package/dist/commands/rev-parse-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +10 -0
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +5 -0
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/revision-resolver.d.ts +27 -1
- package/dist/commands/revision-resolver.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +18 -0
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/serve-repository.d.ts +23 -1
- package/dist/commands/serve-repository.d.ts.map +1 -1
- package/dist/commands/session-id.d.ts +18 -0
- package/dist/commands/session-id.d.ts.map +1 -0
- package/dist/commands/show-branch-command.d.ts +59 -0
- package/dist/commands/show-branch-command.d.ts.map +1 -0
- package/dist/commands/show-ref-command.d.ts +112 -0
- package/dist/commands/show-ref-command.d.ts.map +1 -0
- package/dist/commands/signature-check.d.ts +9 -2
- package/dist/commands/signature-check.d.ts.map +1 -1
- package/dist/commands/signing.d.ts +30 -2
- package/dist/commands/signing.d.ts.map +1 -1
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-export-command.d.ts +115 -0
- package/dist/commands/stash-export-command.d.ts.map +1 -0
- package/dist/commands/status-command.d.ts +16 -2
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/stripspace-command.d.ts +44 -0
- package/dist/commands/stripspace-command.d.ts.map +1 -0
- package/dist/commands/submodule-add-command.d.ts +22 -1
- package/dist/commands/submodule-add-command.d.ts.map +1 -1
- package/dist/commands/submodule-auth.d.ts +3 -1
- package/dist/commands/submodule-auth.d.ts.map +1 -1
- package/dist/commands/submodule-commands.d.ts +9 -1
- package/dist/commands/submodule-commands.d.ts.map +1 -1
- package/dist/commands/submodule-update-command.d.ts +27 -1
- package/dist/commands/submodule-update-command.d.ts.map +1 -1
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/textconv-cache.d.ts +58 -0
- package/dist/commands/textconv-cache.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +5 -0
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/unpack-objects-command.d.ts +47 -0
- package/dist/commands/unpack-objects-command.d.ts.map +1 -0
- package/dist/commands/update-index-command.d.ts +131 -0
- package/dist/commands/update-index-command.d.ts.map +1 -0
- package/dist/commands/uri-protocols.d.ts +13 -0
- package/dist/commands/uri-protocols.d.ts.map +1 -0
- package/dist/commands/url-parse-command.d.ts +30 -0
- package/dist/commands/url-parse-command.d.ts.map +1 -0
- package/dist/commands/var-command.d.ts +42 -0
- package/dist/commands/var-command.d.ts.map +1 -0
- package/dist/{commands-CNvli5bl.js → commands-bQQ9OmCh.js} +52514 -44630
- package/dist/errors/command-errors.d.ts +33 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/index.js +39 -1
- package/dist/{fsck-CPeDh9fh.js → fsck-BHT9bUS-.js} +184 -143
- package/dist/git-command.d.ts +66 -4
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +532 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/guarded-transport-command.d.ts +3 -1
- package/dist/guarded-transport-command.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/maintenance-run-command-Cx2PlGV9.js +13544 -0
- package/dist/{remote-transport-CCmBadm-.js → remote-transport-BrQZfyHu.js} +1009 -10
- package/dist/results/cherry-pick-result.d.ts +6 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -1
- package/dist/results/diff-entry.d.ts +10 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-output.d.ts +49 -3
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/fetch-result.d.ts +12 -0
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.js +2 -2
- package/dist/results/merge-result.d.ts +5 -0
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +5 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/rebase-result.d.ts +7 -0
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/revert-result.d.ts +6 -0
- package/dist/results/revert-result.d.ts.map +1 -1
- package/dist/results/stash-result.d.ts +5 -0
- package/dist/results/stash-result.d.ts.map +1 -1
- package/dist/{results-BDuEgdLU.js → results-CNHQnU5Y.js} +13707 -10608
- package/dist/transport-command.d.ts +79 -1
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/commands/add-command.ts +3 -0
- package/src/commands/add-patch/patch-backend.ts +4 -1
- package/src/commands/add-patch/patch-modes.ts +26 -2
- package/src/commands/add-patch/patch-session.ts +6 -0
- package/src/commands/am/am-command.ts +193 -22
- package/src/commands/apply/index.ts +1 -0
- package/src/commands/archive/archive-command.ts +1148 -0
- package/src/commands/archive/archive-entry.ts +93 -0
- package/src/commands/archive/index.ts +7 -0
- package/src/commands/archive/remote-archive-command.ts +140 -0
- package/src/commands/archive/tar-archive.ts +207 -0
- package/src/commands/archive/tar-commit-id.ts +72 -0
- package/src/commands/archive/upload-archive-writer.ts +213 -0
- package/src/commands/archive/zip-archive.ts +317 -0
- package/src/commands/attributes-source.ts +26 -12
- package/src/commands/blame-command.ts +118 -19
- package/src/commands/bundle/bundle-create-command.ts +405 -0
- package/src/commands/bundle/bundle-format.ts +228 -0
- package/src/commands/bundle/bundle-list.ts +276 -0
- package/src/commands/bundle/bundle-read-commands.ts +157 -0
- package/src/commands/bundle/bundle-support.ts +85 -0
- package/src/commands/bundle/bundle-transport.ts +107 -0
- package/src/commands/bundle/bundle-uri-host.ts +204 -0
- package/src/commands/bundle/bundle-uri.ts +236 -0
- package/src/commands/bundle/bundle-verify.ts +152 -0
- package/src/commands/bundle/index.ts +14 -0
- package/src/commands/cat-file/batch-format.ts +193 -0
- package/src/commands/cat-file/cat-file-command.ts +895 -0
- package/src/commands/cat-file/index.ts +2 -0
- package/src/commands/check-attr-command.ts +333 -0
- package/src/commands/check-ignore-command.ts +261 -0
- package/src/commands/check-ref-format-command.ts +129 -0
- package/src/commands/checkout-command.ts +61 -22
- package/src/commands/checkout-index-command.ts +568 -0
- package/src/commands/checkout-paths.ts +7 -0
- package/src/commands/cherry-pick-command.ts +21 -1
- package/src/commands/clone-command.ts +249 -9
- package/src/commands/commit-command.ts +22 -4
- package/src/commands/config-command.ts +9 -0
- package/src/commands/daemon-access-hook.ts +78 -0
- package/src/commands/default-branch.ts +118 -1
- package/src/commands/diff-command.ts +592 -47
- package/src/commands/diff-external.ts +131 -0
- package/src/commands/diff-plumbing/diff-pairs-command.ts +193 -0
- package/src/commands/diff-plumbing/diff-plumbing-command.ts +424 -0
- package/src/commands/diff-plumbing/index.ts +2 -0
- package/src/commands/diff-textconv.ts +5 -1
- package/src/commands/fast-export/fast-export-command.ts +911 -0
- package/src/commands/fast-export/fast-import-command.ts +1553 -0
- package/src/commands/fast-export/fast-stream-support.ts +162 -0
- package/src/commands/fast-export/index.ts +3 -0
- package/src/commands/fetch-command.ts +312 -8
- package/src/commands/fetch-multiple-command.ts +4 -1
- package/src/commands/format-rev-command.ts +267 -0
- package/src/commands/fsck/fsck-command.ts +47 -20
- package/src/commands/fsck/fsck-msg-ids.ts +19 -3
- package/src/commands/fsck/fsck-pack.ts +2 -2
- package/src/commands/fsmonitor-ipc.ts +121 -0
- package/src/commands/fsmonitor-refresh.ts +320 -0
- package/src/commands/gc-command.ts +10 -0
- package/src/commands/git-hooks.ts +123 -6
- package/src/commands/git-paths.ts +136 -0
- package/src/commands/grep/grep-command.ts +38 -15
- package/src/commands/history-command.ts +617 -0
- package/src/commands/http-config.ts +139 -0
- package/src/commands/index-adder.ts +37 -3
- package/src/commands/index-host.ts +6 -1
- package/src/commands/index.ts +46 -0
- package/src/commands/init-command.ts +14 -0
- package/src/commands/last-modified-command.ts +804 -0
- package/src/commands/lfs/go-url.ts +370 -0
- package/src/commands/lfs/index.ts +2 -0
- package/src/commands/lfs/lfs-config.ts +738 -0
- package/src/commands/lfs/lfs-endpoint-command.ts +180 -0
- package/src/commands/local-transport.ts +252 -4
- package/src/commands/log-command.ts +104 -5
- package/src/commands/log-output.ts +66 -5
- package/src/commands/ls-files-command.ts +1177 -0
- package/src/commands/ls-remote-command.ts +6 -0
- package/src/commands/ls-tree-command.ts +708 -0
- package/src/commands/maintenance-run-command.ts +949 -0
- package/src/commands/merge-command.ts +78 -32
- package/src/commands/merge-config.ts +23 -1
- package/src/commands/merge-drivers.ts +109 -20
- package/src/commands/merge-support.ts +29 -5
- package/src/commands/merge-tree-command.ts +786 -0
- package/src/commands/mktag-command.ts +149 -0
- package/src/commands/object-store/count-objects-command.ts +404 -0
- package/src/commands/object-store/index.ts +4 -0
- package/src/commands/object-store/objects-directory.ts +24 -0
- package/src/commands/object-store/prune-command.ts +129 -0
- package/src/commands/object-store/show-index-command.ts +151 -0
- package/src/commands/ort-merge.ts +92 -25
- package/src/commands/patch-id-command.ts +65 -0
- package/src/commands/patch-id.ts +218 -0
- package/src/commands/plumbing-command.ts +141 -0
- package/src/commands/plumbing-input.ts +87 -0
- package/src/commands/promisor-remote-reply.ts +276 -0
- package/src/commands/promisor-remote.ts +25 -2
- package/src/commands/pull-command.ts +2 -0
- package/src/commands/push-command.ts +87 -5
- package/src/commands/rebase-command.ts +507 -19
- package/src/commands/refs-command.ts +274 -0
- package/src/commands/remote-object-info-command.ts +109 -0
- package/src/commands/remote-transport.ts +116 -1
- package/src/commands/repack-command.ts +383 -0
- package/src/commands/replace-command.ts +816 -0
- package/src/commands/replay-command.ts +674 -0
- package/src/commands/repo-command.ts +1066 -0
- package/src/commands/request-pull-command.ts +356 -0
- package/src/commands/rerere-command.ts +179 -0
- package/src/commands/rerere.ts +925 -0
- package/src/commands/reset-command.ts +75 -3
- package/src/commands/rev-filter/commit-grep.ts +7 -2
- package/src/commands/rev-list-command.ts +9 -0
- package/src/commands/rev-parse-command.ts +49 -5
- package/src/commands/revert-command.ts +21 -1
- package/src/commands/revision-range.ts +7 -2
- package/src/commands/revision-resolver.ts +97 -14
- package/src/commands/sequencer-pick.ts +47 -0
- package/src/commands/serve-repository.ts +65 -0
- package/src/commands/session-id.ts +31 -0
- package/src/commands/show-branch-command.ts +981 -0
- package/src/commands/show-command.ts +1 -1
- package/src/commands/show-ref-command.ts +439 -0
- package/src/commands/signature-check.ts +37 -5
- package/src/commands/signing.ts +176 -23
- package/src/commands/stash-apply-command.ts +3 -0
- package/src/commands/stash-export-command.ts +397 -0
- package/src/commands/status-command.ts +74 -8
- package/src/commands/stripspace-command.ts +118 -0
- package/src/commands/submodule-add-command.ts +40 -2
- package/src/commands/submodule-auth.ts +61 -6
- package/src/commands/submodule-commands.ts +12 -2
- package/src/commands/submodule-update-command.ts +47 -1
- package/src/commands/tag-command.ts +33 -11
- package/src/commands/textconv-cache.ts +143 -0
- package/src/commands/tree-restore.ts +14 -0
- package/src/commands/unpack-objects-command.ts +235 -0
- package/src/commands/update-index-command.ts +1148 -0
- package/src/commands/uri-protocols.ts +13 -0
- package/src/commands/url-parse-command.ts +67 -0
- package/src/commands/var-command.ts +219 -0
- package/src/errors/command-errors.ts +45 -0
- package/src/git-command.ts +177 -3
- package/src/git.ts +808 -1
- package/src/guarded-transport-command.ts +6 -1
- package/src/results/cherry-pick-result.ts +6 -0
- package/src/results/diff-entry.ts +12 -0
- package/src/results/diff-formatter.ts +7 -4
- package/src/results/diff-output.ts +117 -11
- package/src/results/diff-pickaxe.ts +1 -1
- package/src/results/fetch-result.ts +12 -0
- package/src/results/merge-result.ts +5 -0
- package/src/results/push-result.ts +5 -0
- package/src/results/rebase-result.ts +7 -0
- package/src/results/revert-result.ts +6 -0
- package/src/results/stash-result.ts +6 -0
- package/src/transport-command.ts +182 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `git fast-export` and `git fast-import` share: the stream is bytes, handled here as
|
|
3
|
+
* binary strings (one character per byte), signature modes, and the marks files' host.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { GitObjects, ObjectId } from "@statewalker/vcs-core";
|
|
7
|
+
import { type FilesApi, tryReadFile } from "@statewalker/vcs-utils/files";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* How signed tags and commits are handled (gpg-interface.c's `parse_sign_mode`): `warn` is
|
|
11
|
+
* `warn-verbatim`, `ignore` is `verbatim`.
|
|
12
|
+
*/
|
|
13
|
+
export type SignMode =
|
|
14
|
+
| "abort"
|
|
15
|
+
| "verbatim"
|
|
16
|
+
| "ignore"
|
|
17
|
+
| "warn-verbatim"
|
|
18
|
+
| "warn"
|
|
19
|
+
| "warn-strip"
|
|
20
|
+
| "strip";
|
|
21
|
+
|
|
22
|
+
const SIGN_MODES = new Set<string>([
|
|
23
|
+
"abort",
|
|
24
|
+
"verbatim",
|
|
25
|
+
"ignore",
|
|
26
|
+
"warn-verbatim",
|
|
27
|
+
"warn",
|
|
28
|
+
"warn-strip",
|
|
29
|
+
"strip",
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
/** Whether `mode` names a {@link SignMode}. */
|
|
33
|
+
export function isSignMode(mode: string): mode is SignMode {
|
|
34
|
+
return SIGN_MODES.has(mode);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Where marks files live (`--import-marks`, `--export-marks`, fast-import's `feature
|
|
39
|
+
* import-marks=`): git opens them relative to its current directory, or below
|
|
40
|
+
* `<git dir>/info/fast-import/` under `relative-marks` (`relative` set).
|
|
41
|
+
*/
|
|
42
|
+
export interface FastMarksFiles {
|
|
43
|
+
/** The file's bytes, or undefined when it does not exist */
|
|
44
|
+
read(path: string, options?: { relative?: boolean }): Promise<Uint8Array | undefined>;
|
|
45
|
+
/** Writes the file (its leading directories created) */
|
|
46
|
+
write(path: string, bytes: Uint8Array, options?: { relative?: boolean }): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Bytes as a binary string, one character per byte. */
|
|
50
|
+
export function latin1(bytes: Uint8Array): string {
|
|
51
|
+
let out = "";
|
|
52
|
+
for (let i = 0; i < bytes.length; i += 0x8000) {
|
|
53
|
+
out += String.fromCharCode.apply(null, bytes.subarray(i, i + 0x8000) as unknown as number[]);
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A binary string's bytes (characters above 0xff are not expected). */
|
|
59
|
+
export function latin1Bytes(text: string): Uint8Array {
|
|
60
|
+
const out = new Uint8Array(text.length);
|
|
61
|
+
for (let i = 0; i < text.length; i++) out[i] = text.charCodeAt(i) & 0xff;
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** An object's type and content, undefined when it cannot be read. */
|
|
66
|
+
export async function readObjectBytes(
|
|
67
|
+
objects: GitObjects,
|
|
68
|
+
id: ObjectId,
|
|
69
|
+
): Promise<{ type: string; bytes: Uint8Array } | undefined> {
|
|
70
|
+
const object = await objects.get(id).catch(() => undefined);
|
|
71
|
+
if (!object) return undefined;
|
|
72
|
+
const chunks: Uint8Array[] = [];
|
|
73
|
+
let length = 0;
|
|
74
|
+
for await (const chunk of object.content) {
|
|
75
|
+
chunks.push(chunk);
|
|
76
|
+
length += chunk.length;
|
|
77
|
+
}
|
|
78
|
+
const bytes = new Uint8Array(length);
|
|
79
|
+
let at = 0;
|
|
80
|
+
for (const c of chunks) {
|
|
81
|
+
bytes.set(c, at);
|
|
82
|
+
at += c.length;
|
|
83
|
+
}
|
|
84
|
+
return { type: object.type, bytes };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const SIGNATURE_STARTS: [string, string][] = [
|
|
88
|
+
["-----BEGIN PGP SIGNATURE-----", "openpgp"],
|
|
89
|
+
["-----BEGIN PGP MESSAGE-----", "openpgp"],
|
|
90
|
+
["-----BEGIN SIGNED MESSAGE-----", "x509"],
|
|
91
|
+
["-----BEGIN SSH SIGNATURE-----", "ssh"],
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
/** gpg-interface.c's get_signature_format: the format a signature's first line names. */
|
|
95
|
+
export function signatureFormatOf(signature: string): string {
|
|
96
|
+
for (const [start, format] of SIGNATURE_STARTS) if (signature.startsWith(start)) return format;
|
|
97
|
+
return "unknown";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Where a tag message's signature starts (its length when it has none): 2.5x's
|
|
102
|
+
* `parse_signed_buffer` (the last line opening any known format), 2.43's search for the
|
|
103
|
+
* first `\n-----BEGIN PGP SIGNATURE-----\n`.
|
|
104
|
+
*/
|
|
105
|
+
export function signatureStartOf(message: string, compatibility: "2.43" | "2.56"): number {
|
|
106
|
+
if (compatibility === "2.43") {
|
|
107
|
+
const at = message.indexOf("\n-----BEGIN PGP SIGNATURE-----\n");
|
|
108
|
+
return at < 0 ? message.length : at + 1;
|
|
109
|
+
}
|
|
110
|
+
let match = message.length;
|
|
111
|
+
let len = 0;
|
|
112
|
+
while (len < message.length) {
|
|
113
|
+
if (SIGNATURE_STARTS.some(([start]) => message.startsWith(start, len))) match = len;
|
|
114
|
+
const eol = message.indexOf("\n", len);
|
|
115
|
+
len = eol < 0 ? message.length : eol + 1;
|
|
116
|
+
}
|
|
117
|
+
return match;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Marks files over a FilesApi: paths relative to `cwd` (git's current directory, default the
|
|
122
|
+
* FilesApi's root), `relative-marks` ones below `<gitDir>/info/fast-import/`.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* git.fastImport().setMarksFiles(marksFilesOf(files, { gitDir: ".git" })).setExportMarks("marks");
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export function marksFilesOf(
|
|
130
|
+
files: FilesApi,
|
|
131
|
+
options: { cwd?: string; gitDir?: string } = {},
|
|
132
|
+
): FastMarksFiles {
|
|
133
|
+
const join = (dir: string | undefined, path: string) =>
|
|
134
|
+
path.startsWith("/") || !dir ? path : `${dir.replace(/\/+$/, "")}/${path}`;
|
|
135
|
+
const resolve = (path: string, relative?: boolean) =>
|
|
136
|
+
relative ? join(`${options.gitDir ?? ".git"}/info/fast-import`, path) : join(options.cwd, path);
|
|
137
|
+
return {
|
|
138
|
+
read: async (path, opts) => {
|
|
139
|
+
const full = resolve(path, opts?.relative);
|
|
140
|
+
// a missing file must read as absent (an in-memory FilesApi reads it as empty)
|
|
141
|
+
if ((await files.stats(full))?.kind !== "file") return undefined;
|
|
142
|
+
return tryReadFile(files, full);
|
|
143
|
+
},
|
|
144
|
+
write: async (path, bytes, opts) => {
|
|
145
|
+
await files.write(resolve(path, opts?.relative), [bytes]);
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** A ByteSink writing into a Web Stream (the writer is released when the run ends). */
|
|
151
|
+
export function writableSink(stream: WritableStream<Uint8Array>): {
|
|
152
|
+
sink: (chunk: Uint8Array) => Promise<void>;
|
|
153
|
+
release: () => void;
|
|
154
|
+
} {
|
|
155
|
+
const writer = stream.getWriter();
|
|
156
|
+
return {
|
|
157
|
+
sink: async (chunk) => {
|
|
158
|
+
await writer.write(chunk);
|
|
159
|
+
},
|
|
160
|
+
release: () => writer.releaseLock(),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { ObjectId } from "@statewalker/vcs-core";
|
|
2
|
-
// Import from the package root only: vcs-core ships a single runtime file
|
|
3
|
-
// (dist/index.js); its subpaths resolve for types but not at runtime.
|
|
4
2
|
import {
|
|
5
3
|
type FilesApi,
|
|
6
4
|
historyWithoutLazyFetch,
|
|
7
5
|
isSymbolicRef,
|
|
8
6
|
parseCoreAbbrev,
|
|
7
|
+
parseObjectFilter,
|
|
9
8
|
RefTransactionAbortedError,
|
|
10
9
|
type RefTransactionHook,
|
|
11
10
|
} from "@statewalker/vcs-core";
|
|
@@ -27,16 +26,21 @@ import {
|
|
|
27
26
|
formatFetchHead,
|
|
28
27
|
matchDestination,
|
|
29
28
|
matchSource,
|
|
29
|
+
NegotiateOnlyUnsupportedError,
|
|
30
|
+
type NegotiationAlgorithm,
|
|
31
|
+
negotiateOnly,
|
|
32
|
+
negotiationAlgorithmOf,
|
|
30
33
|
ObjectFormatMismatchError,
|
|
31
34
|
parseRefSpec,
|
|
32
35
|
type RefSpec,
|
|
33
36
|
type TagMode,
|
|
34
37
|
type FetchOptions as TransportFetchOptions,
|
|
35
38
|
transportSummaryWidth,
|
|
39
|
+
unpackLimitOf,
|
|
36
40
|
} from "@statewalker/vcs-transport";
|
|
37
41
|
import { parseGitBool } from "@statewalker/vcs-utils";
|
|
38
42
|
import { nullObjectIdLike } from "@statewalker/vcs-utils/hash";
|
|
39
|
-
import type
|
|
43
|
+
import { type WorktreeAdmin, wildmatch } from "@statewalker/vcs-working-tree";
|
|
40
44
|
import {
|
|
41
45
|
FetchIntoCheckedOutBranchError,
|
|
42
46
|
GitApiError,
|
|
@@ -61,7 +65,9 @@ import {
|
|
|
61
65
|
promisorRemotes,
|
|
62
66
|
registerPartialClone,
|
|
63
67
|
} from "./promisor-remote.js";
|
|
68
|
+
import { promisorRemoteReplyOf } from "./promisor-remote-reply.js";
|
|
64
69
|
import { withRemoteUploadPack } from "./remote-transport.js";
|
|
70
|
+
import { clientSessionIdOf } from "./session-id.js";
|
|
65
71
|
import {
|
|
66
72
|
createSubmoduleAuthPolicy,
|
|
67
73
|
guardSubmoduleTransports,
|
|
@@ -76,6 +82,9 @@ import {
|
|
|
76
82
|
type SubmoduleFetchTask,
|
|
77
83
|
} from "./submodule-fetch.js";
|
|
78
84
|
import { defaultRemoteOf, SubmoduleModel } from "./submodule-model.js";
|
|
85
|
+
// Import from the package root only: vcs-core ships a single runtime file
|
|
86
|
+
// (dist/index.js); its subpaths resolve for types but not at runtime.
|
|
87
|
+
import { uriProtocolsOption } from "./uri-protocols.js";
|
|
79
88
|
import { worktreeUsingBranch } from "./worktree-support.js";
|
|
80
89
|
|
|
81
90
|
/**
|
|
@@ -130,6 +139,7 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
130
139
|
/** Whether the remote was named (it is then in the reflog action, as on git's command line). */
|
|
131
140
|
private remoteGiven = false;
|
|
132
141
|
private refSpecs: string[] = [];
|
|
142
|
+
private prefetch = false;
|
|
133
143
|
private updateHeadOk = false;
|
|
134
144
|
private removeDeletedRefs?: boolean;
|
|
135
145
|
private pruneTags?: boolean;
|
|
@@ -160,6 +170,9 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
160
170
|
/** `--filter=<spec>` (a string), `--no-filter` (false), or neither */
|
|
161
171
|
private filterSpec?: string | false;
|
|
162
172
|
private refetch = false;
|
|
173
|
+
/** `--negotiation-tip=<revision>` (a revision, or a ref glob), in order */
|
|
174
|
+
private negotiationTips: string[] = [];
|
|
175
|
+
private negotiateOnlyMode = false;
|
|
163
176
|
private setUpstream = false;
|
|
164
177
|
/** `--[no-]recurse-submodules[=<mode>]`; unset: the configuration's */
|
|
165
178
|
private recurseSubmodules?: FetchRecurseSubmodules;
|
|
@@ -286,6 +299,26 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
286
299
|
return this;
|
|
287
300
|
}
|
|
288
301
|
|
|
302
|
+
/**
|
|
303
|
+
* `git fetch --prefetch` (fetch.c `filter_prefetch_refspec`): every refspec, the given and
|
|
304
|
+
* the remote's configured ones, writes under `refs/prefetch/` instead (`refs/remotes/o/*`
|
|
305
|
+
* becomes `refs/prefetch/remotes/o/*`, always forced); refspecs without a destination and
|
|
306
|
+
* those of `refs/tags/` are dropped, and without a refspec left nothing is fetched (no
|
|
307
|
+
* remote HEAD). The maintenance prefetch task's fetch.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* // git fetch origin --prefetch --prune --no-tags --no-write-fetch-head
|
|
312
|
+
* await git.fetch().setRemote("origin").setPrefetch(true).setRemoveDeletedRefs(true)
|
|
313
|
+
* .setTagOpt(TagOption.NO_TAGS).setWriteFetchHead(false).call();
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
setPrefetch(prefetch: boolean): this {
|
|
317
|
+
this.checkCallable();
|
|
318
|
+
this.prefetch = prefetch;
|
|
319
|
+
return this;
|
|
320
|
+
}
|
|
321
|
+
|
|
289
322
|
/**
|
|
290
323
|
* Set whether the fetch writes `FETCH_HEAD` (default true; `--no-write-fetch-head`).
|
|
291
324
|
*
|
|
@@ -412,7 +445,19 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
412
445
|
*/
|
|
413
446
|
setFilter(spec: string | false): this {
|
|
414
447
|
this.checkCallable();
|
|
415
|
-
|
|
448
|
+
if (spec === false) {
|
|
449
|
+
this.filterSpec = false;
|
|
450
|
+
return this;
|
|
451
|
+
}
|
|
452
|
+
// expand_list_objects_filter_spec: a blob limit recorded and sent in bytes (`5k`: 5120)
|
|
453
|
+
let limit: number | undefined;
|
|
454
|
+
try {
|
|
455
|
+
const filter = parseObjectFilter(spec);
|
|
456
|
+
if (filter.choice === "blob:limit") limit = filter.limit;
|
|
457
|
+
} catch {
|
|
458
|
+
// a spec git refuses goes on as given (its refusal comes later)
|
|
459
|
+
}
|
|
460
|
+
this.filterSpec = limit !== undefined ? `blob:limit=${limit}` : spec;
|
|
416
461
|
return this;
|
|
417
462
|
}
|
|
418
463
|
|
|
@@ -427,6 +472,32 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
427
472
|
return this;
|
|
428
473
|
}
|
|
429
474
|
|
|
475
|
+
/**
|
|
476
|
+
* `git fetch --negotiation-tip=<revision>`: the negotiation offers only the history of these
|
|
477
|
+
* (a revision, or a glob of refs such as `refs/heads/feature-*`) instead of every local
|
|
478
|
+
* ref's; what the fetch counts as here still follows every ref. A revision that names
|
|
479
|
+
* nothing dies `<rev> is not a valid object`; a glob matching no ref is ignored with git's
|
|
480
|
+
* warning.
|
|
481
|
+
*/
|
|
482
|
+
setNegotiationTips(...tips: string[]): this {
|
|
483
|
+
this.checkCallable();
|
|
484
|
+
this.negotiationTips = [...tips];
|
|
485
|
+
return this;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* `git fetch --negotiate-only`: negotiates with the remote from {@link setNegotiationTips}
|
|
490
|
+
* (protocol v2, a server with `wait-for-done`) and fetches nothing; the commits the server
|
|
491
|
+
* acknowledged come back as {@link FetchResult.negotiatedCommits} (git prints them on
|
|
492
|
+
* stdout). Without a tip it dies as git does; over protocol v0, or a server without
|
|
493
|
+
* `wait-for-done`, the result carries git's warning in `messages` and `exitCode` 255.
|
|
494
|
+
*/
|
|
495
|
+
setNegotiateOnly(negotiateOnly: boolean): this {
|
|
496
|
+
this.checkCallable();
|
|
497
|
+
this.negotiateOnlyMode = negotiateOnly;
|
|
498
|
+
return this;
|
|
499
|
+
}
|
|
500
|
+
|
|
430
501
|
/**
|
|
431
502
|
* `git fetch --set-upstream`: once the refs are written, the one ref fetched only into
|
|
432
503
|
* `FETCH_HEAD` (a branch, or `HEAD`) becomes the current branch's upstream,
|
|
@@ -777,6 +848,24 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
777
848
|
async call(): Promise<FetchResult> {
|
|
778
849
|
this.checkCallable();
|
|
779
850
|
this.setCallable(false);
|
|
851
|
+
if (this.negotiateOnlyMode) {
|
|
852
|
+
// cmd_fetch: --negotiate-only never recurses, and needs a tip
|
|
853
|
+
if (this.recurseSubmodules === "yes" || this.recurseSubmodules === "on-demand") {
|
|
854
|
+
throw new GitApiError(
|
|
855
|
+
"fatal: options '--negotiate-only' and '--recurse-submodules' cannot be used together",
|
|
856
|
+
{ exitCode: 128 },
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
// git 2.43 dies before the remote is reached; 2.5x once it is (the tips may come from
|
|
860
|
+
// remote.<name>.negotiationRestrict), naming --negotiation-restrict
|
|
861
|
+
if (this.negotiationTips.length === 0 && this.negotiationCompatibility() === "2.43") {
|
|
862
|
+
throw new GitApiError("fatal: --negotiate-only needs one or more --negotiation-tip=*", {
|
|
863
|
+
exitCode: 128,
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
const negotiationAlgorithm = this.negotiationAlgorithm();
|
|
868
|
+
if (this.negotiateOnlyMode) return this.callNegotiateOnly(negotiationAlgorithm);
|
|
780
869
|
|
|
781
870
|
// remote_get: a remote the configuration gives no URL may come from .git/remotes/ or
|
|
782
871
|
// .git/branches/ (git 2.x); 2.5x warns that it read one
|
|
@@ -802,11 +891,13 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
802
891
|
configBool(store.value(`remote.${this.remote}.pruneTags`)) ??
|
|
803
892
|
configBool(store.value("fetch.pruneTags")) ??
|
|
804
893
|
false;
|
|
805
|
-
const
|
|
806
|
-
const
|
|
894
|
+
const prefetchSpecs = (specs: string[]) => (this.prefetch ? prefetchRefspecs(specs) : specs);
|
|
895
|
+
const configured = prefetchSpecs(viaConfig ? store.configuredFetchRefspecs(this.remote) : []);
|
|
896
|
+
const explicitSpecs = prefetchSpecs([...this.refSpecs]);
|
|
807
897
|
// fetch.c fetch_one: --prune-tags (only without command-line refspecs) adds the tag
|
|
808
898
|
// refspec to the configured ones, or for a URL to those of the fetch
|
|
809
|
-
|
|
899
|
+
// (under --prefetch filter_prefetch_refspec drops the tag refspec again: refs/tags/ untouched)
|
|
900
|
+
if (pruneTags && this.refSpecs.length === 0 && !this.prefetch) {
|
|
810
901
|
if (viaConfig) configured.push(TAG_REFSPEC);
|
|
811
902
|
else explicitSpecs.push(TAG_REFSPEC);
|
|
812
903
|
}
|
|
@@ -828,7 +919,14 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
828
919
|
// git (fetch.c get_ref_map): the remote's configured refspecs, or with none the current
|
|
829
920
|
// branch's upstream refs when this remote is its upstream; else the remote HEAD
|
|
830
921
|
const useConfig = fromConfig && (configured.length > 0 || upstreamHere);
|
|
831
|
-
|
|
922
|
+
// (--prefetch never falls back to the remote HEAD)
|
|
923
|
+
const given = !fromConfig
|
|
924
|
+
? explicitSpecs
|
|
925
|
+
: useConfig
|
|
926
|
+
? configured
|
|
927
|
+
: this.prefetch
|
|
928
|
+
? []
|
|
929
|
+
: ["HEAD"];
|
|
832
930
|
// add_merge_config: fetching the current branch's upstream remote also takes the
|
|
833
931
|
// branch's `branch.<name>.merge` refs, for FETCH_HEAD
|
|
834
932
|
const mergeRefs = useConfig && upstream && upstreamHere ? upstream.merge : [];
|
|
@@ -843,11 +941,16 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
843
941
|
// 2.48+; 2.43 leaves it alone)
|
|
844
942
|
const followHead =
|
|
845
943
|
fromConfig &&
|
|
944
|
+
!this.prefetch &&
|
|
846
945
|
configured.length > 0 &&
|
|
847
946
|
(this.compatibility ?? this.hooks.compatibility) !== "2.43"
|
|
848
947
|
? this.followRemoteHead(store)
|
|
849
948
|
: null;
|
|
850
949
|
const messages: string[] = [...legacyMessages];
|
|
950
|
+
// cmd_fetch: fetch.bundleURI's bundles before the remote is asked
|
|
951
|
+
messages.push(
|
|
952
|
+
...(await this.fetchConfiguredBundles(this.compatibility ?? this.hooks.compatibility)),
|
|
953
|
+
);
|
|
851
954
|
const errors: string[] = [];
|
|
852
955
|
const trackingUpdates: TrackingRefUpdate[] = [];
|
|
853
956
|
|
|
@@ -914,7 +1017,16 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
914
1017
|
this.checkFetchedObjects,
|
|
915
1018
|
);
|
|
916
1019
|
|
|
1020
|
+
const sessionId = clientSessionIdOf(this.workingCopy);
|
|
1021
|
+
// --negotiation-tip: resolved before anything is fetched (add_negotiation_tips)
|
|
1022
|
+
const tipsGiven = this.negotiationTipsGiven();
|
|
1023
|
+
const negotiationTips =
|
|
1024
|
+
tipsGiven.length > 0 ? await this.resolveNegotiationTips(messages, tipsGiven) : undefined;
|
|
1025
|
+
const unpackLimit = unpackLimitOf({ getAll: (key) => store.values(key) }, "fetch");
|
|
917
1026
|
const fetchOptions: TransportFetchOptions = {
|
|
1027
|
+
...(sessionId !== undefined ? { sessionId } : {}),
|
|
1028
|
+
// fetch.uriProtocols: the packs a v2 server offloads to packfile URIs
|
|
1029
|
+
...uriProtocolsOption(store.value("fetch.uriprotocols")),
|
|
918
1030
|
url: remoteUrl,
|
|
919
1031
|
auth: this.credentials,
|
|
920
1032
|
headers: this.headers,
|
|
@@ -960,6 +1072,8 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
960
1072
|
...(compatibility !== "2.43" ? { batchNonAtomic: true } : {}),
|
|
961
1073
|
dryRun: this.dryRun,
|
|
962
1074
|
onProgress: this.progressMessageCallback,
|
|
1075
|
+
// index-pack's "Receiving objects" and "Resolving deltas"
|
|
1076
|
+
...(this.progress ? { progress: this.progress } : {}),
|
|
963
1077
|
// git's "fetch <args>: <what>" per ref; the action from the options, the remote and
|
|
964
1078
|
// the refspecs given (git's argv)
|
|
965
1079
|
reflogAction: this.reflogAction(
|
|
@@ -975,8 +1089,27 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
975
1089
|
reflogIdent: this.reflogLine("").ident,
|
|
976
1090
|
abbrev: parseCoreAbbrev(store.value("core.abbrev")) ?? -1,
|
|
977
1091
|
...(fsck ? { fsckObjects: fsck } : {}),
|
|
1092
|
+
// fetch.unpackLimit / transfer.unpackLimit: keep the pack or unpack it
|
|
1093
|
+
...(unpackLimit !== undefined ? { unpackLimit } : {}),
|
|
978
1094
|
...(filter ? { filter } : {}),
|
|
1095
|
+
// a bundle: its pack kept, a filtered one's a `from-bundle` promisor pack
|
|
1096
|
+
...(remote.kind === "bundle"
|
|
1097
|
+
? {
|
|
1098
|
+
bundle: {
|
|
1099
|
+
...(remote.remote.bundle.header.filter !== undefined
|
|
1100
|
+
? { filter: remote.remote.bundle.header.filter }
|
|
1101
|
+
: {}),
|
|
1102
|
+
promised: promisorRemotes(store).length > 0,
|
|
1103
|
+
},
|
|
1104
|
+
}
|
|
1105
|
+
: {}),
|
|
979
1106
|
...(this.refetch ? { refetch: true } : {}),
|
|
1107
|
+
...(negotiationAlgorithm !== "consecutive" ? { negotiationAlgorithm } : {}),
|
|
1108
|
+
...(negotiationTips ? { negotiationTips } : {}),
|
|
1109
|
+
// the transport's warnings (a filter the server ignores, the dumb walker's alternates)
|
|
1110
|
+
onWarning: (line: string) => messages.push(line),
|
|
1111
|
+
// the server's promisor-remote capability (promisor.acceptFromServer, storeFields)
|
|
1112
|
+
promisorRemote: promisorRemoteReplyOf(this.workingCopy, (line) => messages.push(line)),
|
|
980
1113
|
};
|
|
981
1114
|
// --upload-pack, else remote.<name>.uploadpack (transport_get)
|
|
982
1115
|
const uploadPack = this.uploadPack ?? this.remoteProgram(this.remote, "uploadpack");
|
|
@@ -1104,6 +1237,7 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
1104
1237
|
|
|
1105
1238
|
return {
|
|
1106
1239
|
uri: remoteUrl,
|
|
1240
|
+
...(result.serverSessionId !== undefined ? { serverSessionId: result.serverSessionId } : {}),
|
|
1107
1241
|
advertisedRefs,
|
|
1108
1242
|
trackingRefUpdates: trackingUpdates,
|
|
1109
1243
|
...(commitGraphHashes ? { commitGraph: commitGraphHashes } : {}),
|
|
@@ -1117,6 +1251,149 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
1117
1251
|
};
|
|
1118
1252
|
}
|
|
1119
1253
|
|
|
1254
|
+
/**
|
|
1255
|
+
* `fetch.negotiationAlgorithm` (repo-settings.c): `feature.experimental` makes `skipping` the
|
|
1256
|
+
* default; a variable without a value or an unknown value dies as git does.
|
|
1257
|
+
*/
|
|
1258
|
+
private negotiationAlgorithm(): NegotiationAlgorithm {
|
|
1259
|
+
const store = RemoteConfigStore.from(this.workingCopy);
|
|
1260
|
+
const key = "fetch.negotiationalgorithm";
|
|
1261
|
+
const entries = store.valuesWithOrigin(key);
|
|
1262
|
+
const last = entries[entries.length - 1];
|
|
1263
|
+
if (last && last.text === undefined) {
|
|
1264
|
+
const where =
|
|
1265
|
+
last.file !== undefined && last.line !== undefined
|
|
1266
|
+
? `fatal: bad config variable '${key}' in file '${last.file}' at line ${last.line}`
|
|
1267
|
+
: `fatal: unable to parse '${key}' from command-line config`;
|
|
1268
|
+
throw new GitApiError(`error: missing value for '${key}'\n${where}`, { exitCode: 128 });
|
|
1269
|
+
}
|
|
1270
|
+
const experimental = configBool(store.value("feature.experimental")) ?? false;
|
|
1271
|
+
try {
|
|
1272
|
+
return negotiationAlgorithmOf(last?.text, experimental);
|
|
1273
|
+
} catch (error) {
|
|
1274
|
+
throw new GitApiError(`fatal: ${(error as Error).message}`, { exitCode: 128 });
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/** The git version negotiation options follow (2.5x renamed `--negotiation-tip`). */
|
|
1279
|
+
private negotiationCompatibility(): "2.43" | "2.56" {
|
|
1280
|
+
return this.compatibility ?? this.hooks.compatibility;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* The negotiation tips given (`--negotiation-tip`), else (git 2.5x) the remote's
|
|
1285
|
+
* `remote.<name>.negotiationRestrict` values.
|
|
1286
|
+
*/
|
|
1287
|
+
private negotiationTipsGiven(): string[] {
|
|
1288
|
+
if (this.negotiationTips.length > 0 || this.negotiationCompatibility() === "2.43") {
|
|
1289
|
+
return this.negotiationTips;
|
|
1290
|
+
}
|
|
1291
|
+
const store = RemoteConfigStore.from(this.workingCopy);
|
|
1292
|
+
if (!store.isConfigured(this.remote)) return [];
|
|
1293
|
+
return store.values(`remote.${this.remote}.negotiationRestrict`).filter((v) => v !== "");
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* add_negotiation_tips: a revision (no glob characters) must name an object here, else git
|
|
1298
|
+
* dies (git 2.5x skips a name that resolves to nothing); a glob adds every ref it matches
|
|
1299
|
+
* (`refs/` put before a pattern without it), with git's warning when it matches none.
|
|
1300
|
+
*/
|
|
1301
|
+
private async resolveNegotiationTips(
|
|
1302
|
+
messages: string[],
|
|
1303
|
+
given: readonly string[] = this.negotiationTips,
|
|
1304
|
+
): Promise<ObjectId[]> {
|
|
1305
|
+
const legacy = this.negotiationCompatibility() === "2.43";
|
|
1306
|
+
const option = legacy ? "--negotiation-tip" : "--negotiation-restrict";
|
|
1307
|
+
const tips: ObjectId[] = [];
|
|
1308
|
+
const glob = (text: string) => /[*?[\\]/.test(text);
|
|
1309
|
+
const refs = given.some(glob)
|
|
1310
|
+
? await createTransportRefStore(this._workingCopy.history.refs).listAll()
|
|
1311
|
+
: [];
|
|
1312
|
+
for (const tip of given) {
|
|
1313
|
+
if (!glob(tip)) {
|
|
1314
|
+
let id: ObjectId;
|
|
1315
|
+
try {
|
|
1316
|
+
id = await this.resolveRevision(tip);
|
|
1317
|
+
} catch (error) {
|
|
1318
|
+
if (!legacy) continue;
|
|
1319
|
+
throw new GitApiError(`fatal: ${tip} is not a valid object`, {
|
|
1320
|
+
exitCode: 128,
|
|
1321
|
+
cause: error,
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
if (!(await this._workingCopy.history.objects?.has(id))) {
|
|
1325
|
+
throw new GitApiError(`fatal: the object ${tip} does not exist`, { exitCode: 128 });
|
|
1326
|
+
}
|
|
1327
|
+
tips.push(id);
|
|
1328
|
+
continue;
|
|
1329
|
+
}
|
|
1330
|
+
const pattern = tip.startsWith("refs/") ? tip : `refs/${tip}`;
|
|
1331
|
+
const before = tips.length;
|
|
1332
|
+
for (const [name, id] of refs) if (wildmatch(pattern, name)) tips.push(id);
|
|
1333
|
+
if (tips.length === before) {
|
|
1334
|
+
messages.push(`warning: ignoring ${option}=${tip} because it does not match any refs`);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
return tips;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* `git fetch --negotiate-only`: the negotiation alone, over the remote's upload-pack; the
|
|
1342
|
+
* acknowledged commits in {@link FetchResult.negotiatedCommits}. transport.c's refusals
|
|
1343
|
+
* (protocol v0, no `wait-for-done`) are its warning and exit status 255.
|
|
1344
|
+
*/
|
|
1345
|
+
private async callNegotiateOnly(algorithm: NegotiationAlgorithm): Promise<FetchResult> {
|
|
1346
|
+
const legacyMessages = await this.loadLegacyRemote(this.remote);
|
|
1347
|
+
const remoteUrl = await this.resolveRemoteUrl(this.remote);
|
|
1348
|
+
if (!remoteUrl) throw new InvalidRemoteError(this.remote);
|
|
1349
|
+
const messages: string[] = [...legacyMessages];
|
|
1350
|
+
const given = this.negotiationTipsGiven();
|
|
1351
|
+
const tips = await this.resolveNegotiationTips(messages, given);
|
|
1352
|
+
const remote = await this.prepareRemote(remoteUrl);
|
|
1353
|
+
if (given.length === 0) {
|
|
1354
|
+
throw new GitApiError("fatal: --negotiate-only needs one or more --negotiation-restrict=*", {
|
|
1355
|
+
exitCode: 128,
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
const uploadPack = this.uploadPack ?? this.remoteProgram(this.remote, "uploadpack");
|
|
1359
|
+
const sessionOptions = {
|
|
1360
|
+
...this.remoteSessionOptions(),
|
|
1361
|
+
...(uploadPack !== undefined ? { program: uploadPack } : {}),
|
|
1362
|
+
};
|
|
1363
|
+
const history = this._workingCopy.history;
|
|
1364
|
+
const sessionId = clientSessionIdOf(this.workingCopy);
|
|
1365
|
+
const result: FetchResult = {
|
|
1366
|
+
uri: remoteUrl,
|
|
1367
|
+
advertisedRefs: new Map(),
|
|
1368
|
+
trackingRefUpdates: [],
|
|
1369
|
+
bytesReceived: 0,
|
|
1370
|
+
isEmpty: false,
|
|
1371
|
+
messages,
|
|
1372
|
+
negotiatedCommits: [],
|
|
1373
|
+
};
|
|
1374
|
+
const shallow = (await history.refs.getShallow?.()) ?? [];
|
|
1375
|
+
try {
|
|
1376
|
+
result.negotiatedCommits = await withRemoteUploadPack(remote, sessionOptions, (connection) =>
|
|
1377
|
+
negotiateOnly(connection, {
|
|
1378
|
+
repository: createRepositoryFacade({ history: historyWithoutLazyFetch(history) }),
|
|
1379
|
+
tips,
|
|
1380
|
+
negotiationAlgorithm: algorithm,
|
|
1381
|
+
shallow,
|
|
1382
|
+
...(sessionId !== undefined ? { sessionId } : {}),
|
|
1383
|
+
}),
|
|
1384
|
+
);
|
|
1385
|
+
} catch (error) {
|
|
1386
|
+
if (error instanceof NegotiateOnlyUnsupportedError) {
|
|
1387
|
+
messages.push(error.message);
|
|
1388
|
+
// transport_fetch_refs' -1, git's exit status 255
|
|
1389
|
+
result.exitCode = 255;
|
|
1390
|
+
return result;
|
|
1391
|
+
}
|
|
1392
|
+
throw error;
|
|
1393
|
+
}
|
|
1394
|
+
return result;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1120
1397
|
/**
|
|
1121
1398
|
* cmd_fetch's `config.recurse_submodules`: the command line, else `submodule.recurse` and
|
|
1122
1399
|
* `fetch.recurseSubmodules` in config order, else `.gitmodules`' `fetch.recurseSubmodules`;
|
|
@@ -1250,6 +1527,9 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
1250
1527
|
);
|
|
1251
1528
|
child.setTransports(transports);
|
|
1252
1529
|
if (this.timeout) child.setTimeout(this.timeout);
|
|
1530
|
+
// git's child reads credential.helper itself: asked per URL, never carried across origins
|
|
1531
|
+
if (this.credentialHelper) child.setCredentialHelper(this.credentialHelper);
|
|
1532
|
+
if (this.warningCallback) child.setWarningCallback(this.warningCallback);
|
|
1253
1533
|
if (this.gzipRequests !== undefined) child.setGzipRequests(this.gzipRequests);
|
|
1254
1534
|
child.setCompatibility(compatibility);
|
|
1255
1535
|
if (this.dryRun) child.setDryRun(true);
|
|
@@ -1973,3 +2253,27 @@ export function fetchSucceeded(result: FetchResult): boolean {
|
|
|
1973
2253
|
)
|
|
1974
2254
|
);
|
|
1975
2255
|
}
|
|
2256
|
+
|
|
2257
|
+
/**
|
|
2258
|
+
* fetch.c's `filter_prefetch_refspec`: negative refspecs kept; a refspec without a destination
|
|
2259
|
+
* or whose source is under `refs/tags/` dropped; any other written under `refs/prefetch/` (the
|
|
2260
|
+
* destination less its `refs/`), forced.
|
|
2261
|
+
*/
|
|
2262
|
+
export function prefetchRefspecs(specs: readonly string[]): string[] {
|
|
2263
|
+
const out: string[] = [];
|
|
2264
|
+
for (const spec of specs) {
|
|
2265
|
+
if (spec.startsWith("^")) {
|
|
2266
|
+
out.push(spec);
|
|
2267
|
+
continue;
|
|
2268
|
+
}
|
|
2269
|
+
const body = spec.startsWith("+") ? spec.slice(1) : spec;
|
|
2270
|
+
const colon = body.indexOf(":");
|
|
2271
|
+
if (colon < 0) continue;
|
|
2272
|
+
const src = body.slice(0, colon);
|
|
2273
|
+
const dst = body.slice(colon + 1);
|
|
2274
|
+
if (dst === "" || src.startsWith("refs/tags/")) continue;
|
|
2275
|
+
const sub = dst.startsWith("refs/") ? dst.slice("refs/".length) : dst;
|
|
2276
|
+
out.push(`+${src}:refs/prefetch/${sub}`);
|
|
2277
|
+
}
|
|
2278
|
+
return out;
|
|
2279
|
+
}
|
|
@@ -265,7 +265,10 @@ export class FetchMultipleCommand extends GuardedTransportCommand<FetchMultipleR
|
|
|
265
265
|
...(parallel ? ["--end-of-options"] : []),
|
|
266
266
|
];
|
|
267
267
|
let stdout = "";
|
|
268
|
-
|
|
268
|
+
// cmd_fetch downloads fetch.bundleURI's bundles once; its children are run with
|
|
269
|
+
// `-c fetch.bundleURI=` so they download nothing
|
|
270
|
+
let stderr = (await this.fetchConfiguredBundles()).map((l) => `${l}\n`).join("");
|
|
271
|
+
this.bundleUriOverride = "";
|
|
269
272
|
let failed = false;
|
|
270
273
|
const fetches: FetchMultipleEntry[] = [];
|
|
271
274
|
// git's parallel runner prints every `Fetching` line as it starts a child; ours starts
|