@statewalker/vcs-commands 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/add-command.d.ts +32 -0
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/add-patch.d.ts +7 -0
- package/dist/commands/add-patch/add-patch.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 +88 -2
- package/dist/commands/am/am-command.d.ts.map +1 -1
- package/dist/commands/apply/apply-command.d.ts +2 -0
- package/dist/commands/apply/apply-command.d.ts.map +1 -1
- package/dist/commands/apply/apply-parse.d.ts +7 -0
- package/dist/commands/apply/apply-parse.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 +345 -8
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/blame-ignore.d.ts +48 -0
- package/dist/commands/blame-ignore.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-create-command.d.ts +67 -0
- package/dist/commands/bundle/bundle-create-command.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-format.d.ts +89 -0
- package/dist/commands/bundle/bundle-format.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-list.d.ts +92 -0
- package/dist/commands/bundle/bundle-list.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-read-commands.d.ts +81 -0
- package/dist/commands/bundle/bundle-read-commands.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-support.d.ts +32 -0
- package/dist/commands/bundle/bundle-support.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-transport.d.ts +38 -0
- package/dist/commands/bundle/bundle-transport.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-uri-host.d.ts +43 -0
- package/dist/commands/bundle/bundle-uri-host.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-uri.d.ts +55 -0
- package/dist/commands/bundle/bundle-uri.d.ts.map +1 -0
- package/dist/commands/bundle/bundle-verify.d.ts +63 -0
- package/dist/commands/bundle/bundle-verify.d.ts.map +1 -0
- package/dist/commands/bundle/index.d.ts +14 -0
- package/dist/commands/bundle/index.d.ts.map +1 -0
- package/dist/commands/cat-file/batch-format.d.ts +58 -0
- package/dist/commands/cat-file/batch-format.d.ts.map +1 -0
- package/dist/commands/cat-file/cat-file-command.d.ts +135 -0
- package/dist/commands/cat-file/cat-file-command.d.ts.map +1 -0
- package/dist/commands/cat-file/index.d.ts +3 -0
- package/dist/commands/cat-file/index.d.ts.map +1 -0
- package/dist/commands/check-attr-command.d.ts +66 -0
- package/dist/commands/check-attr-command.d.ts.map +1 -0
- package/dist/commands/check-ignore-command.d.ts +58 -0
- package/dist/commands/check-ignore-command.d.ts.map +1 -0
- package/dist/commands/check-mailmap-command.d.ts +49 -0
- package/dist/commands/check-mailmap-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 +7 -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/checkout-paths.d.ts +4 -0
- package/dist/commands/checkout-paths.d.ts.map +1 -1
- package/dist/commands/cherry-command.d.ts +61 -0
- package/dist/commands/cherry-command.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +33 -1
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +32 -0
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clean-interactive.d.ts +56 -0
- package/dist/commands/clean-interactive.d.ts.map +1 -0
- package/dist/commands/clone-command.d.ts +135 -2
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +59 -3
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/config-command.d.ts +2 -0
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/daemon-access-hook.d.ts +36 -0
- package/dist/commands/daemon-access-hook.d.ts.map +1 -0
- package/dist/commands/default-branch.d.ts +42 -0
- package/dist/commands/default-branch.d.ts.map +1 -1
- package/dist/commands/describe-command.d.ts +71 -64
- package/dist/commands/describe-command.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +249 -10
- 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 +125 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/fetch-multiple-command.d.ts +193 -0
- package/dist/commands/fetch-multiple-command.d.ts.map +1 -0
- package/dist/commands/format-patch-command.d.ts +28 -2
- package/dist/commands/format-patch-command.d.ts.map +1 -1
- package/dist/commands/format-rev-command.d.ts +58 -0
- package/dist/commands/format-rev-command.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-command.d.ts.map +1 -1
- package/dist/commands/fsck/fsck-msg-ids.d.ts +18 -3
- package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -1
- package/dist/commands/fsmonitor-refresh.d.ts +69 -0
- package/dist/commands/fsmonitor-refresh.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +5 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-describe.d.ts +77 -4
- package/dist/commands/git-describe.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +47 -1
- 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 +56 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +6 -3
- package/dist/commands/init-command.d.ts +89 -0
- 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/line-log.d.ts +161 -0
- package/dist/commands/line-log.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/log-command.d.ts +261 -6
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +4 -2
- package/dist/commands/log-graph.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +88 -2
- 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/mailmap.d.ts +24 -1
- package/dist/commands/mailmap.d.ts.map +1 -1
- 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 +58 -1
- 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 +69 -5
- package/dist/commands/merge-drivers.d.ts.map +1 -1
- package/dist/commands/merge-strategy-options.d.ts +69 -0
- package/dist/commands/merge-strategy-options.d.ts.map +1 -0
- package/dist/commands/merge-support.d.ts +16 -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/message-cleanup.d.ts +2 -0
- package/dist/commands/message-cleanup.d.ts.map +1 -1
- package/dist/commands/mktag-command.d.ts +51 -0
- package/dist/commands/mktag-command.d.ts.map +1 -0
- package/dist/commands/name-rev-command.d.ts +65 -0
- package/dist/commands/name-rev-command.d.ts.map +1 -0
- package/dist/commands/name-rev.d.ts +110 -22
- package/dist/commands/name-rev.d.ts.map +1 -1
- 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/octopus-merge.d.ts +26 -1
- package/dist/commands/octopus-merge.d.ts.map +1 -1
- package/dist/commands/ort-merge.d.ts +40 -0
- package/dist/commands/ort-merge.d.ts.map +1 -1
- package/dist/commands/ort-recursive.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 +82 -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 +182 -38
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +82 -2
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/range-diff/index.d.ts +4 -0
- package/dist/commands/range-diff/index.d.ts.map +1 -0
- package/dist/commands/range-diff/linear-assignment.d.ts +27 -0
- package/dist/commands/range-diff/linear-assignment.d.ts.map +1 -0
- package/dist/commands/range-diff/range-diff-command.d.ts +121 -0
- package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -0
- package/dist/commands/range-diff/range-diff.d.ts +106 -0
- package/dist/commands/range-diff/range-diff.d.ts.map +1 -0
- package/dist/commands/read-tree-command.d.ts +14 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +129 -4
- 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/remerge-diff.d.ts +59 -0
- package/dist/commands/remerge-diff.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +41 -0
- package/dist/commands/remote-command.d.ts.map +1 -1
- 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-show-command.d.ts +204 -0
- package/dist/commands/remote-show-command.d.ts.map +1 -0
- package/dist/commands/remote-transport.d.ts +40 -3
- package/dist/commands/remote-transport.d.ts.map +1 -1
- package/dist/commands/repack-command.d.ts +115 -0
- package/dist/commands/repack-command.d.ts.map +1 -0
- package/dist/commands/replace-command.d.ts +143 -0
- package/dist/commands/replace-command.d.ts.map +1 -0
- package/dist/commands/replay-command.d.ts +117 -0
- package/dist/commands/replay-command.d.ts.map +1 -0
- package/dist/commands/repo-command.d.ts +136 -0
- package/dist/commands/repo-command.d.ts.map +1 -0
- package/dist/commands/request-pull-command.d.ts +82 -0
- package/dist/commands/request-pull-command.d.ts.map +1 -0
- package/dist/commands/rerere-command.d.ts +36 -0
- package/dist/commands/rerere-command.d.ts.map +1 -0
- package/dist/commands/rerere.d.ts +102 -0
- package/dist/commands/rerere.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +19 -1
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +7 -0
- package/dist/commands/restore-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 +78 -3
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/rev-parse-command.d.ts +9 -0
- package/dist/commands/rev-parse-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +32 -1
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +7 -0
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/revision-resolver.d.ts +12 -0
- package/dist/commands/revision-resolver.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +120 -1
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/sequencer-support.d.ts +10 -1
- package/dist/commands/sequencer-support.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/shortlog-command.d.ts +109 -0
- package/dist/commands/shortlog-command.d.ts.map +1 -0
- package/dist/commands/shortlog.d.ts +151 -0
- package/dist/commands/shortlog.d.ts.map +1 -0
- package/dist/commands/show-branch-command.d.ts +59 -0
- package/dist/commands/show-branch-command.d.ts.map +1 -0
- package/dist/commands/show-ref-command.d.ts +112 -0
- package/dist/commands/show-ref-command.d.ts.map +1 -0
- package/dist/commands/signature-check.d.ts +9 -2
- package/dist/commands/signature-check.d.ts.map +1 -1
- package/dist/commands/signing.d.ts +22 -1
- package/dist/commands/signing.d.ts.map +1 -1
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-export-command.d.ts +115 -0
- package/dist/commands/stash-export-command.d.ts.map +1 -0
- package/dist/commands/status-command.d.ts +33 -3
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/stripspace-command.d.ts +44 -0
- package/dist/commands/stripspace-command.d.ts.map +1 -0
- package/dist/commands/submodule-add-command.d.ts +10 -1
- package/dist/commands/submodule-add-command.d.ts.map +1 -1
- package/dist/commands/submodule-auth.d.ts +3 -1
- package/dist/commands/submodule-auth.d.ts.map +1 -1
- package/dist/commands/submodule-commands.d.ts +99 -3
- package/dist/commands/submodule-commands.d.ts.map +1 -1
- package/dist/commands/submodule-fetch.d.ts +149 -0
- package/dist/commands/submodule-fetch.d.ts.map +1 -0
- package/dist/commands/submodule-model.d.ts +8 -0
- package/dist/commands/submodule-model.d.ts.map +1 -1
- package/dist/commands/submodule-unpack.d.ts +120 -0
- package/dist/commands/submodule-unpack.d.ts.map +1 -0
- package/dist/commands/submodule-update-command.d.ts +21 -1
- package/dist/commands/submodule-update-command.d.ts.map +1 -1
- package/dist/commands/subtree-shift.d.ts +27 -0
- package/dist/commands/subtree-shift.d.ts.map +1 -0
- package/dist/commands/switch-command.d.ts +3 -0
- package/dist/commands/switch-command.d.ts.map +1 -1
- package/dist/commands/textconv-cache.d.ts +58 -0
- package/dist/commands/textconv-cache.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +5 -0
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/unpack-objects-command.d.ts +47 -0
- package/dist/commands/unpack-objects-command.d.ts.map +1 -0
- package/dist/commands/update-index-command.d.ts +110 -0
- package/dist/commands/update-index-command.d.ts.map +1 -0
- package/dist/commands/uri-protocols.d.ts +13 -0
- package/dist/commands/uri-protocols.d.ts.map +1 -0
- package/dist/commands/url-parse-command.d.ts +30 -0
- package/dist/commands/url-parse-command.d.ts.map +1 -0
- package/dist/commands/var-command.d.ts +42 -0
- package/dist/commands/var-command.d.ts.map +1 -0
- package/dist/commands/worktree-overwrite-checks.d.ts +2 -0
- package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
- package/dist/{commands-ISM52N0n.js → commands-Mlo1dxQN.js} +56133 -70269
- package/dist/errors/command-errors.d.ts +58 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/index.js +67 -1
- package/dist/fsck-CrhVMNIH.js +5179 -0
- package/dist/git-command.d.ts +89 -3
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +628 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/guarded-transport-command.d.ts +84 -0
- package/dist/guarded-transport-command.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/maintenance-run-command-Bw21HEkH.js +13539 -0
- package/dist/remote-transport-Bu4PGSMD.js +2605 -0
- package/dist/rename/detect-renames.d.ts +20 -0
- package/dist/rename/detect-renames.d.ts.map +1 -1
- package/dist/rename/diffcore-break.d.ts +51 -0
- package/dist/rename/diffcore-break.d.ts.map +1 -0
- package/dist/rename/index.d.ts +1 -0
- package/dist/rename/index.d.ts.map +1 -1
- package/dist/results/blame-format.d.ts +62 -1
- package/dist/results/blame-format.d.ts.map +1 -1
- package/dist/results/cherry-pick-result.d.ts +6 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -1
- package/dist/results/clone-result.d.ts +9 -0
- package/dist/results/clone-result.d.ts.map +1 -1
- package/dist/results/diff-dirstat.d.ts +36 -0
- package/dist/results/diff-dirstat.d.ts.map +1 -0
- package/dist/results/diff-entry.d.ts +20 -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 +67 -3
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/fetch-result.d.ts +24 -1
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.d.ts +2 -0
- package/dist/results/index.d.ts.map +1 -1
- package/dist/results/index.js +2 -2
- package/dist/results/init-result.d.ts +8 -1
- package/dist/results/init-result.d.ts.map +1 -1
- package/dist/results/line-range-hunks.d.ts +27 -0
- package/dist/results/line-range-hunks.d.ts.map +1 -0
- package/dist/results/merge-result.d.ts +13 -1
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/pull-result.d.ts +11 -0
- package/dist/results/pull-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +10 -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/status-result.d.ts +1 -1
- package/dist/results/status-result.d.ts.map +1 -1
- package/dist/results-ERo9vELd.js +49673 -0
- package/dist/transport-command.d.ts +93 -1
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/commands/add-command.ts +118 -0
- package/src/commands/add-patch/add-patch.ts +8 -0
- package/src/commands/add-patch/patch-backend.ts +24 -3
- 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 +301 -12
- package/src/commands/apply/apply-command.ts +52 -9
- package/src/commands/apply/apply-parse.ts +10 -0
- package/src/commands/apply/index.ts +9 -1
- 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 +1551 -53
- package/src/commands/blame-ignore.ts +307 -0
- package/src/commands/bundle/bundle-create-command.ts +405 -0
- package/src/commands/bundle/bundle-format.ts +228 -0
- package/src/commands/bundle/bundle-list.ts +276 -0
- package/src/commands/bundle/bundle-read-commands.ts +157 -0
- package/src/commands/bundle/bundle-support.ts +85 -0
- package/src/commands/bundle/bundle-transport.ts +107 -0
- package/src/commands/bundle/bundle-uri-host.ts +204 -0
- package/src/commands/bundle/bundle-uri.ts +236 -0
- package/src/commands/bundle/bundle-verify.ts +152 -0
- package/src/commands/bundle/index.ts +14 -0
- package/src/commands/cat-file/batch-format.ts +193 -0
- package/src/commands/cat-file/cat-file-command.ts +857 -0
- package/src/commands/cat-file/index.ts +2 -0
- package/src/commands/check-attr-command.ts +333 -0
- package/src/commands/check-ignore-command.ts +261 -0
- package/src/commands/check-mailmap-command.ts +129 -0
- package/src/commands/check-ref-format-command.ts +129 -0
- package/src/commands/checkout-command.ts +131 -28
- package/src/commands/checkout-index-command.ts +568 -0
- package/src/commands/checkout-paths.ts +35 -0
- package/src/commands/cherry-command.ts +187 -0
- package/src/commands/cherry-pick-command.ts +63 -2
- package/src/commands/clean-command.ts +92 -12
- package/src/commands/clean-interactive.ts +522 -0
- package/src/commands/clone-command.ts +803 -50
- package/src/commands/commit-command.ts +202 -51
- package/src/commands/config-command.ts +9 -0
- package/src/commands/daemon-access-hook.ts +78 -0
- package/src/commands/default-branch.ts +99 -1
- package/src/commands/describe-command.ts +341 -254
- package/src/commands/diff-command.ts +1186 -99
- 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 +665 -14
- package/src/commands/fetch-multiple-command.ts +668 -0
- package/src/commands/format-patch-command.ts +189 -77
- package/src/commands/format-rev-command.ts +251 -0
- package/src/commands/fsck/fsck-command.ts +47 -20
- package/src/commands/fsck/fsck-msg-ids.ts +19 -3
- package/src/commands/fsck/fsck-pack.ts +2 -2
- package/src/commands/fsmonitor-refresh.ts +315 -0
- package/src/commands/gc-command.ts +10 -0
- package/src/commands/git-describe.ts +456 -217
- package/src/commands/git-hooks.ts +165 -9
- 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 +62 -0
- package/src/commands/init-command.ts +617 -49
- 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/line-log.ts +931 -0
- package/src/commands/local-transport.ts +252 -4
- package/src/commands/log-command.ts +1518 -182
- package/src/commands/log-graph.ts +6 -3
- package/src/commands/log-output.ts +228 -15
- package/src/commands/ls-files-command.ts +1177 -0
- package/src/commands/ls-remote-command.ts +6 -0
- package/src/commands/ls-tree-command.ts +684 -0
- package/src/commands/mailmap.ts +41 -5
- package/src/commands/maintenance-run-command.ts +949 -0
- package/src/commands/merge-command.ts +351 -47
- package/src/commands/merge-config.ts +23 -1
- package/src/commands/merge-drivers.ts +112 -20
- package/src/commands/merge-strategy-options.ts +224 -0
- package/src/commands/merge-support.ts +130 -26
- package/src/commands/merge-tree-command.ts +786 -0
- package/src/commands/message-cleanup.ts +1 -1
- package/src/commands/mktag-command.ts +149 -0
- package/src/commands/name-rev-command.ts +184 -0
- package/src/commands/name-rev.ts +700 -109
- 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/octopus-merge.ts +35 -11
- package/src/commands/ort-merge.ts +124 -23
- package/src/commands/ort-recursive.ts +40 -2
- package/src/commands/patch-id-command.ts +65 -0
- package/src/commands/patch-id.ts +327 -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 +720 -224
- package/src/commands/push-command.ts +440 -8
- package/src/commands/range-diff/index.ts +3 -0
- package/src/commands/range-diff/linear-assignment.ts +203 -0
- package/src/commands/range-diff/range-diff-command.ts +433 -0
- package/src/commands/range-diff/range-diff.ts +617 -0
- package/src/commands/read-tree-command.ts +74 -3
- package/src/commands/rebase-command.ts +647 -83
- package/src/commands/refs-command.ts +274 -0
- package/src/commands/remerge-diff.ts +241 -0
- package/src/commands/remote-command.ts +98 -10
- package/src/commands/remote-object-info-command.ts +109 -0
- package/src/commands/remote-show-command.ts +836 -0
- package/src/commands/remote-transport.ts +116 -1
- package/src/commands/repack-command.ts +383 -0
- package/src/commands/replace-command.ts +816 -0
- package/src/commands/replay-command.ts +674 -0
- package/src/commands/repo-command.ts +967 -0
- package/src/commands/request-pull-command.ts +356 -0
- package/src/commands/rerere-command.ts +179 -0
- package/src/commands/rerere.ts +925 -0
- package/src/commands/reset-command.ts +78 -3
- package/src/commands/restore-command.ts +15 -0
- package/src/commands/rev-filter/commit-grep.ts +7 -2
- package/src/commands/rev-list-command.ts +196 -11
- package/src/commands/rev-parse-command.ts +62 -4
- package/src/commands/revert-command.ts +62 -2
- package/src/commands/revision-range.ts +10 -3
- package/src/commands/revision-resolver.ts +44 -3
- package/src/commands/sequencer-pick.ts +370 -29
- package/src/commands/sequencer-support.ts +164 -2
- package/src/commands/serve-repository.ts +65 -0
- package/src/commands/session-id.ts +31 -0
- package/src/commands/shortlog-command.ts +354 -0
- package/src/commands/shortlog.ts +361 -0
- package/src/commands/show-branch-command.ts +981 -0
- package/src/commands/show-command.ts +3 -2
- package/src/commands/show-ref-command.ts +439 -0
- package/src/commands/signature-check.ts +37 -5
- package/src/commands/signing.ts +122 -16
- package/src/commands/stash-apply-command.ts +3 -0
- package/src/commands/stash-export-command.ts +397 -0
- package/src/commands/status-command.ts +158 -31
- package/src/commands/status-format.ts +1 -1
- package/src/commands/stripspace-command.ts +118 -0
- package/src/commands/submodule-add-command.ts +22 -1
- package/src/commands/submodule-auth.ts +61 -6
- package/src/commands/submodule-commands.ts +333 -5
- package/src/commands/submodule-fetch.ts +789 -0
- package/src/commands/submodule-model.ts +9 -1
- package/src/commands/submodule-unpack.ts +265 -0
- package/src/commands/submodule-update-command.ts +68 -5
- package/src/commands/subtree-shift.ts +215 -0
- package/src/commands/switch-command.ts +9 -0
- package/src/commands/textconv-cache.ts +143 -0
- package/src/commands/tree-restore.ts +20 -1
- package/src/commands/unpack-objects-command.ts +235 -0
- package/src/commands/update-index-command.ts +1016 -0
- package/src/commands/uri-protocols.ts +13 -0
- package/src/commands/url-parse-command.ts +67 -0
- package/src/commands/var-command.ts +219 -0
- package/src/commands/worktree-overwrite-checks.ts +5 -0
- package/src/errors/command-errors.ts +80 -0
- package/src/git-command.ts +218 -2
- package/src/git.ts +1033 -80
- package/src/guarded-transport-command.ts +176 -0
- package/src/index.ts +1 -0
- package/src/rename/detect-renames.ts +42 -8
- package/src/rename/diffcore-break.ts +166 -0
- package/src/rename/index.ts +1 -0
- package/src/results/blame-format.ts +268 -43
- package/src/results/cherry-pick-result.ts +6 -0
- package/src/results/clone-result.ts +6 -0
- package/src/results/diff-dirstat.ts +117 -0
- package/src/results/diff-entry.ts +24 -0
- package/src/results/diff-formatter.ts +8 -4
- package/src/results/diff-output.ts +239 -8
- package/src/results/diff-pickaxe.ts +1 -1
- package/src/results/fetch-result.ts +24 -1
- package/src/results/index.ts +2 -0
- package/src/results/init-result.ts +10 -1
- package/src/results/line-range-hunks.ts +126 -0
- package/src/results/merge-result.ts +14 -0
- package/src/results/pull-result.ts +7 -0
- package/src/results/push-result.ts +10 -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/results/status-result.ts +2 -2
- package/src/transport-command.ts +216 -4
- package/dist/fsck-DLRpbwTj.js +0 -13405
- package/dist/results-TB2IJ64h.js +0 -4700
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `git check-attr` (builtin/check-attr.c): the attributes of paths as git's attribute
|
|
3
|
+
* stack gives them, from the worktree's `.gitattributes` files (then the index's), the
|
|
4
|
+
* index's alone (`--cached`), or a tree's (`--source`).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // git check-attr text eol -- a.txt
|
|
9
|
+
* await git.checkAttr().addAttribute("text").addAttribute("eol").addPath("a.txt").call();
|
|
10
|
+
* // { exitCode: 0, stdout: "a.txt: text: set\na.txt: eol: unspecified\n", stderr: "" }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
AttributesMemo,
|
|
16
|
+
AttributesSourceError,
|
|
17
|
+
type AttributeValue,
|
|
18
|
+
isValidAttributeName,
|
|
19
|
+
type Worktree,
|
|
20
|
+
} from "@statewalker/vcs-working-tree";
|
|
21
|
+
|
|
22
|
+
import { GitCommand } from "../git-command.js";
|
|
23
|
+
import { quotePath } from "../results/quote-path.js";
|
|
24
|
+
import { attributesSourceResolver, bareAttributesResolver } from "./attributes-source.js";
|
|
25
|
+
import type { PlumbingTextOutput } from "./check-ref-format-command.js";
|
|
26
|
+
import { configBool } from "./merge-config.js";
|
|
27
|
+
import { directoryPrefix, inputRecords, prefixPath } from "./plumbing-input.js";
|
|
28
|
+
import { worktreeHostPath } from "./submodule-model.js";
|
|
29
|
+
|
|
30
|
+
const USAGE =
|
|
31
|
+
"usage: git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>...\n" +
|
|
32
|
+
" or: git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]\n\n" +
|
|
33
|
+
" -a, --[no-]all report all attributes set on file\n" +
|
|
34
|
+
" --[no-]cached use .gitattributes only from the index\n" +
|
|
35
|
+
" --[no-]stdin read file names from stdin\n" +
|
|
36
|
+
" -z terminate input and output records by a NUL character\n" +
|
|
37
|
+
" --[no-]source <tree-ish>\n" +
|
|
38
|
+
" which tree-ish to check attributes at\n\n";
|
|
39
|
+
|
|
40
|
+
const S_IFMT = 0o170000;
|
|
41
|
+
const S_IFDIR = 0o040000;
|
|
42
|
+
const S_IFLNK = 0o120000;
|
|
43
|
+
const S_IFGITLINK = 0o160000;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* An attributes file's message as git prints it: its `warning()`s (negative patterns, an
|
|
47
|
+
* overly long line or large file) prefixed, the others (an invalid name, a macro where none
|
|
48
|
+
* is allowed) as they are.
|
|
49
|
+
*/
|
|
50
|
+
export function attributeWarningLine(message: string): string {
|
|
51
|
+
return message.startsWith("Negative patterns") || message.startsWith("ignoring overly")
|
|
52
|
+
? `warning: ${message}`
|
|
53
|
+
: message;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** What reads the attributes of one path. */
|
|
57
|
+
interface AttributeReader {
|
|
58
|
+
get(path: string, names: string[] | undefined): Promise<Map<string, AttributeValue>>;
|
|
59
|
+
order(path: string, order: Set<string>): Promise<unknown>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* `git check-attr [--source <tree-ish>] [--cached] [-a | <attr>...] [--] <pathname>...` or
|
|
64
|
+
* with `--stdin` [-z]: one line per path and attribute, `<path>: <attr>: <value>` (the path
|
|
65
|
+
* as given, C-quoted as `core.quotePath` asks), the value `set`, `unset`, `unspecified` or
|
|
66
|
+
* the string. `--all` lists the attributes a path has, in the order git first read their
|
|
67
|
+
* names. git's argument errors give its usage (129); an invalid attribute name exits 255, a
|
|
68
|
+
* bad `--source` 128. Paths are read against {@link setCurrentDirectory}. git 2.5x computes
|
|
69
|
+
* `builtin_objectmode` (the path's mode in the worktree, or the index's with `--cached`).
|
|
70
|
+
*/
|
|
71
|
+
export class CheckAttrCommand extends GitCommand<PlumbingTextOutput> {
|
|
72
|
+
private readonly attributes: string[] = [];
|
|
73
|
+
private readonly paths: string[] = [];
|
|
74
|
+
private all = false;
|
|
75
|
+
private cached = false;
|
|
76
|
+
private stdin?: Uint8Array;
|
|
77
|
+
private nul = false;
|
|
78
|
+
private source?: string;
|
|
79
|
+
private prefix = "";
|
|
80
|
+
private compatibility: "2.43" | "2.56" = "2.56";
|
|
81
|
+
|
|
82
|
+
/** An attribute to report. */
|
|
83
|
+
addAttribute(name: string): this {
|
|
84
|
+
this.checkCallable();
|
|
85
|
+
this.attributes.push(name);
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** A path to check. */
|
|
90
|
+
addPath(path: string): this {
|
|
91
|
+
this.checkCallable();
|
|
92
|
+
this.paths.push(path);
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** `--all`: every attribute set on each path. */
|
|
97
|
+
setAll(all: boolean): this {
|
|
98
|
+
this.checkCallable();
|
|
99
|
+
this.all = all;
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** `--cached`: the index's `.gitattributes` files only. */
|
|
104
|
+
setCached(cached: boolean): this {
|
|
105
|
+
this.checkCallable();
|
|
106
|
+
this.cached = cached;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** `--stdin`: the paths of this input (git's stdin). */
|
|
111
|
+
setStdin(input: string | Uint8Array): this {
|
|
112
|
+
this.checkCallable();
|
|
113
|
+
this.stdin = typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** `-z`: NUL-terminated input records and output fields. */
|
|
118
|
+
setNulTerminated(nul: boolean): this {
|
|
119
|
+
this.checkCallable();
|
|
120
|
+
this.nul = nul;
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** `--source <tree-ish>`: the in-tree files of this tree-ish. */
|
|
125
|
+
setSource(treeish: string | undefined): this {
|
|
126
|
+
this.checkCallable();
|
|
127
|
+
this.source = treeish;
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** The directory git runs in, from the top of the worktree (paths are relative to it). */
|
|
132
|
+
setCurrentDirectory(dir: string): this {
|
|
133
|
+
this.checkCallable();
|
|
134
|
+
this.prefix = directoryPrefix(dir);
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** The git version whose behaviour to follow (default 2.56). */
|
|
139
|
+
setCompatibility(version: "2.43" | "2.56"): this {
|
|
140
|
+
this.checkCallable();
|
|
141
|
+
this.compatibility = version;
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async call(): Promise<PlumbingTextOutput> {
|
|
146
|
+
this.checkCallable();
|
|
147
|
+
this.setCallable(false);
|
|
148
|
+
const usage = (message: string) => ({
|
|
149
|
+
exitCode: 129,
|
|
150
|
+
stdout: "",
|
|
151
|
+
stderr: `error: ${message}\n${USAGE}`,
|
|
152
|
+
});
|
|
153
|
+
if (this.all && this.attributes.length > 0) return usage("Attributes and --all both specified");
|
|
154
|
+
if (!this.all && this.attributes.length === 0) return usage("No attribute specified");
|
|
155
|
+
if (this.stdin !== undefined && this.paths.length > 0) {
|
|
156
|
+
return usage("Can't specify files with --stdin");
|
|
157
|
+
}
|
|
158
|
+
if (this.stdin === undefined && this.paths.length === 0) return usage("No file specified");
|
|
159
|
+
for (const name of this.attributes) {
|
|
160
|
+
if (!isValidAttributeName(name)) {
|
|
161
|
+
return {
|
|
162
|
+
exitCode: 255,
|
|
163
|
+
stdout: "",
|
|
164
|
+
stderr: `error: ${name}: not a valid attribute name\n`,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
let sourceTree: string | undefined;
|
|
169
|
+
if (this.source !== undefined) {
|
|
170
|
+
const found = await attributesSourceResolver(() => this.revisionResolver())(
|
|
171
|
+
this.source,
|
|
172
|
+
).catch(() => undefined);
|
|
173
|
+
if (!found) {
|
|
174
|
+
return {
|
|
175
|
+
exitCode: 128,
|
|
176
|
+
stdout: "",
|
|
177
|
+
stderr: `fatal: ${this.source}: not a valid tree-ish source\n`,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
sourceTree = found.tree ?? "";
|
|
181
|
+
}
|
|
182
|
+
let stdout = "";
|
|
183
|
+
let stderr = "";
|
|
184
|
+
const warn = (message: string) => {
|
|
185
|
+
stderr += `${attributeWarningLine(message)}\n`;
|
|
186
|
+
};
|
|
187
|
+
const die = (message: string) => ({
|
|
188
|
+
exitCode: 128,
|
|
189
|
+
stdout,
|
|
190
|
+
stderr: `${stderr}fatal: ${message}\n`,
|
|
191
|
+
});
|
|
192
|
+
let paths = this.paths;
|
|
193
|
+
let badlyQuoted = false;
|
|
194
|
+
if (this.stdin !== undefined)
|
|
195
|
+
({ records: paths, badlyQuoted } = inputRecords(this.stdin, this.nul));
|
|
196
|
+
const quoteFully = configBool(this._workingCopy, "core.quotePath", true);
|
|
197
|
+
const worktree = this.worktreeIfAny();
|
|
198
|
+
const reader = this.reader(worktree, sourceTree, warn);
|
|
199
|
+
const order = new Set<string>();
|
|
200
|
+
// a bare repository has no worktree to read absolute paths against
|
|
201
|
+
const top = worktree ? await worktreeHostPath(this._workingCopy) : undefined;
|
|
202
|
+
const run = async () => {
|
|
203
|
+
for (const file of paths) {
|
|
204
|
+
const full = prefixPath(this.prefix, file, top);
|
|
205
|
+
if (full === undefined) {
|
|
206
|
+
return die(`'${file}' is outside repository at '${top ?? ""}'`);
|
|
207
|
+
}
|
|
208
|
+
const names = this.all ? undefined : this.attributes;
|
|
209
|
+
const values = await reader.get(full, names);
|
|
210
|
+
let items: [string, AttributeValue][];
|
|
211
|
+
if (this.all) {
|
|
212
|
+
await reader.order(full, order);
|
|
213
|
+
items = [...order]
|
|
214
|
+
.filter((n) => values.get(n) !== undefined)
|
|
215
|
+
.map((n) => [n, values.get(n)]);
|
|
216
|
+
} else {
|
|
217
|
+
items = [];
|
|
218
|
+
for (const name of this.attributes) {
|
|
219
|
+
let value = values.get(name);
|
|
220
|
+
if (
|
|
221
|
+
value === undefined &&
|
|
222
|
+
name === "builtin_objectmode" &&
|
|
223
|
+
this.compatibility !== "2.43"
|
|
224
|
+
) {
|
|
225
|
+
const mode = await this.objectMode(full);
|
|
226
|
+
if (typeof mode === "object") return die(mode.error);
|
|
227
|
+
value = mode;
|
|
228
|
+
}
|
|
229
|
+
items.push([name, value]);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
for (const [name, value] of items) {
|
|
233
|
+
const text =
|
|
234
|
+
value === true
|
|
235
|
+
? "set"
|
|
236
|
+
: value === false
|
|
237
|
+
? "unset"
|
|
238
|
+
: value === undefined
|
|
239
|
+
? "unspecified"
|
|
240
|
+
: value;
|
|
241
|
+
stdout += this.nul
|
|
242
|
+
? `${file}\0${name}\0${text}\0`
|
|
243
|
+
: `${quotePath(file, quoteFully)}: ${name}: ${text}\n`;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (badlyQuoted) return die("line is badly quoted");
|
|
247
|
+
return { exitCode: 0, stdout, stderr };
|
|
248
|
+
};
|
|
249
|
+
try {
|
|
250
|
+
return worktree?.batch
|
|
251
|
+
? await worktree.batch(run, { onAttributeWarning: warn })
|
|
252
|
+
: await run();
|
|
253
|
+
} catch (error) {
|
|
254
|
+
if (error instanceof AttributesSourceError) return die(error.message);
|
|
255
|
+
throw error;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** The worktree; undefined in a bare repository. */
|
|
260
|
+
private worktreeIfAny(): Worktree | undefined {
|
|
261
|
+
return "worktree" in this._workingCopy ? this._workingCopy.worktree : undefined;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** Where the attributes come from: the content filter's stack, or the bare resolver's. */
|
|
265
|
+
private reader(
|
|
266
|
+
worktree: Worktree | undefined,
|
|
267
|
+
sourceTree: string | undefined,
|
|
268
|
+
warn: (message: string) => void,
|
|
269
|
+
): AttributeReader {
|
|
270
|
+
const filter = worktree?.contentFilter as
|
|
271
|
+
| {
|
|
272
|
+
attributes?(
|
|
273
|
+
path: string,
|
|
274
|
+
names: readonly string[] | undefined,
|
|
275
|
+
context: { direction: "checkin" | "index" },
|
|
276
|
+
): Promise<Map<string, AttributeValue>>;
|
|
277
|
+
attributeNameOrder?(
|
|
278
|
+
path: string,
|
|
279
|
+
order: Set<string>,
|
|
280
|
+
context: { direction: "checkin" | "index" },
|
|
281
|
+
): Promise<Set<string>>;
|
|
282
|
+
}
|
|
283
|
+
| undefined;
|
|
284
|
+
const useFilter =
|
|
285
|
+
worktree &&
|
|
286
|
+
filter?.attributes &&
|
|
287
|
+
filter.attributeNameOrder &&
|
|
288
|
+
(this.cached || sourceTree === undefined);
|
|
289
|
+
if (useFilter && filter?.attributes && filter.attributeNameOrder) {
|
|
290
|
+
const context = { direction: this.cached ? ("index" as const) : ("checkin" as const) };
|
|
291
|
+
const attributes = filter.attributes.bind(filter);
|
|
292
|
+
const nameOrder = filter.attributeNameOrder.bind(filter);
|
|
293
|
+
return {
|
|
294
|
+
get: (path, names) => attributes(path, names, context),
|
|
295
|
+
order: (path, order) => nameOrder(path, order, context),
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
// a bare repository, or the files of a tree
|
|
299
|
+
const { history } = this._workingCopy;
|
|
300
|
+
const resolver = bareAttributesResolver({
|
|
301
|
+
workingCopy: this._workingCopy,
|
|
302
|
+
trees: history.trees,
|
|
303
|
+
blobs: history.blobs,
|
|
304
|
+
revisions: () => this.revisionResolver(),
|
|
305
|
+
...(sourceTree !== undefined ? { sourceTree } : {}),
|
|
306
|
+
});
|
|
307
|
+
const memo = new AttributesMemo(warn);
|
|
308
|
+
return {
|
|
309
|
+
get: (path, names) => resolver.get(path, names, { memo }),
|
|
310
|
+
order: (path, order) => resolver.nameOrder(path, order, { memo }),
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** attr.c's `builtin_object_mode_attr`: the mode as `%06o`, or unspecified. */
|
|
315
|
+
private async objectMode(path: string): Promise<string | undefined | { error: string }> {
|
|
316
|
+
const octal = (mode: number) => mode.toString(8).padStart(6, "0");
|
|
317
|
+
const staging =
|
|
318
|
+
"checkout" in this._workingCopy ? this._workingCopy.checkout?.staging : undefined;
|
|
319
|
+
const indexEntry = await staging?.getEntry(path, 0).catch(() => undefined);
|
|
320
|
+
if (this.cached) return indexEntry ? octal(indexEntry.mode) : undefined;
|
|
321
|
+
const entry = await this.worktreeIfAny()
|
|
322
|
+
?.getEntry(path)
|
|
323
|
+
.catch(() => undefined);
|
|
324
|
+
if (!entry) return { error: `unable to stat '${path}': No such file or directory` };
|
|
325
|
+
if (entry.isDirectory || (entry.mode & S_IFMT) === S_IFDIR) {
|
|
326
|
+
if (indexEntry && (indexEntry.mode & S_IFMT) === S_IFGITLINK) return octal(indexEntry.mode);
|
|
327
|
+
return octal((entry.mode & S_IFMT) === S_IFGITLINK ? S_IFGITLINK : S_IFDIR);
|
|
328
|
+
}
|
|
329
|
+
if ((entry.mode & S_IFMT) === S_IFGITLINK) return octal(S_IFGITLINK);
|
|
330
|
+
if ((entry.mode & S_IFMT) === S_IFLNK) return octal(S_IFLNK);
|
|
331
|
+
return octal(entry.mode & 0o111 ? 0o100755 : 0o100644);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `git check-ignore` (builtin/check-ignore.c): which paths the ignore rules exclude, and with
|
|
3
|
+
* `-v` the pattern that decides (`<source>:<line>:<pattern>\t<path>`).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* // git check-ignore -v build/out.o
|
|
8
|
+
* await git.checkIgnore().setVerbose(true).addPath("build/out.o").call();
|
|
9
|
+
* // { exitCode: 0, stdout: ".gitignore:1:build/\tbuild/out.o\n", stderr: "" }
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { expandUserPath, type IgnoreMatch, xdgConfigPath } from "@statewalker/vcs-working-tree";
|
|
14
|
+
|
|
15
|
+
import { GitCommand } from "../git-command.js";
|
|
16
|
+
import { quotePath } from "../results/quote-path.js";
|
|
17
|
+
import type { PlumbingTextOutput } from "./check-ref-format-command.js";
|
|
18
|
+
import { hostEnvironmentOf } from "./git-ident.js";
|
|
19
|
+
import { configBool, configValue } from "./merge-config.js";
|
|
20
|
+
import { DO_MATCH_DIRECTORY, matchPathspec, parsePathspecItem } from "./pathspec.js";
|
|
21
|
+
import { directoryPrefix, inputRecords, prefixPath } from "./plumbing-input.js";
|
|
22
|
+
import { worktreeHostPath } from "./submodule-model.js";
|
|
23
|
+
|
|
24
|
+
const S_IFMT = 0o170000;
|
|
25
|
+
const S_IFLNK = 0o120000;
|
|
26
|
+
const S_IFGITLINK = 0o160000;
|
|
27
|
+
const S_IFDIR = 0o040000;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* `git check-ignore [-q] [-v [-n]] [--no-index] (<pathname>... | --stdin [-z])`: each path the
|
|
31
|
+
* ignore rules exclude is printed (as given, C-quoted as `core.quotePath` asks); with `-v`
|
|
32
|
+
* the deciding pattern before it, negated patterns too, and with `-n` the paths no pattern
|
|
33
|
+
* matches (`::\t<path>`). A path the index holds (or a directory holding one) is never
|
|
34
|
+
* checked, unless `--no-index`. Exit status 0 when a path was printed with a pattern, 1 when
|
|
35
|
+
* none, 128 for git's deaths (its argument errors, a path beyond a symbolic link or inside a
|
|
36
|
+
* submodule, a bare repository). Paths are read against {@link setCurrentDirectory}.
|
|
37
|
+
*/
|
|
38
|
+
export class CheckIgnoreCommand extends GitCommand<PlumbingTextOutput> {
|
|
39
|
+
private readonly paths: string[] = [];
|
|
40
|
+
private stdin?: Uint8Array;
|
|
41
|
+
private nul = false;
|
|
42
|
+
private quiet = false;
|
|
43
|
+
private verbose = false;
|
|
44
|
+
private nonMatching = false;
|
|
45
|
+
private noIndex = false;
|
|
46
|
+
private prefix = "";
|
|
47
|
+
|
|
48
|
+
/** A path to check. */
|
|
49
|
+
addPath(path: string): this {
|
|
50
|
+
this.checkCallable();
|
|
51
|
+
this.paths.push(path);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** `--stdin`: the paths of this input (git's stdin). */
|
|
56
|
+
setStdin(input: string | Uint8Array): this {
|
|
57
|
+
this.checkCallable();
|
|
58
|
+
this.stdin = typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** `-z`: NUL-terminated input and output records. */
|
|
63
|
+
setNulTerminated(nul: boolean): this {
|
|
64
|
+
this.checkCallable();
|
|
65
|
+
this.nul = nul;
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** `-q`: print nothing, only the exit status. */
|
|
70
|
+
setQuiet(quiet: boolean): this {
|
|
71
|
+
this.checkCallable();
|
|
72
|
+
this.quiet = quiet;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** `-v`: the deciding pattern too. */
|
|
77
|
+
setVerbose(verbose: boolean): this {
|
|
78
|
+
this.checkCallable();
|
|
79
|
+
this.verbose = verbose;
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** `-n` (with `-v`): the paths no pattern matches too. */
|
|
84
|
+
setNonMatching(nonMatching: boolean): this {
|
|
85
|
+
this.checkCallable();
|
|
86
|
+
this.nonMatching = nonMatching;
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** `--no-index`: paths the index holds are checked too. */
|
|
91
|
+
setNoIndex(noIndex: boolean): this {
|
|
92
|
+
this.checkCallable();
|
|
93
|
+
this.noIndex = noIndex;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The directory git runs in, from the top of the worktree (paths are relative to it). */
|
|
98
|
+
setCurrentDirectory(dir: string): this {
|
|
99
|
+
this.checkCallable();
|
|
100
|
+
this.prefix = directoryPrefix(dir);
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async call(): Promise<PlumbingTextOutput> {
|
|
105
|
+
this.checkCallable();
|
|
106
|
+
this.setCallable(false);
|
|
107
|
+
let stdout = "";
|
|
108
|
+
const stderr = "";
|
|
109
|
+
const die = (message: string, exitCode = 128) => ({
|
|
110
|
+
exitCode,
|
|
111
|
+
stdout,
|
|
112
|
+
stderr: `${stderr}fatal: ${message}\n`,
|
|
113
|
+
});
|
|
114
|
+
if (this.stdin !== undefined) {
|
|
115
|
+
if (this.paths.length > 0) return die("cannot specify pathnames with --stdin");
|
|
116
|
+
} else {
|
|
117
|
+
if (this.nul) return die("-z only makes sense with --stdin");
|
|
118
|
+
if (this.paths.length === 0) return die("no path specified");
|
|
119
|
+
}
|
|
120
|
+
if (this.quiet) {
|
|
121
|
+
if (this.paths.length > 1) return die("--quiet is only valid with a single pathname");
|
|
122
|
+
if (this.verbose) return die("cannot have both --quiet and --verbose");
|
|
123
|
+
}
|
|
124
|
+
if (this.nonMatching && !this.verbose) {
|
|
125
|
+
return die("--non-matching is only valid with --verbose");
|
|
126
|
+
}
|
|
127
|
+
const worktree = "worktree" in this._workingCopy ? this._workingCopy.worktree : undefined;
|
|
128
|
+
if (!worktree?.ignoreMatch) return die("this operation must be run in a work tree");
|
|
129
|
+
const staging = this.noIndex ? undefined : this._workingCopy.checkout?.staging;
|
|
130
|
+
const index = staging ? await this.indexEntries() : [];
|
|
131
|
+
const quoteFully = configBool(this._workingCopy, "core.quotePath", true);
|
|
132
|
+
const sources = await this.sourceNames();
|
|
133
|
+
let ignored = 0;
|
|
134
|
+
|
|
135
|
+
const top = await worktreeHostPath(this._workingCopy);
|
|
136
|
+
const checkOne = async (original: string): Promise<string | undefined> => {
|
|
137
|
+
const full = prefixPath(this.prefix, original, top);
|
|
138
|
+
if (full === undefined) {
|
|
139
|
+
return `${original}: '${original}' is outside repository at '${top ?? ""}'`;
|
|
140
|
+
}
|
|
141
|
+
const path = full.replace(/\/+$/, "");
|
|
142
|
+
// PATHSPEC_SYMLINK_LEADING_PATH
|
|
143
|
+
const parts = path.split("/");
|
|
144
|
+
for (let k = 1; k < parts.length; k++) {
|
|
145
|
+
const entry = await worktree.getEntry(parts.slice(0, k).join("/")).catch(() => undefined);
|
|
146
|
+
if (entry && (entry.mode & S_IFMT) === S_IFLNK) {
|
|
147
|
+
return `pathspec '${original}' is beyond a symbolic link`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (staging) {
|
|
151
|
+
// die_path_inside_submodule
|
|
152
|
+
for (const e of index) {
|
|
153
|
+
if ((e.mode & S_IFMT) === S_IFGITLINK && path.startsWith(`${e.path}/`)) {
|
|
154
|
+
return `Pathspec '${original}' is in submodule '${e.path}'`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
let match: IgnoreMatch | undefined;
|
|
159
|
+
if (!staging || !this.seenInIndex(full, index)) {
|
|
160
|
+
match = await worktree.ignoreMatch?.(path);
|
|
161
|
+
if (!this.verbose && match?.negated) match = undefined;
|
|
162
|
+
}
|
|
163
|
+
if (!this.quiet && (match || this.nonMatching))
|
|
164
|
+
stdout += this.line(original, match, sources, quoteFully);
|
|
165
|
+
if (match) ignored++;
|
|
166
|
+
return undefined;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const run = async () => {
|
|
170
|
+
if (this.stdin === undefined) {
|
|
171
|
+
for (const path of this.paths) {
|
|
172
|
+
const death = await checkOne(path);
|
|
173
|
+
if (death) return die(death);
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
const { records, badlyQuoted } = inputRecords(this.stdin, this.nul);
|
|
177
|
+
for (const path of records) {
|
|
178
|
+
const death = await checkOne(path);
|
|
179
|
+
if (death) return die(death);
|
|
180
|
+
}
|
|
181
|
+
if (badlyQuoted) return die("line is badly quoted");
|
|
182
|
+
}
|
|
183
|
+
return { exitCode: ignored ? 0 : 1, stdout, stderr };
|
|
184
|
+
};
|
|
185
|
+
return worktree.batch ? worktree.batch(run) : run();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** One output record (`output_pattern`). */
|
|
189
|
+
private line(
|
|
190
|
+
path: string,
|
|
191
|
+
match: IgnoreMatch | undefined,
|
|
192
|
+
sources: { info: string; excludes: string | undefined },
|
|
193
|
+
quoteFully: boolean,
|
|
194
|
+
): string {
|
|
195
|
+
let source = "";
|
|
196
|
+
if (match) {
|
|
197
|
+
const s = match.source;
|
|
198
|
+
source =
|
|
199
|
+
s.kind === "directory"
|
|
200
|
+
? `${s.directory ? `${s.directory}/` : ""}.gitignore`
|
|
201
|
+
: s.kind === "exclude" && s.name === "info/exclude"
|
|
202
|
+
? sources.info
|
|
203
|
+
: s.kind === "exclude" && s.name === "core.excludesFile"
|
|
204
|
+
? (sources.excludes ?? "")
|
|
205
|
+
: "";
|
|
206
|
+
}
|
|
207
|
+
if (this.nul) {
|
|
208
|
+
if (!this.verbose) return `${path}\0`;
|
|
209
|
+
return match ? `${source}\0${match.line}\0${match.pattern}\0${path}\0` : `\0\0\0${path}\0`;
|
|
210
|
+
}
|
|
211
|
+
if (!this.verbose) return `${quotePath(path, quoteFully)}\n`;
|
|
212
|
+
const where = match
|
|
213
|
+
? `${quotePath(source, quoteFully)}:${match.line}:${match.pattern}\t`
|
|
214
|
+
: "::\t";
|
|
215
|
+
return `${where}${quotePath(path, quoteFully)}\n`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** The index's entries git asks (`PS_HEED_SKIP_WORKTREE`: skip-worktree ones left out). */
|
|
219
|
+
private async indexEntries(): Promise<{ path: string; mode: number }[]> {
|
|
220
|
+
const staging = this._workingCopy.checkout.staging;
|
|
221
|
+
const out: { path: string; mode: number }[] = [];
|
|
222
|
+
for await (const e of staging.entries()) {
|
|
223
|
+
if (!(e as { skipWorktree?: boolean }).skipWorktree) out.push({ path: e.path, mode: e.mode });
|
|
224
|
+
}
|
|
225
|
+
return out;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** `find_pathspecs_matching_against_index`: whether the element names an index entry. */
|
|
229
|
+
private seenInIndex(full: string, index: { path: string; mode: number }[]): boolean {
|
|
230
|
+
let item: ReturnType<typeof parsePathspecItem>;
|
|
231
|
+
try {
|
|
232
|
+
item = parsePathspecItem(full === "" ? "." : full);
|
|
233
|
+
} catch {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
for (const e of index) {
|
|
237
|
+
const dir = (e.mode & S_IFMT) === S_IFGITLINK || (e.mode & S_IFMT) === S_IFDIR;
|
|
238
|
+
if (matchPathspec([item], e.path, dir ? DO_MATCH_DIRECTORY : 0)) return true;
|
|
239
|
+
}
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** How git names the exclude files in `-v` lines. */
|
|
244
|
+
private async sourceNames(): Promise<{ info: string; excludes: string | undefined }> {
|
|
245
|
+
const environment = hostEnvironmentOf(this._workingCopy);
|
|
246
|
+
const configured = configValue(this._workingCopy, "core.excludesFile");
|
|
247
|
+
const excludes =
|
|
248
|
+
typeof configured === "string" && configured !== ""
|
|
249
|
+
? expandUserPath(configured, environment)
|
|
250
|
+
: xdgConfigPath(environment, "ignore");
|
|
251
|
+
// git_path_info_exclude: the git directory as setup names it (`.git` at the top)
|
|
252
|
+
const gitDir = (this._workingCopy.config as { hostGitDir?: string } | undefined)?.hostGitDir;
|
|
253
|
+
const top = await worktreeHostPath(this._workingCopy);
|
|
254
|
+
const trimmed = gitDir?.replace(/\/+$/, "");
|
|
255
|
+
const info =
|
|
256
|
+
trimmed === undefined || (top !== undefined && trimmed === `${top.replace(/\/+$/, "")}/.git`)
|
|
257
|
+
? ".git/info/exclude"
|
|
258
|
+
: `${trimmed}/info/exclude`;
|
|
259
|
+
return { info, excludes };
|
|
260
|
+
}
|
|
261
|
+
}
|