@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
|
@@ -13,10 +13,12 @@ import {
|
|
|
13
13
|
GitWorkingCopyConfig,
|
|
14
14
|
HostPaths,
|
|
15
15
|
hostRootOf,
|
|
16
|
+
objectStorageFormatByUri,
|
|
16
17
|
parseConfigKey,
|
|
17
18
|
setConfigMultivarText,
|
|
18
19
|
} from "@statewalker/vcs-store-files";
|
|
19
20
|
import {
|
|
21
|
+
bundleUriLines,
|
|
20
22
|
createRepositoryFacade,
|
|
21
23
|
createTransportRefStore,
|
|
22
24
|
FetchCheckError,
|
|
@@ -28,6 +30,7 @@ import {
|
|
|
28
30
|
refPrefixes,
|
|
29
31
|
ShallowRemoteRejectedError,
|
|
30
32
|
type FetchOptions as TransportFetchOptions,
|
|
33
|
+
type UploadPackConnection,
|
|
31
34
|
} from "@statewalker/vcs-transport";
|
|
32
35
|
import { parseGitBool } from "@statewalker/vcs-utils";
|
|
33
36
|
import { parseGitInt } from "@statewalker/vcs-utils/encoding";
|
|
@@ -46,22 +49,36 @@ import { RemoteConfigStore } from "../remote-config/index.js";
|
|
|
46
49
|
import type { CloneResult } from "../results/clone-result.js";
|
|
47
50
|
import type { FetchResult, TrackingRefUpdate } from "../results/fetch-result.js";
|
|
48
51
|
import { TransportCommand } from "../transport-command.js";
|
|
52
|
+
import {
|
|
53
|
+
BundleList,
|
|
54
|
+
BundlePrerequisitesError,
|
|
55
|
+
fetchBundleList,
|
|
56
|
+
fetchBundleUri,
|
|
57
|
+
parseBundleListLine,
|
|
58
|
+
} from "./bundle/index.js";
|
|
49
59
|
import { coreBool, worktreeModeTrust } from "./core-config.js";
|
|
50
|
-
import {
|
|
60
|
+
import {
|
|
61
|
+
defaultInitialBranch,
|
|
62
|
+
UnsupportedObjectStorageError,
|
|
63
|
+
unknownObjectStorageFormat,
|
|
64
|
+
} from "./default-branch.js";
|
|
51
65
|
import { TagOption, toTagMode, toTrackingRefUpdate } from "./fetch-command.js";
|
|
52
66
|
import { fetchFsckOf } from "./fsck/index.js";
|
|
53
67
|
import { runPostCheckoutHook } from "./git-hooks.js";
|
|
54
68
|
import { hostEnvironmentOf } from "./git-ident.js";
|
|
55
69
|
import { copyLocalObjects } from "./local-clone.js";
|
|
56
70
|
import { promisorOf } from "./promisor-remote.js";
|
|
71
|
+
import { promisorRemoteReplyOf } from "./promisor-remote-reply.js";
|
|
57
72
|
import { reflogMessages } from "./reflog-messages.js";
|
|
58
73
|
import { isValidRemoteName } from "./remote-command.js";
|
|
59
74
|
import { withRemoteUploadPack } from "./remote-transport.js";
|
|
75
|
+
import { clientSessionIdOf } from "./session-id.js";
|
|
60
76
|
import { SparseCheckoutCommand } from "./sparse-checkout-command.js";
|
|
61
77
|
import { SparseUnpack } from "./sparse-checkout-support.js";
|
|
62
78
|
import { SubmoduleCommandError, type SubmoduleCommandResult } from "./submodule-commands.js";
|
|
63
79
|
import { SubmoduleUpdateCommand } from "./submodule-update-command.js";
|
|
64
80
|
import { checkoutFreshTree } from "./tree-restore.js";
|
|
81
|
+
import { uriProtocolsOption } from "./uri-protocols.js";
|
|
65
82
|
import { worktreePathRules } from "./worktree-path-rules.js";
|
|
66
83
|
import { repositoryPlaceOf, worktreeAdminWorkingCopy } from "./worktree-support.js";
|
|
67
84
|
|
|
@@ -94,6 +111,7 @@ const CLONE_SETTINGS = [
|
|
|
94
111
|
"dissociate",
|
|
95
112
|
"references",
|
|
96
113
|
"recurseSubmodules",
|
|
114
|
+
"objectStorageFormat",
|
|
97
115
|
"shallowSubmodules",
|
|
98
116
|
"alsoFilterSubmodules",
|
|
99
117
|
"remoteSubmodules",
|
|
@@ -101,9 +119,13 @@ const CLONE_SETTINGS = [
|
|
|
101
119
|
"timeout",
|
|
102
120
|
"headers",
|
|
103
121
|
"gzipRequests",
|
|
122
|
+
"credentialHelper",
|
|
123
|
+
"warningCallback",
|
|
104
124
|
"progressCallback",
|
|
105
125
|
"progressMessageCallback",
|
|
126
|
+
"progress",
|
|
106
127
|
"transportRegistry",
|
|
128
|
+
"bundles",
|
|
107
129
|
"useReplaceRefsOverride",
|
|
108
130
|
"reflogActionOverride",
|
|
109
131
|
];
|
|
@@ -199,6 +221,7 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
199
221
|
private serverOptions: string[] = [];
|
|
200
222
|
/** The git version reproduced; default the hooks' */
|
|
201
223
|
private compatibility?: "2.43" | "2.56";
|
|
224
|
+
private bundleUri?: string;
|
|
202
225
|
private cloneAllBranches = true;
|
|
203
226
|
private mirror = false;
|
|
204
227
|
private singleBranch?: boolean;
|
|
@@ -215,6 +238,7 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
215
238
|
private references: { path: string; required: boolean }[] = [];
|
|
216
239
|
/** `--recurse-submodules[=<pathspec>]` values, in the order given */
|
|
217
240
|
private recurseSubmodules: string[] = [];
|
|
241
|
+
private objectStorageFormat?: string;
|
|
218
242
|
private shallowSubmodules = false;
|
|
219
243
|
/** `--[no-]also-filter-submodules`; unset: `clone.filterSubmodules` */
|
|
220
244
|
private alsoFilterSubmodules?: boolean;
|
|
@@ -271,6 +295,23 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
271
295
|
return this.branch;
|
|
272
296
|
}
|
|
273
297
|
|
|
298
|
+
/**
|
|
299
|
+
* `git clone --bundle-uri=<uri>`: before fetching from the remote, the bundle (or bundle
|
|
300
|
+
* list) at `uri` is downloaded and applied, its refs written under `refs/bundles/`
|
|
301
|
+
* (bundle-uri.c's `fetch_bundle_uri`), so the fetch asks only for what the bundles lack.
|
|
302
|
+
* `uri` is an `http(s)://` URL, a `file://` URL or a path (relative to the worktree top).
|
|
303
|
+
* A failure only warns (`CloneResult.messages`). A list using the `creationToken`
|
|
304
|
+
* heuristic is remembered as `fetch.bundleURI` (later fetches download its new bundles),
|
|
305
|
+
* with `fetch.bundleCreationToken`. Without it, `transfer.bundleURI=true` asks a protocol
|
|
306
|
+
* v2 server for its bundle list (the `bundle-uri` command). Refused with a shallow clone,
|
|
307
|
+
* as git.
|
|
308
|
+
*/
|
|
309
|
+
setBundleUri(uri: string): this {
|
|
310
|
+
this.checkCallable();
|
|
311
|
+
this.bundleUri = uri;
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
314
|
+
|
|
274
315
|
/**
|
|
275
316
|
* Set shallow clone depth.
|
|
276
317
|
*
|
|
@@ -709,6 +750,19 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
709
750
|
* `protocol.file.allow=always`. Credentials and headers reach a submodule's URL only as
|
|
710
751
|
* `SubmoduleUpdateCommand.setCredentials` allows (the clone's own origin).
|
|
711
752
|
*/
|
|
753
|
+
/**
|
|
754
|
+
* `--object-storage-format=<format>`: the clone's object storage (git master). `files` is
|
|
755
|
+
* the repository as always and is passed on to the submodules a recursive clone makes; a
|
|
756
|
+
* name git does not know dies as git (`unknown object storage format '<v>'`), and
|
|
757
|
+
* `files://<directory>`, objects outside `objects/`, which we do not read, is refused
|
|
758
|
+
* before anything is fetched (`UnsupportedObjectStorageError`).
|
|
759
|
+
*/
|
|
760
|
+
setObjectStorageFormat(format: string): this {
|
|
761
|
+
this.checkCallable();
|
|
762
|
+
this.objectStorageFormat = format;
|
|
763
|
+
return this;
|
|
764
|
+
}
|
|
765
|
+
|
|
712
766
|
setRecurseSubmodules(recurse: boolean | string[]): this {
|
|
713
767
|
this.checkCallable();
|
|
714
768
|
this.recurseSubmodules = recurse === true ? ["."] : recurse === false ? [] : [...recurse];
|
|
@@ -808,6 +862,14 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
808
862
|
if (!this.uri) {
|
|
809
863
|
throw new InvalidRemoteError("", "URI must be specified for clone");
|
|
810
864
|
}
|
|
865
|
+
// cmd_clone: the object storage format is checked with the options, before anything
|
|
866
|
+
if (this.objectStorageFormat !== undefined) {
|
|
867
|
+
const unknown = unknownObjectStorageFormat(this.objectStorageFormat, "uri");
|
|
868
|
+
if (unknown) throw new GitApiError(unknown);
|
|
869
|
+
if (objectStorageFormatByUri(this.objectStorageFormat)?.payload !== undefined) {
|
|
870
|
+
throw new UnsupportedObjectStorageError(this.objectStorageFormat);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
811
873
|
// cmd_clone: what --recurse-submodules adds to the -c values (option_config)
|
|
812
874
|
const submoduleConfig: string[] = [];
|
|
813
875
|
if (this.recurseSubmodules.length > 0) {
|
|
@@ -851,6 +913,19 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
851
913
|
});
|
|
852
914
|
}
|
|
853
915
|
|
|
916
|
+
if (
|
|
917
|
+
this.bundleUri !== undefined &&
|
|
918
|
+
(this.depth !== undefined ||
|
|
919
|
+
this.shallowSince !== undefined ||
|
|
920
|
+
this.shallowExcludes.length > 0)
|
|
921
|
+
) {
|
|
922
|
+
throw new GitApiError(
|
|
923
|
+
compatibility === "2.43"
|
|
924
|
+
? "fatal: --bundle-uri is incompatible with --depth, --shallow-since, and --shallow-exclude"
|
|
925
|
+
: "fatal: options '--bundle-uri' and '--depth/--shallow-since/--shallow-exclude' cannot be used together",
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
|
|
854
929
|
// clone.c: the source is a path or a URL before anything else (get_repo_path): an
|
|
855
930
|
// existing repository path becomes absolute (remote.<name>.url, the reflog), a name with
|
|
856
931
|
// a colon is a URL, anything else is "does not exist", never rewritten. The URL connected
|
|
@@ -861,12 +936,38 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
861
936
|
const uri = this.uri;
|
|
862
937
|
// a bare repository's working copy opens it from its git directory
|
|
863
938
|
const worktree = repositoryPlaceOf(this.workingCopy);
|
|
939
|
+
// a repository whose format we cannot open (an `extensions.objectStorage` payload, which
|
|
940
|
+
// git master clones non-locally) is refused with that format, never "does not exist"
|
|
941
|
+
let formatRefusal: Error | undefined;
|
|
864
942
|
const isRepositoryPath = await worktree
|
|
865
943
|
?.openRepository?.(uri, { checkOwnership: false, commandLineConfig: false })
|
|
866
944
|
.then((opened) => opened !== undefined)
|
|
867
|
-
.catch(() =>
|
|
945
|
+
.catch((error: unknown) => {
|
|
946
|
+
if (error instanceof Error && error.name === "UnsupportedRepositoryFormatError") {
|
|
947
|
+
formatRefusal = error;
|
|
948
|
+
}
|
|
949
|
+
return false;
|
|
950
|
+
});
|
|
951
|
+
if (formatRefusal) throw new TransportError(`fatal: ${formatRefusal.message}`);
|
|
952
|
+
// get_repo_path: then a regular file, `<path>.bundle` first (a bundle: the transport reads
|
|
953
|
+
// it there, remote.<name>.url keeps the path as given)
|
|
954
|
+
let bundleFile: string | undefined;
|
|
955
|
+
const givenBundle = this.hasGivenBundle(uri);
|
|
956
|
+
if (givenBundle) {
|
|
957
|
+
// a bundle given as bytes (addBundle): its URL as given
|
|
958
|
+
bundleFile = uri;
|
|
959
|
+
} else if (!isRepositoryPath) {
|
|
960
|
+
for (const suffix of [".bundle", ""]) {
|
|
961
|
+
const bytes = await worktree?.readLocalFile?.(`${uri}${suffix}`).catch(() => undefined);
|
|
962
|
+
if (bytes) {
|
|
963
|
+
bundleFile = absolutePathOf(worktree, `${uri}${suffix}`);
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
868
968
|
let repo: string;
|
|
869
|
-
if (
|
|
969
|
+
if (givenBundle) repo = uri;
|
|
970
|
+
else if (isRepositoryPath || bundleFile !== undefined) repo = absolutePathOf(worktree, uri);
|
|
870
971
|
else if (uri.includes(":")) repo = uri;
|
|
871
972
|
else throw new TransportError(`fatal: repository '${uri}' does not exist`);
|
|
872
973
|
// clone.c: a destination that exists and is not empty is refused before anything is
|
|
@@ -913,7 +1014,10 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
913
1014
|
|
|
914
1015
|
this.repoUrl = repo;
|
|
915
1016
|
const sourceUrl = store.aliasUrl(repo) ?? repo;
|
|
916
|
-
const remote = await this.prepareRemote(sourceUrl);
|
|
1017
|
+
const remote = await this.prepareRemote(bundleFile ?? sourceUrl);
|
|
1018
|
+
if (remote.kind === "bundle" && remote.remote.bundle.header.filter !== undefined) {
|
|
1019
|
+
throw new TransportError("fatal: cannot clone from filtered bundle");
|
|
1020
|
+
}
|
|
917
1021
|
const localRemote: OpenedRepository | undefined =
|
|
918
1022
|
remote.kind === "local" ? remote.repository : undefined;
|
|
919
1023
|
if (localRemote) await this.refuseSourceAsDestination(localRemote);
|
|
@@ -1116,7 +1220,11 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1116
1220
|
baseDir: await this.hostWorkingDir(),
|
|
1117
1221
|
});
|
|
1118
1222
|
|
|
1223
|
+
const sessionId = clientSessionIdOf(this.workingCopy);
|
|
1119
1224
|
const fetchOptions: TransportFetchOptions = {
|
|
1225
|
+
...(sessionId !== undefined ? { sessionId } : {}),
|
|
1226
|
+
// fetch.uriProtocols: the packs a v2 server offloads to packfile URIs
|
|
1227
|
+
...uriProtocolsOption(RemoteConfigStore.from(this.workingCopy).value("fetch.uriprotocols")),
|
|
1120
1228
|
url: sourceUrl,
|
|
1121
1229
|
auth: this.credentials,
|
|
1122
1230
|
headers: this.headers,
|
|
@@ -1130,6 +1238,8 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1130
1238
|
deepenSince: shallowSince,
|
|
1131
1239
|
deepenNot: shallowExcludes.length > 0 ? shallowExcludes : undefined,
|
|
1132
1240
|
onProgress: this.progressMessageCallback,
|
|
1241
|
+
// index-pack's "Receiving objects" and "Resolving deltas"
|
|
1242
|
+
...(this.progress ? { progress: this.progress } : {}),
|
|
1133
1243
|
// git's write_remote_refs: one initial transaction (packed-refs), no reflog; the
|
|
1134
1244
|
// followed tags of a single-branch clone each on their own (write_followtags)
|
|
1135
1245
|
skipReflog: true,
|
|
@@ -1139,9 +1249,11 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1139
1249
|
// clone.c sets TRANS_OPT_KEEP: the pack is kept whatever its size
|
|
1140
1250
|
keepPack: true,
|
|
1141
1251
|
// --filter (TRANS_OPT_LIST_OBJECTS_FILTER, TRANS_OPT_FROM_PROMISOR); not in a local clone
|
|
1142
|
-
...(this.filterSpec !== undefined && !isLocal
|
|
1143
|
-
|
|
1144
|
-
|
|
1252
|
+
...(this.filterSpec !== undefined && !isLocal ? { filter: this.filterSpec } : {}),
|
|
1253
|
+
// the transport's warnings (a filter the server ignores, the dumb walker's alternates)
|
|
1254
|
+
onWarning: (line: string) => messages.push(`${line}\n`),
|
|
1255
|
+
// the server's promisor-remote capability (promisor.acceptFromServer, storeFields)
|
|
1256
|
+
promisorRemote: promisorRemoteReplyOf(this.workingCopy, (line) => messages.push(`${line}\n`)),
|
|
1145
1257
|
...(fsck ? { fsckObjects: fsck } : {}),
|
|
1146
1258
|
...(serverOptions.length > 0 ? { serverOptions } : {}),
|
|
1147
1259
|
...(rejectShallow ? { rejectShallow: true } : {}),
|
|
@@ -1178,11 +1290,23 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1178
1290
|
"fatal: server options require protocol version 2 or later",
|
|
1179
1291
|
);
|
|
1180
1292
|
}
|
|
1181
|
-
|
|
1293
|
+
// the bundles come after the ref listing and before anything is fetched (or a local
|
|
1294
|
+
// clone's objects copied)
|
|
1295
|
+
const copy = fetchOptions.beforeFetch;
|
|
1296
|
+
return fetchFromConnection(connection, {
|
|
1297
|
+
...fetchOptions,
|
|
1298
|
+
beforeFetch: async (remoteRefs, refMap) => {
|
|
1299
|
+
await this.cloneBundles(connection, sourceUrl, compatibility, messages);
|
|
1300
|
+
return copy?.(remoteRefs, refMap);
|
|
1301
|
+
},
|
|
1302
|
+
});
|
|
1182
1303
|
}).catch((error: unknown) => {
|
|
1183
1304
|
if (error instanceof ShallowRemoteRejectedError) {
|
|
1184
1305
|
throw new TransportError(`fatal: ${error.message}`);
|
|
1185
1306
|
}
|
|
1307
|
+
if (error instanceof BundlePrerequisitesError) {
|
|
1308
|
+
throw new TransportError(`${error.lines}fatal: remote transport reported error`);
|
|
1309
|
+
}
|
|
1186
1310
|
if (!(error instanceof FetchCheckError)) throw error;
|
|
1187
1311
|
// what was received is refused before any ref is written: index-pack died, or
|
|
1188
1312
|
// update_remote_refs' check of the refs found history missing (git then removes the
|
|
@@ -1206,7 +1330,24 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1206
1330
|
// Two forms, deliberately kept apart: the advertised form goes out on
|
|
1207
1331
|
// FetchResult unchanged (it is what the remote said), while the ref work
|
|
1208
1332
|
// below and CloneResult use the bare branch name.
|
|
1209
|
-
|
|
1333
|
+
// guess_remote_head: without HEAD's symref (a bundle, a dumb server), the branch at HEAD's
|
|
1334
|
+
// commit among the refs cloned: init.defaultBranch's (else master), then master, then the
|
|
1335
|
+
// first in the remote's order
|
|
1336
|
+
let advertisedDefaultBranch = result.defaultBranch;
|
|
1337
|
+
const remoteHeadRef = result.remoteRefs.find((r) => r.name === "HEAD");
|
|
1338
|
+
if (advertisedDefaultBranch === undefined && remoteHeadRef?.oid !== undefined) {
|
|
1339
|
+
const cloned = new Set(result.fetched.map((f) => f.remoteRef));
|
|
1340
|
+
const branches = result.remoteRefs.filter(
|
|
1341
|
+
(r) =>
|
|
1342
|
+
r.name.startsWith("refs/heads/") && cloned.has(r.name) && r.oid === remoteHeadRef.oid,
|
|
1343
|
+
);
|
|
1344
|
+
const preferred = (await defaultInitialBranch(hostEnvironmentOf(this._workingCopy))).name;
|
|
1345
|
+
advertisedDefaultBranch = (
|
|
1346
|
+
branches.find((r) => r.name === `refs/heads/${preferred}`) ??
|
|
1347
|
+
branches.find((r) => r.name === "refs/heads/master") ??
|
|
1348
|
+
branches[0]
|
|
1349
|
+
)?.name;
|
|
1350
|
+
}
|
|
1210
1351
|
let defaultBranch = branchToClone ?? toBranchName(advertisedDefaultBranch);
|
|
1211
1352
|
let headCommit: ObjectId | undefined;
|
|
1212
1353
|
let checkedOutBranch: string | undefined;
|
|
@@ -1262,6 +1403,17 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1262
1403
|
headCommit = id;
|
|
1263
1404
|
if (!this.bare && !this.noCheckout) checkoutId = id;
|
|
1264
1405
|
}
|
|
1406
|
+
} else if (
|
|
1407
|
+
defaultBranch === undefined &&
|
|
1408
|
+
remoteHeadRef?.oid !== undefined &&
|
|
1409
|
+
!result.isEmpty &&
|
|
1410
|
+
(await history.commits.has(remoteHeadRef.oid).catch(() => false))
|
|
1411
|
+
) {
|
|
1412
|
+
// update_head's `else if (remote)`: a remote HEAD no branch matches (a bundle made from
|
|
1413
|
+
// `HEAD topic`) detaches HEAD at its commit
|
|
1414
|
+
await this.refsStore.set("HEAD", remoteHeadRef.oid, cloneLog);
|
|
1415
|
+
headCommit = remoteHeadRef.oid;
|
|
1416
|
+
if (!this.bare && !this.noCheckout) checkoutId = remoteHeadRef.oid;
|
|
1265
1417
|
} else if (defaultBranch && !this.bare) {
|
|
1266
1418
|
// The local branch starts at the tracking ref the clone just wrote
|
|
1267
1419
|
const localRef = `refs/heads/${defaultBranch}`;
|
|
@@ -1326,6 +1478,19 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1326
1478
|
...(messages.length > 0 ? { messages } : {}),
|
|
1327
1479
|
};
|
|
1328
1480
|
|
|
1481
|
+
// clone.c's checkout(): a HEAD that names no commit (a remote without HEAD, such as a
|
|
1482
|
+
// bundle without one) leaves nothing to check out
|
|
1483
|
+
if (
|
|
1484
|
+
checkoutId === undefined &&
|
|
1485
|
+
!this.bare &&
|
|
1486
|
+
!this.noCheckout &&
|
|
1487
|
+
!result.isEmpty &&
|
|
1488
|
+
headCommit === undefined
|
|
1489
|
+
) {
|
|
1490
|
+
messages.push("warning: remote HEAD refers to nonexistent ref, unable to checkout\n");
|
|
1491
|
+
if (cloneResult.messages === undefined) cloneResult.messages = messages;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1329
1494
|
// dissociate_from_references: before the checkout, the borrowed objects copied in
|
|
1330
1495
|
// (a store without alternates has nothing to dissociate from)
|
|
1331
1496
|
if (this.dissociate) await history.objects?.alternates?.dissociate?.();
|
|
@@ -1364,6 +1529,68 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1364
1529
|
* --no-fetch] [--filter=<spec>] [--[no-]single-branch]` in the new repository: what it
|
|
1365
1530
|
* printed and its exit status.
|
|
1366
1531
|
*/
|
|
1532
|
+
/**
|
|
1533
|
+
* clone.c's bundle step: `--bundle-uri` (`fetch_bundle_uri`, `fetch.bundleURI` stored for a
|
|
1534
|
+
* `creationToken` list), else, under `transfer.bundleURI`, the server's list
|
|
1535
|
+
* (`transport_get_remote_bundle_uri`, `fetch_bundle_list`); warnings into `messages`.
|
|
1536
|
+
*/
|
|
1537
|
+
private async cloneBundles(
|
|
1538
|
+
connection: UploadPackConnection,
|
|
1539
|
+
remoteUrl: string,
|
|
1540
|
+
compatibility: "2.43" | "2.56",
|
|
1541
|
+
messages: string[],
|
|
1542
|
+
): Promise<void> {
|
|
1543
|
+
const store = RemoteConfigStore.from(this.workingCopy);
|
|
1544
|
+
const message = (line: string) => messages.push(`${line}\n`);
|
|
1545
|
+
const worktree = repositoryPlaceOf(this.workingCopy);
|
|
1546
|
+
const host = this.bundleUriHost({
|
|
1547
|
+
remoteUrl,
|
|
1548
|
+
compatibility,
|
|
1549
|
+
message,
|
|
1550
|
+
setConfigValue: (key, value) => this.writeConfigValue(key, value, "add"),
|
|
1551
|
+
// odb_mkstemp's `<objects>/bundles/tmp_uri_XXXXXX`, as git's errors name the list
|
|
1552
|
+
tempFileName: () =>
|
|
1553
|
+
absolutePathOf(
|
|
1554
|
+
worktree,
|
|
1555
|
+
`${this.bare ? "" : ".git/"}objects/bundles/tmp_uri_${randomSuffix()}`,
|
|
1556
|
+
),
|
|
1557
|
+
});
|
|
1558
|
+
if (this.bundleUri !== undefined) {
|
|
1559
|
+
const fetched = await fetchBundleUri(host, this.bundleUri);
|
|
1560
|
+
if (!fetched.ok) {
|
|
1561
|
+
message(`warning: failed to fetch objects from bundle URI '${this.bundleUri}'`);
|
|
1562
|
+
} else if (fetched.hasHeuristic) {
|
|
1563
|
+
await this.writeConfigValue("fetch.bundleuri", this.bundleUri, "add");
|
|
1564
|
+
}
|
|
1565
|
+
return;
|
|
1566
|
+
}
|
|
1567
|
+
// transport_get_remote_bundle_uri: only under transfer.bundleURI, only from a v2 server
|
|
1568
|
+
// advertising `bundle-uri`
|
|
1569
|
+
const enabled = store.value("transfer.bundleURI");
|
|
1570
|
+
if (enabled === undefined || parseGitBool(enabled) !== true) return;
|
|
1571
|
+
if (connection.version !== 2 || !connection.capabilities.has("bundle-uri")) return;
|
|
1572
|
+
const list = new BundleList(remoteUrl);
|
|
1573
|
+
const lines = await bundleUriLines(connection);
|
|
1574
|
+
// get_remote_bundle_uri: the first bad line is reported (its number counted from 2), the
|
|
1575
|
+
// rest read but not parsed
|
|
1576
|
+
let failed = false;
|
|
1577
|
+
lines.forEach((line, index) => {
|
|
1578
|
+
if (failed) return;
|
|
1579
|
+
const parseMessages: string[] = [];
|
|
1580
|
+
const error = parseBundleListLine(list, line, parseMessages);
|
|
1581
|
+
for (const m of parseMessages) message(m);
|
|
1582
|
+
if (error === undefined) return;
|
|
1583
|
+
if (error) message(error);
|
|
1584
|
+
message(`error: error on bundle-uri response line ${index + 2}: ${line}`);
|
|
1585
|
+
failed = true;
|
|
1586
|
+
});
|
|
1587
|
+
if (failed) message("error: could not retrieve server-advertised bundle-uri list");
|
|
1588
|
+
if (list.size === 0) return;
|
|
1589
|
+
if (!(await fetchBundleList(host, list))) {
|
|
1590
|
+
message("warning: failed to fetch advertised bundles");
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1367
1594
|
private async updateSubmodules(): Promise<SubmoduleCommandResult> {
|
|
1368
1595
|
const store = RemoteConfigStore.from(this.workingCopy);
|
|
1369
1596
|
const configured = store.value("clone.filterSubmodules");
|
|
@@ -1378,6 +1605,8 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1378
1605
|
if (this.shallowSubmodules) update.setDepth(1);
|
|
1379
1606
|
if (this.remoteSubmodules) update.setRemote(true).setNoFetch(true);
|
|
1380
1607
|
if (filterSubmodules && this.filterSpec !== undefined) update.setFilter(this.filterSpec);
|
|
1608
|
+
// object_storage_format_to_name: the name alone (`files`), never a payload
|
|
1609
|
+
if (this.objectStorageFormat !== undefined) update.setObjectStorageFormat("files");
|
|
1381
1610
|
// option_single_branch, settled before (a deepening clone is a single-branch one, a
|
|
1382
1611
|
// --revision clone none): always passed on, as --single-branch or --no-single-branch
|
|
1383
1612
|
update.setSingleBranch(
|
|
@@ -1392,6 +1621,8 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1392
1621
|
if (this.credentials) update.setCredentials(this.credentials);
|
|
1393
1622
|
if (this.headers) update.setHeaders(this.headers);
|
|
1394
1623
|
if (this.timeout !== undefined) update.setTimeout(this.timeout);
|
|
1624
|
+
if (this.credentialHelper) update.setCredentialHelper(this.credentialHelper);
|
|
1625
|
+
if (this.warningCallback) update.setWarningCallback(this.warningCallback);
|
|
1395
1626
|
try {
|
|
1396
1627
|
return await update.call();
|
|
1397
1628
|
} catch (error) {
|
|
@@ -1780,6 +2011,7 @@ export class CloneCommand extends TransportCommand<CloneResult> {
|
|
|
1780
2011
|
ignoreCase: coreBool(this.workingCopy, "ignorecase", false),
|
|
1781
2012
|
pathRules: worktreePathRules(this.workingCopy, worktree),
|
|
1782
2013
|
...(sparse ? { writes: (path: string) => sparse.writes(path) } : {}),
|
|
2014
|
+
...(this.progress ? { progress: this.progress } : {}),
|
|
1783
2015
|
},
|
|
1784
2016
|
commit.tree,
|
|
1785
2017
|
CLONE,
|
|
@@ -1883,6 +2115,14 @@ function withConfiguredRefspecs(
|
|
|
1883
2115
|
* after the directory clone runs in (the worktree top, as the host sees it when the storage
|
|
1884
2116
|
* has a root directory), without resolving `..` (git writes `/top/../src`).
|
|
1885
2117
|
*/
|
|
2118
|
+
/** mkstemp's six random characters. */
|
|
2119
|
+
function randomSuffix(): string {
|
|
2120
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
2121
|
+
let out = "";
|
|
2122
|
+
for (let i = 0; i < 6; i++) out += chars[Math.floor(Math.random() * chars.length)];
|
|
2123
|
+
return out;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
1886
2126
|
function absolutePathOf(
|
|
1887
2127
|
worktree: Pick<Worktree, "getRoot" | "getFiles"> | undefined,
|
|
1888
2128
|
path: string,
|
|
@@ -123,6 +123,11 @@ import { worktreePathRules } from "./worktree-path-rules.js";
|
|
|
123
123
|
export interface CommitResult extends Commit {
|
|
124
124
|
/** The ObjectId of the created commit */
|
|
125
125
|
id: ObjectId;
|
|
126
|
+
/**
|
|
127
|
+
* What rerere printed on stderr after the commit (`Recorded resolution for 'f'.`), absent
|
|
128
|
+
* when it said nothing
|
|
129
|
+
*/
|
|
130
|
+
rerereOutput?: string[];
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
/**
|
|
@@ -2290,10 +2295,12 @@ export class CommitCommand extends GitCommand<CommitResult> {
|
|
|
2290
2295
|
this.setCallable(false);
|
|
2291
2296
|
|
|
2292
2297
|
// the commit ends what was in progress (git's sequencer_post_commit_cleanup and the
|
|
2293
|
-
// state files cmd_commit unlinks), then the new index (commit_index_files)
|
|
2294
|
-
// a merge's autostash
|
|
2298
|
+
// state files cmd_commit unlinks), then the new index (commit_index_files)
|
|
2295
2299
|
await this.cleanupAfterCommit(state, info.commitIndex);
|
|
2296
2300
|
|
|
2301
|
+
// repo_rerere: the resolutions of the paths MERGE_RR lists recorded
|
|
2302
|
+
const rerereOutput = await this.rerere();
|
|
2303
|
+
|
|
2297
2304
|
// the post-commit hook, over the index (whatever the commit recorded)
|
|
2298
2305
|
if (this.hooks.enabled) {
|
|
2299
2306
|
await this.hooks.run("post-commit", {
|
|
@@ -2314,8 +2321,13 @@ export class CommitCommand extends GitCommand<CommitResult> {
|
|
|
2314
2321
|
}
|
|
2315
2322
|
}
|
|
2316
2323
|
|
|
2324
|
+
// apply_autostash_ref(MERGE_AUTOSTASH) comes last in cmd_commit: after rerere recorded
|
|
2325
|
+
// the resolutions and after the post-commit and post-rewrite hooks, which all see the
|
|
2326
|
+
// committed files without the stashed changes
|
|
2327
|
+
await this.applyMergeAutostash(state);
|
|
2328
|
+
|
|
2317
2329
|
// Return commit with its ID (like JGit's RevCommit)
|
|
2318
|
-
return { ...commit, id: commitId };
|
|
2330
|
+
return { ...commit, id: commitId, ...(rerereOutput.length > 0 ? { rerereOutput } : {}) };
|
|
2319
2331
|
}
|
|
2320
2332
|
|
|
2321
2333
|
/** The host directory the signing program runs in, if the repository has one. */
|
|
@@ -2447,7 +2459,8 @@ export class CommitCommand extends GitCommand<CommitResult> {
|
|
|
2447
2459
|
/**
|
|
2448
2460
|
* After the commit: the merge state removed (MERGE_HEAD, MERGE_MSG, MERGE_MODE,
|
|
2449
2461
|
* SQUASH_MSG, AUTO_MERGE), a stopped cherry-pick or revert ended (its sequencer state
|
|
2450
|
-
* too once it was the last pick),
|
|
2462
|
+
* too once it was the last pick), as `git commit`; MERGE_AUTOSTASH is applied later
|
|
2463
|
+
* (`applyMergeAutostash`).
|
|
2451
2464
|
*/
|
|
2452
2465
|
private async cleanupAfterCommit(
|
|
2453
2466
|
state: OperationState,
|
|
@@ -2473,6 +2486,11 @@ export class CommitCommand extends GitCommand<CommitResult> {
|
|
|
2473
2486
|
if (left.length <= 1) await state.remove("sequencer");
|
|
2474
2487
|
}
|
|
2475
2488
|
await commitIndex?.();
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
/** MERGE_AUTOSTASH applied back and removed (git's `apply_autostash_ref`). */
|
|
2492
|
+
private async applyMergeAutostash(state: OperationState): Promise<void> {
|
|
2493
|
+
if (!state.supported) return;
|
|
2476
2494
|
const autostash = (await state.read("MERGE_AUTOSTASH"))?.trim();
|
|
2477
2495
|
if (autostash) {
|
|
2478
2496
|
await state.remove("MERGE_AUTOSTASH");
|
|
@@ -512,6 +512,8 @@ export class ConfigCommand extends GitCommand<ConfigCommandResult> {
|
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
514
|
if (outcome.status === 0 || action.kind === "rename-section") await this.reloadConfig();
|
|
515
|
+
// one event per write: a refused edit wrote nothing
|
|
516
|
+
if (outcome.status === 0) this.noteConfigChanged();
|
|
515
517
|
return result(outcome.status, outcome.stderr);
|
|
516
518
|
}
|
|
517
519
|
|
|
@@ -1109,6 +1111,13 @@ export class ConfigCommand extends GitCommand<ConfigCommandResult> {
|
|
|
1109
1111
|
if (config instanceof GitWorkingCopyConfig) await config.load();
|
|
1110
1112
|
}
|
|
1111
1113
|
|
|
1114
|
+
/** Tells the working copy's configuration listeners about a file this command wrote. */
|
|
1115
|
+
private noteConfigChanged(): void {
|
|
1116
|
+
const config = this.workingCopy.config;
|
|
1117
|
+
if (config instanceof GitWorkingCopyConfig) config.noteChanged();
|
|
1118
|
+
else this.workingCopy.listeners?.dispatch({ type: "config-changed" });
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1112
1121
|
/** git's `location_options_init`: the file the scope names. */
|
|
1113
1122
|
private async location(): Promise<ConfigFileLocation> {
|
|
1114
1123
|
const environment = hostEnvironmentOf(this.workingCopy);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git-daemon's `--access-hook` run through the host's hook runner: the program is started as
|
|
3
|
+
* daemon.c's `run_access_hook` starts it (through the shell, `<hook> <service> <path>
|
|
4
|
+
* <hostname> <canonical hostname> <ip> <port>`, no stdin, stderr discarded, stdout read, in
|
|
5
|
+
* the repository's git directory with `REMOTE_ADDR` / `REMOTE_PORT`), and its outcome handed
|
|
6
|
+
* to vcs-transport's `serveGitConnection` / `createGitDaemon`, which refuse as git-daemon does.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const daemon = createGitDaemon({
|
|
11
|
+
* resolveRepository: createBasePathResolver({ files, basePath: "/srv/git", openRepository }),
|
|
12
|
+
* accessHook: daemonAccessHookOf(createNodeHookRunner(), "/usr/local/bin/git-access", { files }),
|
|
13
|
+
* informativeErrors: true,
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { DaemonAccessHook } from "@statewalker/vcs-transport";
|
|
19
|
+
import type { FilesApi } from "@statewalker/vcs-utils/files";
|
|
20
|
+
import type { HookRunner } from "@statewalker/vcs-working-tree";
|
|
21
|
+
|
|
22
|
+
/** Options of {@link daemonAccessHookOf}. */
|
|
23
|
+
export interface DaemonAccessHookOptions {
|
|
24
|
+
/**
|
|
25
|
+
* The storage the resolver found the repository in: with a root directory on the host
|
|
26
|
+
* (`rootDirectory`), the hook is told the host's path and runs in the git directory there,
|
|
27
|
+
* as git-daemon's hook is; without one it gets the storage's paths and the runner's
|
|
28
|
+
* default directory
|
|
29
|
+
*/
|
|
30
|
+
files?: FilesApi;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The host's path of a storage path, where the storage has a root directory. */
|
|
34
|
+
function hostPathOf(files: FilesApi | undefined, path: string): string | undefined {
|
|
35
|
+
const root = (files as { rootDirectory?: string } | undefined)?.rootDirectory;
|
|
36
|
+
if (!root) return undefined;
|
|
37
|
+
const base = root.replace(/\/+$/, "");
|
|
38
|
+
const rest = path.replace(/^\/+/, "");
|
|
39
|
+
return rest ? `${base}/${rest}` : base || "/";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* An access hook running `command` (git-daemon's `--access-hook=<command>`, a shell command)
|
|
44
|
+
* through `runner`; a runner that cannot start it refuses the request ("service rejected"),
|
|
45
|
+
* as git-daemon does when the hook fails to start.
|
|
46
|
+
*/
|
|
47
|
+
export function daemonAccessHookOf(
|
|
48
|
+
runner: HookRunner,
|
|
49
|
+
command: string,
|
|
50
|
+
options: DaemonAccessHookOptions = {},
|
|
51
|
+
): DaemonAccessHook {
|
|
52
|
+
return async (request) => {
|
|
53
|
+
const path = hostPathOf(options.files, request.path) ?? request.path;
|
|
54
|
+
const cwd = request.gitDir ?? "";
|
|
55
|
+
const hostCwd = request.gitDir !== undefined ? hostPathOf(options.files, cwd) : undefined;
|
|
56
|
+
const outcome = await runner.run({
|
|
57
|
+
name: "access-hook",
|
|
58
|
+
path: command,
|
|
59
|
+
command,
|
|
60
|
+
args: [
|
|
61
|
+
request.service,
|
|
62
|
+
path,
|
|
63
|
+
request.hostname,
|
|
64
|
+
request.canonicalHostname,
|
|
65
|
+
request.ipAddress,
|
|
66
|
+
request.port,
|
|
67
|
+
],
|
|
68
|
+
env: {
|
|
69
|
+
...(request.remoteAddress !== undefined ? { REMOTE_ADDR: request.remoteAddress } : {}),
|
|
70
|
+
...(request.remotePort !== undefined ? { REMOTE_PORT: request.remotePort } : {}),
|
|
71
|
+
},
|
|
72
|
+
cwd,
|
|
73
|
+
...(hostCwd !== undefined ? { hostCwd } : {}),
|
|
74
|
+
stdoutToStderr: false,
|
|
75
|
+
});
|
|
76
|
+
return outcome && { exitCode: outcome.exitCode, stdout: outcome.stdout };
|
|
77
|
+
};
|
|
78
|
+
}
|