@statewalker/vcs-commands 0.5.0 → 0.7.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 +123 -8
- package/dist/commands/add-command.d.ts +265 -34
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/add-interactive.d.ts +46 -0
- package/dist/commands/add-patch/add-interactive.d.ts.map +1 -0
- package/dist/commands/add-patch/add-patch.d.ts +139 -0
- package/dist/commands/add-patch/add-patch.d.ts.map +1 -0
- package/dist/commands/add-patch/index.d.ts +6 -0
- package/dist/commands/add-patch/index.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-backend.d.ts +80 -0
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-modes.d.ts +71 -0
- package/dist/commands/add-patch/patch-modes.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-session.d.ts +49 -0
- package/dist/commands/add-patch/patch-session.d.ts.map +1 -0
- package/dist/commands/am/am-command.d.ts +175 -0
- package/dist/commands/am/am-command.d.ts.map +1 -0
- package/dist/commands/am/index.d.ts +3 -0
- package/dist/commands/am/index.d.ts.map +1 -0
- package/dist/commands/am/mailinfo.d.ts +58 -0
- package/dist/commands/am/mailinfo.d.ts.map +1 -0
- package/dist/commands/am/patch-format.d.ts +24 -0
- package/dist/commands/am/patch-format.d.ts.map +1 -0
- package/dist/commands/apply/apply-command.d.ts +153 -0
- package/dist/commands/apply/apply-command.d.ts.map +1 -0
- package/dist/commands/apply/apply-engine.d.ts +195 -0
- package/dist/commands/apply/apply-engine.d.ts.map +1 -0
- package/dist/commands/apply/apply-parse.d.ts +86 -0
- package/dist/commands/apply/apply-parse.d.ts.map +1 -0
- package/dist/commands/apply/apply-types.d.ts +70 -0
- package/dist/commands/apply/apply-types.d.ts.map +1 -0
- package/dist/commands/apply/index.d.ts +6 -0
- package/dist/commands/apply/index.d.ts.map +1 -0
- package/dist/commands/apply/latin1.d.ts +32 -0
- package/dist/commands/apply/latin1.d.ts.map +1 -0
- package/dist/commands/apply/whitespace.d.ts +58 -0
- package/dist/commands/apply/whitespace.d.ts.map +1 -0
- package/dist/commands/attributes-source.d.ts +26 -0
- package/dist/commands/attributes-source.d.ts.map +1 -0
- package/dist/commands/backfill-command.d.ts +110 -0
- package/dist/commands/backfill-command.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-checkout.d.ts +64 -0
- package/dist/commands/bisect/bisect-checkout.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-command.d.ts +201 -0
- package/dist/commands/bisect/bisect-command.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-engine.d.ts +219 -0
- package/dist/commands/bisect/bisect-engine.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-graph.d.ts +127 -0
- package/dist/commands/bisect/bisect-graph.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-quote.d.ts +27 -0
- package/dist/commands/bisect/bisect-quote.d.ts.map +1 -0
- package/dist/commands/bisect/index.d.ts +5 -0
- package/dist/commands/bisect/index.d.ts.map +1 -0
- package/dist/commands/blame-command.d.ts +122 -131
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/branch-command.d.ts +52 -2
- package/dist/commands/branch-command.d.ts.map +1 -1
- package/dist/commands/branch-tracking.d.ts +98 -0
- package/dist/commands/branch-tracking.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts +300 -18
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-paths.d.ts +124 -0
- package/dist/commands/checkout-paths.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +50 -42
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +49 -16
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +134 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/comment-char-config.d.ts +35 -0
- package/dist/commands/comment-char-config.d.ts.map +1 -0
- package/dist/commands/commit-command.d.ts +311 -17
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/core-config.d.ts +78 -1
- package/dist/commands/core-config.d.ts.map +1 -1
- package/dist/commands/date-format.d.ts +58 -0
- package/dist/commands/date-format.d.ts.map +1 -0
- package/dist/commands/default-branch.d.ts +70 -0
- package/dist/commands/default-branch.d.ts.map +1 -0
- package/dist/commands/describe-command.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +377 -30
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/diff-textconv.d.ts +40 -0
- package/dist/commands/diff-textconv.d.ts.map +1 -0
- package/dist/commands/fetch-command.d.ts +149 -10
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/format-patch-command.d.ts +164 -0
- package/dist/commands/format-patch-command.d.ts.map +1 -0
- package/dist/commands/fsck/fetch-fsck.d.ts +60 -0
- package/dist/commands/fsck/fetch-fsck.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-command.d.ts +227 -0
- package/dist/commands/fsck/fsck-command.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-loose.d.ts +71 -0
- package/dist/commands/fsck/fsck-loose.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-msg-ids.d.ts +122 -0
- package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-object-checks.d.ts +159 -0
- package/dist/commands/fsck/fsck-object-checks.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-object-table.d.ts +140 -0
- package/dist/commands/fsck/fsck-object-table.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-pack.d.ts +122 -0
- package/dist/commands/fsck/fsck-pack.d.ts.map +1 -0
- package/dist/commands/fsck/index.d.ts +6 -0
- package/dist/commands/fsck/index.d.ts.map +1 -0
- package/dist/commands/fsck/verify-pack-command.d.ts +81 -0
- package/dist/commands/fsck/verify-pack-command.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +106 -39
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-date.d.ts +2 -0
- package/dist/commands/git-date.d.ts.map +1 -0
- package/dist/commands/git-describe.d.ts +67 -0
- package/dist/commands/git-describe.d.ts.map +1 -0
- package/dist/commands/git-hooks.d.ts +424 -0
- package/dist/commands/git-hooks.d.ts.map +1 -0
- package/dist/commands/git-ident.d.ts +128 -0
- package/dist/commands/git-ident.d.ts.map +1 -0
- package/dist/commands/hook-command.d.ts +96 -0
- package/dist/commands/hook-command.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +233 -0
- package/dist/commands/index-adder.d.ts.map +1 -0
- package/dist/commands/index-host.d.ts +86 -0
- package/dist/commands/index-host.d.ts.map +1 -0
- package/dist/commands/index.d.ts +56 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -2
- package/dist/commands/init-command.d.ts +62 -4
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/legacy-remotes.d.ts +55 -0
- package/dist/commands/legacy-remotes.d.ts.map +1 -0
- package/dist/commands/local-clone.d.ts +60 -0
- package/dist/commands/local-clone.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts +117 -0
- package/dist/commands/local-transport.d.ts.map +1 -0
- package/dist/commands/log-command.d.ts +216 -24
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +120 -0
- package/dist/commands/log-graph.d.ts.map +1 -0
- package/dist/commands/log-output.d.ts +323 -0
- package/dist/commands/log-output.d.ts.map +1 -0
- package/dist/commands/ls-remote-command.d.ts +23 -7
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/mailmap.d.ts +31 -0
- package/dist/commands/mailmap.d.ts.map +1 -0
- package/dist/commands/merge-bases.d.ts +85 -0
- package/dist/commands/merge-bases.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +221 -74
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-config.d.ts +13 -0
- package/dist/commands/merge-config.d.ts.map +1 -0
- package/dist/commands/merge-drivers.d.ts +130 -0
- package/dist/commands/merge-drivers.d.ts.map +1 -0
- package/dist/commands/merge-support.d.ts +260 -0
- package/dist/commands/merge-support.d.ts.map +1 -0
- package/dist/commands/message-cleanup.d.ts +86 -0
- package/dist/commands/message-cleanup.d.ts.map +1 -0
- package/dist/commands/mv-command.d.ts +94 -0
- package/dist/commands/mv-command.d.ts.map +1 -0
- package/dist/commands/notes-command.d.ts +256 -0
- package/dist/commands/notes-command.d.ts.map +1 -0
- package/dist/commands/notes-commands.d.ts +41 -0
- package/dist/commands/notes-commands.d.ts.map +1 -0
- package/dist/commands/notes-merge-command.d.ts +105 -0
- package/dist/commands/notes-merge-command.d.ts.map +1 -0
- package/dist/commands/notes-support.d.ts +125 -0
- package/dist/commands/notes-support.d.ts.map +1 -0
- package/dist/commands/notes-tree.d.ts +116 -0
- package/dist/commands/notes-tree.d.ts.map +1 -0
- package/dist/commands/object-id-input.d.ts +20 -0
- package/dist/commands/object-id-input.d.ts.map +1 -0
- package/dist/commands/octopus-merge.d.ts +59 -0
- package/dist/commands/octopus-merge.d.ts.map +1 -0
- package/dist/commands/ort-merge.d.ts +126 -0
- package/dist/commands/ort-merge.d.ts.map +1 -0
- package/dist/commands/ort-recursive.d.ts +53 -0
- package/dist/commands/ort-recursive.d.ts.map +1 -0
- package/dist/commands/pack-refs-command.d.ts +20 -0
- package/dist/commands/pack-refs-command.d.ts.map +1 -1
- package/dist/commands/patch-id.d.ts +44 -0
- package/dist/commands/patch-id.d.ts.map +1 -0
- package/dist/commands/pathspec-attributes.d.ts +64 -0
- package/dist/commands/pathspec-attributes.d.ts.map +1 -0
- package/dist/commands/pathspec.d.ts +324 -0
- package/dist/commands/pathspec.d.ts.map +1 -0
- package/dist/commands/post-index-change.d.ts +33 -0
- package/dist/commands/post-index-change.d.ts.map +1 -0
- package/dist/commands/pretty-format.d.ts +222 -0
- package/dist/commands/pretty-format.d.ts.map +1 -0
- package/dist/commands/promisor-remote.d.ts +80 -0
- package/dist/commands/promisor-remote.d.ts.map +1 -0
- package/dist/commands/pull-command.d.ts +59 -8
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +24 -8
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/read-tree-command.d.ts +112 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -0
- package/dist/commands/rebase-command.d.ts +507 -75
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/rebase-todo.d.ts +130 -0
- package/dist/commands/rebase-todo.d.ts.map +1 -0
- package/dist/commands/ref-decoration-filter.d.ts +53 -0
- package/dist/commands/ref-decoration-filter.d.ts.map +1 -0
- package/dist/commands/reflog-messages.d.ts +98 -0
- package/dist/commands/reflog-messages.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +31 -0
- package/dist/commands/remote-command.d.ts.map +1 -1
- package/dist/commands/remote-transport.d.ts +120 -0
- package/dist/commands/remote-transport.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +161 -7
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +103 -0
- package/dist/commands/restore-command.d.ts.map +1 -0
- package/dist/commands/rev-list-command.d.ts +78 -0
- package/dist/commands/rev-list-command.d.ts.map +1 -0
- package/dist/commands/rev-parse-command.d.ts +89 -0
- package/dist/commands/rev-parse-command.d.ts.map +1 -0
- package/dist/commands/revert-command.d.ts +46 -38
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-filenames.d.ts +95 -0
- package/dist/commands/revision-filenames.d.ts.map +1 -0
- package/dist/commands/revision-range.d.ts +67 -0
- package/dist/commands/revision-range.d.ts.map +1 -0
- package/dist/commands/revision-resolver.d.ts +325 -0
- package/dist/commands/revision-resolver.d.ts.map +1 -0
- package/dist/commands/rm-command.d.ts +69 -7
- package/dist/commands/rm-command.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +191 -0
- package/dist/commands/sequencer-pick.d.ts.map +1 -0
- package/dist/commands/sequencer-support.d.ts +125 -0
- package/dist/commands/sequencer-support.d.ts.map +1 -0
- package/dist/commands/serve-repository.d.ts +52 -0
- package/dist/commands/serve-repository.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-command.d.ts +190 -0
- package/dist/commands/sparse-checkout-command.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-support.d.ts +268 -0
- package/dist/commands/sparse-checkout-support.d.ts.map +1 -0
- package/dist/commands/stash-apply-command.d.ts +42 -8
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-create-command.d.ts +156 -2
- package/dist/commands/stash-create-command.d.ts.map +1 -1
- package/dist/commands/stash-drop-command.d.ts +2 -0
- package/dist/commands/stash-drop-command.d.ts.map +1 -1
- package/dist/commands/stash-working-tree.d.ts +23 -0
- package/dist/commands/stash-working-tree.d.ts.map +1 -1
- package/dist/commands/status-command.d.ts +300 -15
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/status-format.d.ts +155 -0
- package/dist/commands/status-format.d.ts.map +1 -0
- package/dist/commands/status-header.d.ts +64 -0
- package/dist/commands/status-header.d.ts.map +1 -0
- package/dist/commands/strerror.d.ts +7 -0
- package/dist/commands/strerror.d.ts.map +1 -0
- package/dist/commands/submodule-config.d.ts +38 -0
- package/dist/commands/submodule-config.d.ts.map +1 -0
- package/dist/commands/submodule-summary-command.d.ts +80 -0
- package/dist/commands/submodule-summary-command.d.ts.map +1 -0
- package/dist/commands/submodule-summary.d.ts +150 -0
- package/dist/commands/submodule-summary.d.ts.map +1 -0
- package/dist/commands/switch-command.d.ts +132 -0
- package/dist/commands/switch-command.d.ts.map +1 -0
- package/dist/commands/tag-command.d.ts +23 -2
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/tracking-info.d.ts +64 -0
- package/dist/commands/tracking-info.d.ts.map +1 -0
- package/dist/commands/trailers.d.ts +73 -0
- package/dist/commands/trailers.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +85 -1
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/untracked-cache-support.d.ts +54 -0
- package/dist/commands/untracked-cache-support.d.ts.map +1 -0
- package/dist/commands/worktree-add-command.d.ts +108 -0
- package/dist/commands/worktree-add-command.d.ts.map +1 -0
- package/dist/commands/worktree-list-command.d.ts +69 -0
- package/dist/commands/worktree-list-command.d.ts.map +1 -0
- package/dist/commands/worktree-lock-command.d.ts +44 -0
- package/dist/commands/worktree-lock-command.d.ts.map +1 -0
- package/dist/commands/worktree-overwrite-checks.d.ts +146 -6
- package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
- package/dist/commands/worktree-prune-command.d.ts +48 -0
- package/dist/commands/worktree-prune-command.d.ts.map +1 -0
- package/dist/commands/worktree-remove-command.d.ts +59 -0
- package/dist/commands/worktree-remove-command.d.ts.map +1 -0
- package/dist/commands/worktree-repair-command.d.ts +35 -0
- package/dist/commands/worktree-repair-command.d.ts.map +1 -0
- package/dist/commands/worktree-support.d.ts +64 -0
- package/dist/commands/worktree-support.d.ts.map +1 -0
- package/dist/commands-DIJ91NnD.js +62225 -0
- package/dist/core-commands/add.command.impl.d.ts.map +1 -1
- package/dist/errors/add-errors.d.ts +55 -0
- package/dist/errors/add-errors.d.ts.map +1 -1
- package/dist/errors/checkout-errors.d.ts +16 -0
- package/dist/errors/checkout-errors.d.ts.map +1 -1
- package/dist/errors/command-errors.d.ts +77 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/commit-errors.d.ts +9 -0
- package/dist/errors/commit-errors.d.ts.map +1 -1
- package/dist/errors/git-api-error.d.ts +59 -2
- package/dist/errors/git-api-error.d.ts.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +354 -19
- package/dist/errors/rebase-errors.d.ts +9 -0
- package/dist/errors/rebase-errors.d.ts.map +1 -1
- package/dist/errors/ref-errors.d.ts +32 -0
- package/dist/errors/ref-errors.d.ts.map +1 -1
- package/dist/errors/transport-errors.d.ts +12 -2
- package/dist/errors/transport-errors.d.ts.map +1 -1
- package/dist/errors/worktree-errors.d.ts +35 -0
- package/dist/errors/worktree-errors.d.ts.map +1 -0
- package/dist/git-command-BGiOJ8Zk.js +7246 -0
- package/dist/git-command.d.ts +428 -32
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +315 -5
- package/dist/git.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/remote-config/index.d.ts +1 -1
- package/dist/remote-config/index.d.ts.map +1 -1
- package/dist/remote-config/remote-config-store.d.ts +167 -6
- package/dist/remote-config/remote-config-store.d.ts.map +1 -1
- package/dist/remote-config/remote-refs.d.ts +7 -3
- package/dist/remote-config/remote-refs.d.ts.map +1 -1
- package/dist/rename/detect-renames.d.ts +148 -0
- package/dist/rename/detect-renames.d.ts.map +1 -0
- package/dist/rename/git-similarity.d.ts +44 -0
- package/dist/rename/git-similarity.d.ts.map +1 -0
- package/dist/rename/index.d.ts +2 -0
- package/dist/rename/index.d.ts.map +1 -1
- package/dist/results/binary-patch.d.ts +11 -0
- package/dist/results/binary-patch.d.ts.map +1 -0
- package/dist/results/blame-format.d.ts +55 -0
- package/dist/results/blame-format.d.ts.map +1 -0
- package/dist/results/cherry-pick-result.d.ts +10 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -1
- package/dist/results/clone-result.d.ts +18 -0
- package/dist/results/clone-result.d.ts.map +1 -1
- package/dist/results/combined-diff.d.ts +77 -0
- package/dist/results/combined-diff.d.ts.map +1 -0
- package/dist/results/diff-entry.d.ts +32 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts +34 -60
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-order.d.ts +25 -0
- package/dist/results/diff-order.d.ts.map +1 -0
- package/dist/results/diff-output.d.ts +249 -0
- package/dist/results/diff-output.d.ts.map +1 -0
- package/dist/results/fetch-result.d.ts +15 -0
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.d.ts +5 -0
- package/dist/results/index.d.ts.map +1 -1
- package/dist/results/index.js +2 -252
- package/dist/results/init-result.d.ts +7 -0
- package/dist/results/init-result.d.ts.map +1 -1
- package/dist/results/merge-result.d.ts +15 -1
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/pull-result.d.ts +17 -3
- package/dist/results/pull-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +47 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/quote-path.d.ts +27 -0
- package/dist/results/quote-path.d.ts.map +1 -0
- package/dist/results/rebase-result.d.ts +28 -1
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/revert-result.d.ts +10 -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 +60 -6
- package/dist/results/status-result.d.ts.map +1 -1
- package/dist/results-WVlBhVb1.js +2935 -0
- package/dist/transport-command.d.ts +44 -1
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +15 -11
- package/src/commands/add-command.ts +1291 -226
- package/src/commands/add-patch/add-interactive.ts +941 -0
- package/src/commands/add-patch/add-patch.ts +1169 -0
- package/src/commands/add-patch/index.ts +5 -0
- package/src/commands/add-patch/patch-backend.ts +239 -0
- package/src/commands/add-patch/patch-modes.ts +249 -0
- package/src/commands/add-patch/patch-session.ts +159 -0
- package/src/commands/am/am-command.ts +1111 -0
- package/src/commands/am/index.ts +2 -0
- package/src/commands/am/mailinfo.ts +1015 -0
- package/src/commands/am/patch-format.ts +121 -0
- package/src/commands/apply/apply-command.ts +842 -0
- package/src/commands/apply/apply-engine.ts +1602 -0
- package/src/commands/apply/apply-parse.ts +1210 -0
- package/src/commands/apply/apply-types.ts +112 -0
- package/src/commands/apply/index.ts +5 -0
- package/src/commands/apply/latin1.ts +171 -0
- package/src/commands/apply/whitespace.ts +260 -0
- package/src/commands/attributes-source.ts +96 -0
- package/src/commands/backfill-command.ts +694 -0
- package/src/commands/bisect/bisect-checkout.ts +217 -0
- package/src/commands/bisect/bisect-command.ts +788 -0
- package/src/commands/bisect/bisect-engine.ts +1080 -0
- package/src/commands/bisect/bisect-graph.ts +595 -0
- package/src/commands/bisect/bisect-quote.ts +92 -0
- package/src/commands/bisect/index.ts +4 -0
- package/src/commands/blame-command.ts +711 -986
- package/src/commands/branch-command.ts +354 -32
- package/src/commands/branch-tracking.ts +331 -0
- package/src/commands/checkout-command.ts +1290 -243
- package/src/commands/checkout-paths.ts +784 -0
- package/src/commands/cherry-pick-command.ts +156 -396
- package/src/commands/clean-command.ts +504 -156
- package/src/commands/clone-command.ts +748 -69
- package/src/commands/comment-char-config.ts +160 -0
- package/src/commands/commit-command.ts +1782 -166
- package/src/commands/core-config.ts +166 -6
- package/src/commands/date-format.ts +668 -0
- package/src/commands/default-branch.ts +196 -0
- package/src/commands/describe-command.ts +2 -0
- package/src/commands/diff-command.ts +1916 -110
- package/src/commands/diff-textconv.ts +50 -0
- package/src/commands/fetch-command.ts +622 -68
- package/src/commands/format-patch-command.ts +974 -0
- package/src/commands/fsck/fetch-fsck.ts +229 -0
- package/src/commands/fsck/fsck-command.ts +3464 -0
- package/src/commands/fsck/fsck-loose.ts +297 -0
- package/src/commands/fsck/fsck-msg-ids.ts +176 -0
- package/src/commands/fsck/fsck-object-checks.ts +1085 -0
- package/src/commands/fsck/fsck-object-table.ts +373 -0
- package/src/commands/fsck/fsck-pack.ts +634 -0
- package/src/commands/fsck/index.ts +5 -0
- package/src/commands/fsck/verify-pack-command.ts +252 -0
- package/src/commands/gc-command.ts +324 -77
- package/src/commands/git-date.ts +9 -0
- package/src/commands/git-describe.ts +316 -0
- package/src/commands/git-hooks.ts +1483 -0
- package/src/commands/git-ident.ts +344 -0
- package/src/commands/hook-command.ts +247 -0
- package/src/commands/index-adder.ts +711 -0
- package/src/commands/index-host.ts +291 -0
- package/src/commands/index.ts +84 -0
- package/src/commands/init-command.ts +194 -14
- package/src/commands/legacy-remotes.ts +224 -0
- package/src/commands/local-clone.ts +183 -0
- package/src/commands/local-transport.ts +762 -0
- package/src/commands/log-command.ts +1930 -170
- package/src/commands/log-graph.ts +671 -0
- package/src/commands/log-output.ts +1359 -0
- package/src/commands/ls-remote-command.ts +105 -58
- package/src/commands/mailmap.ts +129 -0
- package/src/commands/merge-bases.ts +296 -0
- package/src/commands/merge-command.ts +1416 -491
- package/src/commands/merge-config.ts +25 -0
- package/src/commands/merge-drivers.ts +306 -0
- package/src/commands/merge-support.ts +1219 -0
- package/src/commands/message-cleanup.ts +275 -0
- package/src/commands/mv-command.ts +976 -0
- package/src/commands/notes-command.ts +890 -0
- package/src/commands/notes-commands.ts +87 -0
- package/src/commands/notes-merge-command.ts +777 -0
- package/src/commands/notes-support.ts +402 -0
- package/src/commands/notes-tree.ts +617 -0
- package/src/commands/object-id-input.ts +27 -0
- package/src/commands/octopus-merge.ts +378 -0
- package/src/commands/ort-merge.ts +1660 -0
- package/src/commands/ort-recursive.ts +160 -0
- package/src/commands/pack-refs-command.ts +39 -22
- package/src/commands/patch-id.ts +204 -0
- package/src/commands/pathspec-attributes.ts +162 -0
- package/src/commands/pathspec.ts +1199 -0
- package/src/commands/post-index-change.ts +62 -0
- package/src/commands/pretty-format.ts +1432 -0
- package/src/commands/promisor-remote.ts +298 -0
- package/src/commands/pull-command.ts +326 -33
- package/src/commands/push-command.ts +257 -29
- package/src/commands/read-tree-command.ts +861 -0
- package/src/commands/rebase-command.ts +3820 -372
- package/src/commands/rebase-todo.ts +584 -0
- package/src/commands/ref-decoration-filter.ts +118 -0
- package/src/commands/reflog-messages.ts +177 -0
- package/src/commands/remote-command.ts +124 -23
- package/src/commands/remote-transport.ts +383 -0
- package/src/commands/reset-command.ts +821 -104
- package/src/commands/restore-command.ts +350 -0
- package/src/commands/rev-list-command.ts +167 -0
- package/src/commands/rev-parse-command.ts +299 -0
- package/src/commands/revert-command.ts +152 -399
- package/src/commands/revision-filenames.ts +254 -0
- package/src/commands/revision-range.ts +222 -0
- package/src/commands/revision-resolver.ts +1397 -0
- package/src/commands/rm-command.ts +613 -67
- package/src/commands/sequencer-pick.ts +874 -0
- package/src/commands/sequencer-support.ts +876 -0
- package/src/commands/serve-repository.ts +125 -0
- package/src/commands/sparse-checkout-command.ts +1389 -0
- package/src/commands/sparse-checkout-support.ts +793 -0
- package/src/commands/stash-apply-command.ts +376 -343
- package/src/commands/stash-create-command.ts +625 -42
- package/src/commands/stash-drop-command.ts +15 -2
- package/src/commands/stash-working-tree.ts +168 -24
- package/src/commands/status-command.ts +1326 -105
- package/src/commands/status-format.ts +775 -0
- package/src/commands/status-header.ts +332 -0
- package/src/commands/strerror.ts +29 -0
- package/src/commands/submodule-config.ts +94 -0
- package/src/commands/submodule-summary-command.ts +333 -0
- package/src/commands/submodule-summary.ts +446 -0
- package/src/commands/switch-command.ts +402 -0
- package/src/commands/tag-command.ts +129 -41
- package/src/commands/tracking-info.ts +201 -0
- package/src/commands/trailers.ts +417 -0
- package/src/commands/tree-restore.ts +204 -4
- package/src/commands/untracked-cache-support.ts +198 -0
- package/src/commands/worktree-add-command.ts +458 -0
- package/src/commands/worktree-list-command.ts +206 -0
- package/src/commands/worktree-lock-command.ts +96 -0
- package/src/commands/worktree-overwrite-checks.ts +452 -26
- package/src/commands/worktree-prune-command.ts +99 -0
- package/src/commands/worktree-remove-command.ts +186 -0
- package/src/commands/worktree-repair-command.ts +59 -0
- package/src/commands/worktree-support.ts +214 -0
- package/src/core-commands/add.command.impl.ts +8 -2
- package/src/errors/add-errors.ts +45 -0
- package/src/errors/checkout-errors.ts +26 -2
- package/src/errors/command-errors.ts +101 -1
- package/src/errors/commit-errors.ts +18 -2
- package/src/errors/git-api-error.ts +82 -2
- package/src/errors/index.ts +1 -0
- package/src/errors/merge-errors.ts +2 -2
- package/src/errors/rebase-errors.ts +12 -0
- package/src/errors/ref-errors.ts +56 -2
- package/src/errors/remote-errors.ts +2 -2
- package/src/errors/stash-errors.ts +1 -1
- package/src/errors/transport-errors.ts +20 -4
- package/src/errors/worktree-errors.ts +49 -0
- package/src/git-command.ts +1207 -118
- package/src/git.ts +538 -12
- package/src/index.ts +1 -1
- package/src/remote-config/index.ts +2 -0
- package/src/remote-config/remote-config-store.ts +378 -18
- package/src/remote-config/remote-refs.ts +22 -6
- package/src/rename/detect-renames.ts +715 -0
- package/src/rename/git-similarity.ts +116 -0
- package/src/rename/index.ts +2 -0
- package/src/results/binary-patch.ts +401 -0
- package/src/results/blame-format.ts +239 -0
- package/src/results/cherry-pick-result.ts +10 -0
- package/src/results/clone-result.ts +21 -0
- package/src/results/combined-diff.ts +585 -0
- package/src/results/diff-entry.ts +35 -0
- package/src/results/diff-formatter.ts +152 -288
- package/src/results/diff-order.ts +64 -0
- package/src/results/diff-output.ts +1053 -0
- package/src/results/fetch-result.ts +15 -0
- package/src/results/index.ts +5 -0
- package/src/results/init-result.ts +9 -0
- package/src/results/merge-result.ts +15 -1
- package/src/results/pull-result.ts +17 -3
- package/src/results/push-result.ts +48 -0
- package/src/results/quote-path.ts +103 -0
- package/src/results/rebase-result.ts +37 -0
- package/src/results/revert-result.ts +10 -0
- package/src/results/stash-result.ts +6 -0
- package/src/results/status-result.ts +127 -46
- package/src/transport-command.ts +121 -2
- package/dist/commands-CsLNyvZ1.js +0 -12587
- package/dist/status-result-BpyUK1Sg.js +0 -519
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `git bisect`: the binary search for the commit that introduced a change, as git 2.5x runs
|
|
3
|
+
* it, its state in git's files so native git and these commands continue each other's
|
|
4
|
+
* bisection.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // git bisect start main v1.0
|
|
9
|
+
* let step = await git.bisectStart().setBad("main").addGood("v1.0").call();
|
|
10
|
+
* console.log(step.stdout); // "Bisecting: 3 revisions left to test after this (roughly 2 steps)\n[<id>] <subject>\n"
|
|
11
|
+
* // test the commit checked out, then
|
|
12
|
+
* step = await git.bisectState("bad").call();
|
|
13
|
+
* // ... until step.firstBad is set
|
|
14
|
+
* await git.bisectReset().call();
|
|
15
|
+
*
|
|
16
|
+
* // git bisect run ./test.sh
|
|
17
|
+
* await git.bisectRun().setCommand(["./test.sh"]).setRunHandler(async ({ commit }) => test(commit)).call();
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { isSymbolicRef, isValidRefName, type ObjectId } from "@statewalker/vcs-core";
|
|
22
|
+
import { decodeGitPath, encodeGitPath } from "@statewalker/vcs-utils/encoding";
|
|
23
|
+
|
|
24
|
+
import { InvalidArgumentError, RevisionError } from "../../errors/index.js";
|
|
25
|
+
import { GitCommand } from "../../git-command.js";
|
|
26
|
+
import { CheckoutCommand, CheckoutStatus } from "../checkout-command.js";
|
|
27
|
+
import { DiffCommand } from "../diff-command.js";
|
|
28
|
+
import { hostEnvironmentOf } from "../git-ident.js";
|
|
29
|
+
import { LogCommand } from "../log-command.js";
|
|
30
|
+
import { commitsBaseSource, MergeBaseGraph } from "../merge-bases.js";
|
|
31
|
+
import { configBool, configValue } from "../merge-config.js";
|
|
32
|
+
import { OperationState } from "../merge-support.js";
|
|
33
|
+
import { formatCommitPretty } from "../pretty-format.js";
|
|
34
|
+
import {
|
|
35
|
+
handleRevisionArg,
|
|
36
|
+
type RevisionArgEntry,
|
|
37
|
+
unknownRevisionMessage,
|
|
38
|
+
} from "../revision-range.js";
|
|
39
|
+
import { shortenUnambiguousRef } from "../worktree-list-command.js";
|
|
40
|
+
import { gitCheckout } from "./bisect-checkout.js";
|
|
41
|
+
import {
|
|
42
|
+
BISECT_USAGE,
|
|
43
|
+
BisectCode,
|
|
44
|
+
type BisectContext,
|
|
45
|
+
BisectEngine,
|
|
46
|
+
type BisectRunHandler,
|
|
47
|
+
isBisectSuccess,
|
|
48
|
+
} from "./bisect-engine.js";
|
|
49
|
+
import { BisectDie, BisectGraph, type BisectGraphSource } from "./bisect-graph.js";
|
|
50
|
+
|
|
51
|
+
/** What a `git bisect` command did. */
|
|
52
|
+
export interface BisectResult {
|
|
53
|
+
/** git's exit status (0 also when the first bad commit is found or a merge base is checked out) */
|
|
54
|
+
exitCode: number;
|
|
55
|
+
/**
|
|
56
|
+
* What git prints on stdout, decoded as paths decode ({@link decodeGitPath}): the subjects
|
|
57
|
+
* git prints without re-encoding them (`[<id>] <subject>`) keep bytes that are no UTF-8
|
|
58
|
+
* as lone surrogates, so `encodeGitPath(stdout)` is git's output byte for byte
|
|
59
|
+
* ({@link stdoutBytes})
|
|
60
|
+
*/
|
|
61
|
+
stdout: string;
|
|
62
|
+
/** git's stdout as bytes */
|
|
63
|
+
stdoutBytes: Uint8Array;
|
|
64
|
+
/** What git prints on stderr (its `error:`, `warning:` and `fatal:` lines, and checkout's) */
|
|
65
|
+
stderr: string;
|
|
66
|
+
/** git's bisect result code (bisect.h's enum bisect_error) */
|
|
67
|
+
code: BisectCode;
|
|
68
|
+
/** The commit checked out (or written to BISECT_HEAD) for testing, if one was */
|
|
69
|
+
candidate?: ObjectId;
|
|
70
|
+
/** The first bad (new) commit, once found */
|
|
71
|
+
firstBad?: ObjectId;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** The subcommands of cmd_bisect's OPT_SUBCOMMANDs. */
|
|
75
|
+
const SUBCOMMANDS = new Set([
|
|
76
|
+
"reset",
|
|
77
|
+
"terms",
|
|
78
|
+
"start",
|
|
79
|
+
"next",
|
|
80
|
+
"log",
|
|
81
|
+
"replay",
|
|
82
|
+
"skip",
|
|
83
|
+
"visualize",
|
|
84
|
+
"view",
|
|
85
|
+
"run",
|
|
86
|
+
]);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* `git bisect <subcommand> <args>...` as git's `cmd_bisect` dispatches it: `start`, `bad`,
|
|
90
|
+
* `good`, `new`, `old`, a custom term, `skip`, `next`, `reset`, `terms`, `log`, `replay`,
|
|
91
|
+
* `run`, `help`, and git's options before them (`-h`, `--`, `--end-of-options`). The typed
|
|
92
|
+
* commands ({@link BisectStartCommand}, ...) build these arguments. `visualize` is not run
|
|
93
|
+
* (it starts gitk or `git log`).
|
|
94
|
+
*/
|
|
95
|
+
export class BisectCommand extends GitCommand<BisectResult> {
|
|
96
|
+
protected args: string[] = [];
|
|
97
|
+
private runHandler?: BisectRunHandler;
|
|
98
|
+
private logText?: string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The arguments after `git bisect`. A typed command that builds its own arguments
|
|
102
|
+
* refuses them ({@link BisectStartCommand} takes them as the arguments after `start`).
|
|
103
|
+
*/
|
|
104
|
+
setArguments(args: string[]): this {
|
|
105
|
+
this.checkCallable();
|
|
106
|
+
this.acceptArguments([...args]);
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Where {@link setArguments} puts the arguments. */
|
|
111
|
+
protected acceptArguments(args: string[]): void {
|
|
112
|
+
this.args = args;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Runs the command of `bisect run` (git runs it with the shell); see {@link BisectRunHandler}. */
|
|
116
|
+
setRunHandler(handler: BisectRunHandler): this {
|
|
117
|
+
this.checkCallable();
|
|
118
|
+
this.runHandler = handler;
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** The text of the log `bisect replay <logfile>` reads (a portable command reads no files). */
|
|
123
|
+
setLogText(text: string): this {
|
|
124
|
+
this.checkCallable();
|
|
125
|
+
this.logText = text;
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** The arguments the command runs with. */
|
|
130
|
+
protected arguments(): string[] {
|
|
131
|
+
return this.args;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async call(): Promise<BisectResult> {
|
|
135
|
+
this.checkCallable();
|
|
136
|
+
this.setCallable(false);
|
|
137
|
+
const engine = new BisectEngine(this.context());
|
|
138
|
+
let res: number;
|
|
139
|
+
let exitCode: number | undefined;
|
|
140
|
+
try {
|
|
141
|
+
res = await this.dispatch(engine, this.arguments());
|
|
142
|
+
if (res === BisectCode.INTERNAL_SUCCESS_1ST_BAD_FOUND) {
|
|
143
|
+
const mode = await engine.readResetWhenFound();
|
|
144
|
+
if (mode === "invalid") res = BisectCode.FAILED;
|
|
145
|
+
else if (mode && (await engine.resetWhenFound(mode))) res = BisectCode.FAILED;
|
|
146
|
+
}
|
|
147
|
+
} catch (error) {
|
|
148
|
+
res = BisectCode.FAILED;
|
|
149
|
+
if (error instanceof BisectUsage) {
|
|
150
|
+
// parse-options: usage_msg_opt (fatal:), an unknown option (error:), `help`, `-h`
|
|
151
|
+
exitCode = error.kind === "help-stdout" ? 0 : 129;
|
|
152
|
+
if (error.kind === "help-stdout") {
|
|
153
|
+
engine.print(`${usageText()}\n\n`);
|
|
154
|
+
res = BisectCode.OK;
|
|
155
|
+
} else if (error.kind === "help") engine.printErr(`${usageText()}\n\n`);
|
|
156
|
+
else if (error.kind === "option")
|
|
157
|
+
engine.printErr(`error: ${error.message}\n${usageText()}\n\n`);
|
|
158
|
+
else engine.printErr(`fatal: ${error.message}\n\n${usageText()}\n\n`);
|
|
159
|
+
} else if (error instanceof BisectDie) {
|
|
160
|
+
exitCode = 128;
|
|
161
|
+
engine.printErr(`fatal: ${error.message}\n`);
|
|
162
|
+
} else if (error instanceof RevisionError) {
|
|
163
|
+
// where git's revision machinery dies (its lines are `fatal:` ones already)
|
|
164
|
+
exitCode = 128;
|
|
165
|
+
engine.printErr(error.message.endsWith("\n") ? error.message : `${error.message}\n`);
|
|
166
|
+
} else throw error;
|
|
167
|
+
}
|
|
168
|
+
const { stdout, stderr } = engine.output;
|
|
169
|
+
return {
|
|
170
|
+
exitCode: exitCode ?? (isBisectSuccess(res) ? 0 : -res & 0xff),
|
|
171
|
+
stdout,
|
|
172
|
+
stdoutBytes: encodeGitPath(stdout),
|
|
173
|
+
stderr,
|
|
174
|
+
code: res,
|
|
175
|
+
...(engine.candidate ? { candidate: engine.candidate } : {}),
|
|
176
|
+
...(engine.firstBad ? { firstBad: engine.firstBad } : {}),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** builtin/bisect.c's cmd_bisect (its parse_options first) and its subcommands */
|
|
181
|
+
private async dispatch(engine: BisectEngine, args: string[]): Promise<number> {
|
|
182
|
+
// parse_options with PARSE_OPT_SUBCOMMAND_OPTIONAL: no option of its own, so the first
|
|
183
|
+
// option is an error; `--` and `--end-of-options` end them
|
|
184
|
+
const first = args[0] ?? "";
|
|
185
|
+
const at = first === "--" || first === "--end-of-options" ? 1 : 0;
|
|
186
|
+
if (at === 0 && first.startsWith("-") && first.length > 1) {
|
|
187
|
+
if (first === "-h") throw new BisectUsage("help-stdout", "");
|
|
188
|
+
if (first.startsWith("--")) {
|
|
189
|
+
throw new BisectUsage("option", `unknown option \`${first.slice(2)}'`);
|
|
190
|
+
}
|
|
191
|
+
throw new BisectUsage("option", `unknown switch \`${first[1]}'`);
|
|
192
|
+
}
|
|
193
|
+
const argv = args.slice(at);
|
|
194
|
+
const [sub, ...rest] = argv;
|
|
195
|
+
const terms = { bad: "bad", good: "good" };
|
|
196
|
+
if (sub === undefined) throw new BisectUsage("fatal", "need a command");
|
|
197
|
+
if (!SUBCOMMANDS.has(sub)) {
|
|
198
|
+
if (sub === "help") throw new BisectUsage("help", "");
|
|
199
|
+
if (!(await engine.getTerms(terms, true))) return engine.error("no terms defined");
|
|
200
|
+
if (
|
|
201
|
+
(await engine.checkAndSetTerms(terms, sub)) ||
|
|
202
|
+
!(sub === terms.good || sub === terms.bad)
|
|
203
|
+
) {
|
|
204
|
+
throw new BisectUsage("fatal", `unknown command: '${sub}'`);
|
|
205
|
+
}
|
|
206
|
+
return engine.state(terms, argv);
|
|
207
|
+
}
|
|
208
|
+
switch (sub) {
|
|
209
|
+
case "reset": {
|
|
210
|
+
if (rest.length > 1) {
|
|
211
|
+
return engine.error("'git bisect reset' requires either no argument or a commit");
|
|
212
|
+
}
|
|
213
|
+
const res = await engine.reset(rest[0], false);
|
|
214
|
+
if (res) return res;
|
|
215
|
+
return engine.cleanState();
|
|
216
|
+
}
|
|
217
|
+
case "terms":
|
|
218
|
+
if (rest.length > 1) return engine.error("'git bisect terms' requires 0 or 1 argument");
|
|
219
|
+
return engine.terms(terms, rest[0]);
|
|
220
|
+
case "start":
|
|
221
|
+
return engine.start(terms, rest);
|
|
222
|
+
case "next":
|
|
223
|
+
if (rest.length > 0) return engine.error("'git bisect next' requires 0 arguments");
|
|
224
|
+
if (!(await engine.getTerms(terms, true))) return engine.error("no terms defined");
|
|
225
|
+
return engine.next(terms);
|
|
226
|
+
case "log":
|
|
227
|
+
return engine.log();
|
|
228
|
+
case "replay":
|
|
229
|
+
if (rest.length !== 1) return engine.error("no logfile given");
|
|
230
|
+
return engine.replay(terms, this.logText, rest[0] as string);
|
|
231
|
+
case "skip":
|
|
232
|
+
if (!(await engine.getTerms(terms, true))) return engine.error("no terms defined");
|
|
233
|
+
return engine.skip(terms, rest);
|
|
234
|
+
case "run":
|
|
235
|
+
if (rest.length === 0) return engine.error("'git bisect run' failed: no command provided.");
|
|
236
|
+
if (!(await engine.getTerms(terms, true))) return engine.error("no terms defined");
|
|
237
|
+
return engine.run(terms, rest);
|
|
238
|
+
default:
|
|
239
|
+
// visualize, view
|
|
240
|
+
throw new BisectDie("'git bisect visualize' is not supported");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** What the engine reads and does, through this command's stores. */
|
|
245
|
+
private context(): BisectContext {
|
|
246
|
+
const refs = this.refsStore;
|
|
247
|
+
const state = new OperationState(this.workingCopy.checkout, refs);
|
|
248
|
+
const commits = this.walkCommits;
|
|
249
|
+
// a shallow commit has no parents (git's shallow grafts), here as in `git log`
|
|
250
|
+
let shallowRead: Promise<Set<ObjectId>> | undefined;
|
|
251
|
+
const shallow = () => {
|
|
252
|
+
shallowRead ??= (async () =>
|
|
253
|
+
new Set((await refs.getShallow?.().catch(() => undefined)) ?? []))();
|
|
254
|
+
return shallowRead;
|
|
255
|
+
};
|
|
256
|
+
// the paths compared as LogCommand's history simplification compares them: a pruned tree
|
|
257
|
+
// diff, equal subtrees and paths outside the pathspec skipped, its trees cached
|
|
258
|
+
const comparers = new Map<string, LogCommand>();
|
|
259
|
+
const source: BisectGraphSource = {
|
|
260
|
+
header: async (id) => {
|
|
261
|
+
const commit = await commits.load(id).catch(() => undefined);
|
|
262
|
+
if (!commit) return undefined;
|
|
263
|
+
const parents = (await shallow()).has(id) ? [] : commit.parents;
|
|
264
|
+
return { tree: commit.tree, parents, date: commit.committer.timestamp };
|
|
265
|
+
},
|
|
266
|
+
differs: (from, to, paths) => {
|
|
267
|
+
const key = paths.join("\0");
|
|
268
|
+
let log = comparers.get(key);
|
|
269
|
+
if (!log) {
|
|
270
|
+
log = new LogCommand(this._workingCopy);
|
|
271
|
+
for (const p of paths) log.addPath(p);
|
|
272
|
+
comparers.set(key, log);
|
|
273
|
+
}
|
|
274
|
+
return log.pathsDiffer(from, to);
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
const graph = new BisectGraph(source);
|
|
278
|
+
const mergeBaseGraph = async () => {
|
|
279
|
+
const base = commitsBaseSource(commits, async () => new Map());
|
|
280
|
+
const cut = await shallow();
|
|
281
|
+
if (cut.size === 0) return new MergeBaseGraph(base);
|
|
282
|
+
// no commit-graph generations with shallow commits (git turns the graph off)
|
|
283
|
+
return new MergeBaseGraph({
|
|
284
|
+
load: async (id) => {
|
|
285
|
+
const found = await base.load(id);
|
|
286
|
+
return found && { parents: cut.has(id) ? [] : found.parents, date: found.date };
|
|
287
|
+
},
|
|
288
|
+
tree: base.tree,
|
|
289
|
+
generationOrder: async () => false,
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
const mergeBasesMany = async (one: ObjectId, twos: ObjectId[]) => {
|
|
293
|
+
const g = await mergeBaseGraph();
|
|
294
|
+
const bases = await g.mergeBasesMany(
|
|
295
|
+
g.commit(one),
|
|
296
|
+
twos.map((t) => g.commit(t)),
|
|
297
|
+
);
|
|
298
|
+
return bases.map((n) => n.id).filter((id): id is ObjectId => id !== undefined);
|
|
299
|
+
};
|
|
300
|
+
const resolver = () => this.revisionResolver();
|
|
301
|
+
const resolve = async (rev: string) => {
|
|
302
|
+
try {
|
|
303
|
+
return await resolver().resolve(rev);
|
|
304
|
+
} catch {
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
const peelObject = async (id: ObjectId) => {
|
|
309
|
+
try {
|
|
310
|
+
const peeled = await resolver().peelTags(id);
|
|
311
|
+
return peeled.type ? { id: peeled.id, type: peeled.type as string } : undefined;
|
|
312
|
+
} catch {
|
|
313
|
+
return undefined;
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
const peelCommit = async (id: ObjectId) => {
|
|
317
|
+
const peeled = await peelObject(id);
|
|
318
|
+
return peeled?.type === "commit" ? peeled.id : undefined;
|
|
319
|
+
};
|
|
320
|
+
const subject = (id: ObjectId) => this.rawSubject(id);
|
|
321
|
+
return {
|
|
322
|
+
state,
|
|
323
|
+
graph,
|
|
324
|
+
runHandler: this.runHandler,
|
|
325
|
+
listBisectRefs: async () => {
|
|
326
|
+
const out: { name: string; id: ObjectId }[] = [];
|
|
327
|
+
for await (const ref of refs.list("refs/bisect/")) {
|
|
328
|
+
if (!ref.name.startsWith("refs/bisect/")) continue;
|
|
329
|
+
const id = "objectId" in ref ? ref.objectId : undefined;
|
|
330
|
+
if (id) out.push({ name: ref.name, id });
|
|
331
|
+
}
|
|
332
|
+
return out.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
333
|
+
},
|
|
334
|
+
setRef: (name, id) => refs.set(name, id),
|
|
335
|
+
deleteRef: async (name) => {
|
|
336
|
+
if (await refs.has(name).catch(() => false)) await refs.delete(name);
|
|
337
|
+
},
|
|
338
|
+
refExists: async (name) =>
|
|
339
|
+
(await refs.resolve(name).catch(() => undefined))?.objectId !== undefined,
|
|
340
|
+
resolveHead: async () => {
|
|
341
|
+
const head = await refs.get("HEAD").catch(() => undefined);
|
|
342
|
+
if (!head) return undefined;
|
|
343
|
+
if (isSymbolicRef(head)) {
|
|
344
|
+
const target = await refs.resolve("HEAD").catch(() => undefined);
|
|
345
|
+
return { name: head.target, id: target?.objectId };
|
|
346
|
+
}
|
|
347
|
+
return { name: "HEAD", id: "objectId" in head ? head.objectId : undefined };
|
|
348
|
+
},
|
|
349
|
+
resolve,
|
|
350
|
+
peelCommit,
|
|
351
|
+
peelObject,
|
|
352
|
+
subject,
|
|
353
|
+
showCommit: (id) => this.showCommit(id),
|
|
354
|
+
mergeBasesMany,
|
|
355
|
+
rangePending: async (arg) => {
|
|
356
|
+
// setup_revisions(2, argv + i - 1): the argument alone, no `--` after it
|
|
357
|
+
const out: RevisionArgEntry[] = [];
|
|
358
|
+
const done = await handleRevisionArg(
|
|
359
|
+
resolver(),
|
|
360
|
+
arg,
|
|
361
|
+
false,
|
|
362
|
+
{ mergeBases: (a, b) => mergeBasesMany(a, [b]) },
|
|
363
|
+
out,
|
|
364
|
+
false,
|
|
365
|
+
);
|
|
366
|
+
if (done === false) {
|
|
367
|
+
throw new BisectDie(unknownRevisionMessage(arg).replace(/^fatal: /, ""));
|
|
368
|
+
}
|
|
369
|
+
return out.map((e) => ({ id: e.id, exclude: e.exclude }));
|
|
370
|
+
},
|
|
371
|
+
validRefName: (name) => isValidRefName(name),
|
|
372
|
+
isBare: () => {
|
|
373
|
+
if (configBool(this._workingCopy, "core.bare", false)) return true;
|
|
374
|
+
try {
|
|
375
|
+
return !this._workingCopy.worktree;
|
|
376
|
+
} catch {
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
checkout: (name, options) =>
|
|
381
|
+
gitCheckout(
|
|
382
|
+
{
|
|
383
|
+
checkout: async (target, ignoreOtherWorktrees) => {
|
|
384
|
+
const command = new CheckoutCommand(this._workingCopy).setName(target);
|
|
385
|
+
if (ignoreOtherWorktrees) command.setIgnoreOtherWorktrees(true);
|
|
386
|
+
try {
|
|
387
|
+
const result = await command.call();
|
|
388
|
+
if (result.status === CheckoutStatus.OK) return { ok: true };
|
|
389
|
+
return { ok: false, message: result.message ?? "" };
|
|
390
|
+
} catch (error) {
|
|
391
|
+
return {
|
|
392
|
+
ok: false,
|
|
393
|
+
message: error instanceof Error ? error.message : String(error),
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
head: async () => {
|
|
398
|
+
const head = await refs.get("HEAD").catch(() => undefined);
|
|
399
|
+
const id = (await refs.resolve("HEAD").catch(() => undefined))?.objectId;
|
|
400
|
+
const path = head && isSymbolicRef(head) ? head.target : undefined;
|
|
401
|
+
return { ...(path ? { path } : {}), ...(id ? { id } : {}) };
|
|
402
|
+
},
|
|
403
|
+
localChanges: (commit) =>
|
|
404
|
+
new DiffCommand(this._workingCopy)
|
|
405
|
+
.setOldTree(commit)
|
|
406
|
+
.setRenames(false)
|
|
407
|
+
.callText("name-status"),
|
|
408
|
+
abbreviate: (id) => this.abbreviateObjectId(id),
|
|
409
|
+
subject: (id) => this.onelineSubject(id),
|
|
410
|
+
printSha1Ellipsis: hostEnvironmentOf(this._workingCopy)?.printSha1Ellipsis === true,
|
|
411
|
+
commits: source,
|
|
412
|
+
refCommits: async () => {
|
|
413
|
+
const out: ObjectId[] = [];
|
|
414
|
+
for await (const ref of refs.list("refs/")) {
|
|
415
|
+
const id =
|
|
416
|
+
"objectId" in ref && ref.objectId
|
|
417
|
+
? ref.objectId
|
|
418
|
+
: (await refs.resolve(ref.name).catch(() => undefined))?.objectId;
|
|
419
|
+
const commit = id ? await peelCommit(id) : undefined;
|
|
420
|
+
if (commit) out.push(commit);
|
|
421
|
+
}
|
|
422
|
+
return out;
|
|
423
|
+
},
|
|
424
|
+
config: (key) => configValue(this._workingCopy, key),
|
|
425
|
+
upstreamOf: (branch) =>
|
|
426
|
+
resolver()
|
|
427
|
+
.upstreamOf(branch)
|
|
428
|
+
.catch(() => undefined),
|
|
429
|
+
pushOf: (branch) =>
|
|
430
|
+
resolver()
|
|
431
|
+
.pushOf(branch)
|
|
432
|
+
.catch(() => undefined),
|
|
433
|
+
refCommit: async (ref) => {
|
|
434
|
+
const id = (await refs.resolve(ref).catch(() => undefined))?.objectId;
|
|
435
|
+
return id ? peelCommit(id) : undefined;
|
|
436
|
+
},
|
|
437
|
+
pushRemoteOf: async (branch) => {
|
|
438
|
+
try {
|
|
439
|
+
return resolver().pushRemoteOf(branch);
|
|
440
|
+
} catch {
|
|
441
|
+
return undefined;
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
shortenRef: (ref) => shortenUnambiguousRef(refs, ref),
|
|
445
|
+
},
|
|
446
|
+
name,
|
|
447
|
+
options,
|
|
448
|
+
),
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* The commit's `%s` as git's format_commit_message gives it without an output encoding
|
|
454
|
+
* (bisect.c's `[%H] %s`, the `# bad: [<id>] <subject>` lines of BISECT_LOG): the message's
|
|
455
|
+
* bytes as stored, not re-encoded, decoded as paths decode.
|
|
456
|
+
*/
|
|
457
|
+
private async rawSubject(id: ObjectId): Promise<string> {
|
|
458
|
+
const commit = await this.walkCommits.load(id).catch(() => undefined);
|
|
459
|
+
if (!commit) return "";
|
|
460
|
+
let message = commit.message;
|
|
461
|
+
const bytes = await this.rawObject(id);
|
|
462
|
+
if (bytes) {
|
|
463
|
+
const text = decodeGitPath(bytes);
|
|
464
|
+
const at = text.indexOf("\n\n");
|
|
465
|
+
message = at < 0 ? "" : text.slice(at + 2);
|
|
466
|
+
}
|
|
467
|
+
return formatCommitPretty("%s", { ...commit, message }, id);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* The subject CMIT_FMT_ONELINE shows (pp_commit_easy): the message in the log output
|
|
472
|
+
* encoding (`i18n.logOutputEncoding`, else `i18n.commitEncoding`, else UTF-8). A message
|
|
473
|
+
* already in that encoding is printed as stored; another is shown in UTF-8 (the only other
|
|
474
|
+
* output encoding supported).
|
|
475
|
+
*/
|
|
476
|
+
private async onelineSubject(id: ObjectId): Promise<string> {
|
|
477
|
+
const commit = await this.walkCommits.load(id).catch(() => undefined);
|
|
478
|
+
if (!commit) return "";
|
|
479
|
+
const canon = (charset: string) => charset.toLowerCase().replace(/^utf-?8$/, "utf-8");
|
|
480
|
+
const output =
|
|
481
|
+
configValue(this._workingCopy, "i18n.logOutputEncoding") ??
|
|
482
|
+
configValue(this._workingCopy, "i18n.commitEncoding") ??
|
|
483
|
+
"UTF-8";
|
|
484
|
+
if (canon(output) === canon(commit.encoding ?? "UTF-8")) return this.rawSubject(id);
|
|
485
|
+
return formatCommitPretty("%s", commit, id);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/** An object's content as stored (undefined when missing or without a raw store) */
|
|
489
|
+
private async rawObject(id: ObjectId): Promise<Uint8Array | undefined> {
|
|
490
|
+
const objects = this._workingCopy.history?.objects;
|
|
491
|
+
if (!objects) return undefined;
|
|
492
|
+
try {
|
|
493
|
+
const obj = await objects.get(id);
|
|
494
|
+
if (!obj) return undefined;
|
|
495
|
+
if (obj.bytes) return obj.bytes;
|
|
496
|
+
const chunks: Uint8Array[] = [];
|
|
497
|
+
let size = 0;
|
|
498
|
+
for await (const c of obj.content) {
|
|
499
|
+
chunks.push(c);
|
|
500
|
+
size += c.length;
|
|
501
|
+
}
|
|
502
|
+
const out = new Uint8Array(size);
|
|
503
|
+
let at = 0;
|
|
504
|
+
for (const c of chunks) {
|
|
505
|
+
out.set(c, at);
|
|
506
|
+
at += c.length;
|
|
507
|
+
}
|
|
508
|
+
return out;
|
|
509
|
+
} catch {
|
|
510
|
+
return undefined;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* git's show_commit: `git show --stat --summary --no-abbrev-commit
|
|
516
|
+
* --diff-merges=first-parent <id>`, printed as `git log` prints that one commit (no
|
|
517
|
+
* decorations, as without a terminal): the configuration's format, dates, mailmap and notes
|
|
518
|
+
* apply as they apply to `git show`.
|
|
519
|
+
*/
|
|
520
|
+
private async showCommit(id: ObjectId): Promise<string> {
|
|
521
|
+
try {
|
|
522
|
+
const bytes = await new LogCommand(this._workingCopy).add(id).setMaxCount(1).callBytes({
|
|
523
|
+
stat: true,
|
|
524
|
+
summary: true,
|
|
525
|
+
abbrevCommit: false,
|
|
526
|
+
diffMerges: "first-parent",
|
|
527
|
+
});
|
|
528
|
+
return decodeGitPath(bytes);
|
|
529
|
+
} catch (error) {
|
|
530
|
+
if (error instanceof BisectDie) throw error;
|
|
531
|
+
throw new BisectDie(`unable to start 'show' for object '${id}'`);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Where git's parse_options prints its usage: `fatal:` (usage_msg_opt), an unknown option (`error:`), `help`, `-h`. */
|
|
537
|
+
class BisectUsage extends Error {
|
|
538
|
+
constructor(
|
|
539
|
+
readonly kind: "fatal" | "option" | "help" | "help-stdout",
|
|
540
|
+
message: string,
|
|
541
|
+
) {
|
|
542
|
+
super(message);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function usageText(): string {
|
|
547
|
+
return BISECT_USAGE.map((line, i) => {
|
|
548
|
+
const prefix = i === 0 ? "usage: " : " or: ";
|
|
549
|
+
return prefix + line.replaceAll("\n", `\n${" ".repeat(prefix.length)}`);
|
|
550
|
+
}).join("\n");
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** A typed command's refusal of raw arguments. */
|
|
554
|
+
function refuseArguments(command: string, args: string[]): never {
|
|
555
|
+
throw new InvalidArgumentError(
|
|
556
|
+
"arguments",
|
|
557
|
+
args,
|
|
558
|
+
`${command} builds its own arguments; use git.bisect().setArguments() for raw ones`,
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* `git bisect start [--term-new=<term> --term-old=<term>] [--no-checkout] [--first-parent]
|
|
564
|
+
* [<bad> [<good>...]] [--] [<paths>...]`: the bisection begins (any earlier one is reset),
|
|
565
|
+
* and with a bad and a good commit the first candidate is checked out.
|
|
566
|
+
*/
|
|
567
|
+
export class BisectStartCommand extends BisectCommand {
|
|
568
|
+
private readonly paths: string[] = [];
|
|
569
|
+
|
|
570
|
+
/** {@link setArguments}: the arguments after `start` (before the paths added). */
|
|
571
|
+
protected override acceptArguments(args: string[]): void {
|
|
572
|
+
this.args = args;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** An argument as given on git's command line (options, revisions, `--`, paths). */
|
|
576
|
+
addArgument(arg: string): this {
|
|
577
|
+
this.checkCallable();
|
|
578
|
+
this.args.push(arg);
|
|
579
|
+
return this;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** `--term-new=<term>` (`--term-bad`) */
|
|
583
|
+
setTermNew(term: string): this {
|
|
584
|
+
return this.addArgument(`--term-new=${term}`);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/** `--term-old=<term>` (`--term-good`) */
|
|
588
|
+
setTermOld(term: string): this {
|
|
589
|
+
return this.addArgument(`--term-old=${term}`);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** `--no-checkout`: the candidates go to BISECT_HEAD, the worktree stays */
|
|
593
|
+
setNoCheckout(noCheckout = true): this {
|
|
594
|
+
return noCheckout ? this.addArgument("--no-checkout") : this;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/** `--first-parent`: only the first parents of merges are followed */
|
|
598
|
+
setFirstParent(firstParent = true): this {
|
|
599
|
+
return firstParent ? this.addArgument("--first-parent") : this;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/** The bad (new) revision: the first revision argument */
|
|
603
|
+
setBad(rev: string): this {
|
|
604
|
+
return this.addArgument(rev);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/** A good (old) revision, after the bad one */
|
|
608
|
+
addGood(rev: string): this {
|
|
609
|
+
return this.addArgument(rev);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/** A path the bisection is limited to (after `--`) */
|
|
613
|
+
addPath(path: string): this {
|
|
614
|
+
this.checkCallable();
|
|
615
|
+
this.paths.push(path);
|
|
616
|
+
return this;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
protected override arguments(): string[] {
|
|
620
|
+
return ["start", ...this.args, ...(this.paths.length > 0 ? ["--", ...this.paths] : [])];
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* `git bisect <term> [<rev>...]`: the revisions (HEAD, or BISECT_HEAD, when none) marked
|
|
626
|
+
* with a term (`bad`, `good`, `new`, `old` or the bisection's own), then the next candidate
|
|
627
|
+
* checked out, or the first bad commit shown.
|
|
628
|
+
*/
|
|
629
|
+
export class BisectStateCommand extends BisectCommand {
|
|
630
|
+
/** Refused: the command builds its own arguments. */
|
|
631
|
+
protected override acceptArguments(args: string[]): void {
|
|
632
|
+
refuseArguments("BisectStateCommand", args);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
private term = "bad";
|
|
636
|
+
private readonly revisions: string[] = [];
|
|
637
|
+
|
|
638
|
+
/** The term: `bad`, `good`, `new`, `old`, or one given to `start` */
|
|
639
|
+
setTerm(term: string): this {
|
|
640
|
+
this.checkCallable();
|
|
641
|
+
this.term = term;
|
|
642
|
+
return this;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/** A revision to mark (one at most for the bad term) */
|
|
646
|
+
addRevision(rev: string): this {
|
|
647
|
+
this.checkCallable();
|
|
648
|
+
this.revisions.push(rev);
|
|
649
|
+
return this;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
protected override arguments(): string[] {
|
|
653
|
+
return [this.term, ...this.revisions];
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/** `git bisect skip [(<rev>|<range>)...]`: commits that cannot be tested. */
|
|
658
|
+
export class BisectSkipCommand extends BisectCommand {
|
|
659
|
+
/** Refused: the command builds its own arguments. */
|
|
660
|
+
protected override acceptArguments(args: string[]): void {
|
|
661
|
+
refuseArguments("BisectSkipCommand", args);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
private readonly revisions: string[] = [];
|
|
665
|
+
|
|
666
|
+
/** A revision or a range (`a..b`) to skip */
|
|
667
|
+
addRevision(rev: string): this {
|
|
668
|
+
this.checkCallable();
|
|
669
|
+
this.revisions.push(rev);
|
|
670
|
+
return this;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
protected override arguments(): string[] {
|
|
674
|
+
return ["skip", ...this.revisions];
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/** `git bisect next`: the next candidate checked out. */
|
|
679
|
+
export class BisectNextCommand extends BisectCommand {
|
|
680
|
+
/** Refused: the command builds its own arguments. */
|
|
681
|
+
protected override acceptArguments(args: string[]): void {
|
|
682
|
+
refuseArguments("BisectNextCommand", args);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
protected override arguments(): string[] {
|
|
686
|
+
return ["next"];
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/** `git bisect reset [<commit>]`: the bisection ends, the original branch (or `commit`) checked out. */
|
|
691
|
+
export class BisectResetCommand extends BisectCommand {
|
|
692
|
+
/** Refused: the command builds its own arguments. */
|
|
693
|
+
protected override acceptArguments(args: string[]): void {
|
|
694
|
+
refuseArguments("BisectResetCommand", args);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
private commit?: string;
|
|
698
|
+
|
|
699
|
+
/** The commit to check out instead of the branch the bisection started on */
|
|
700
|
+
setCommit(commit: string): this {
|
|
701
|
+
this.checkCallable();
|
|
702
|
+
this.commit = commit;
|
|
703
|
+
return this;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
protected override arguments(): string[] {
|
|
707
|
+
return this.commit === undefined ? ["reset"] : ["reset", this.commit];
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/** `git bisect terms [--term-good | --term-bad]` */
|
|
712
|
+
export class BisectTermsCommand extends BisectCommand {
|
|
713
|
+
/** Refused: the command builds its own arguments. */
|
|
714
|
+
protected override acceptArguments(args: string[]): void {
|
|
715
|
+
refuseArguments("BisectTermsCommand", args);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
private option?: string;
|
|
719
|
+
|
|
720
|
+
/** `--term-good` / `--term-old` / `--term-bad` / `--term-new` */
|
|
721
|
+
setOption(option: string): this {
|
|
722
|
+
this.checkCallable();
|
|
723
|
+
this.option = option;
|
|
724
|
+
return this;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
protected override arguments(): string[] {
|
|
728
|
+
return this.option === undefined ? ["terms"] : ["terms", this.option];
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/** `git bisect log`: the bisection's log (its stdout). */
|
|
733
|
+
export class BisectLogCommand extends BisectCommand {
|
|
734
|
+
/** Refused: the command builds its own arguments. */
|
|
735
|
+
protected override acceptArguments(args: string[]): void {
|
|
736
|
+
refuseArguments("BisectLogCommand", args);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
protected override arguments(): string[] {
|
|
740
|
+
return ["log"];
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/** `git bisect replay <logfile>`, over the log's text. */
|
|
745
|
+
export class BisectReplayCommand extends BisectCommand {
|
|
746
|
+
/** Refused: the command builds its own arguments. */
|
|
747
|
+
protected override acceptArguments(args: string[]): void {
|
|
748
|
+
refuseArguments("BisectReplayCommand", args);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
private name = "BISECT_LOG";
|
|
752
|
+
|
|
753
|
+
/** The log to replay (as `git bisect log` printed it), and the name errors give it */
|
|
754
|
+
setLog(text: string, name = this.name): this {
|
|
755
|
+
this.setLogText(text);
|
|
756
|
+
this.name = name;
|
|
757
|
+
return this;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
protected override arguments(): string[] {
|
|
761
|
+
return ["replay", this.name];
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* `git bisect run <cmd> [<arg>...]`: the command run on each candidate through the
|
|
767
|
+
* {@link setRunHandler} hook (0 good, 125 skip, 1-127 bad, 128 or more aborts), until the
|
|
768
|
+
* first bad commit is found.
|
|
769
|
+
*/
|
|
770
|
+
export class BisectRunCommand extends BisectCommand {
|
|
771
|
+
/** Refused: the command builds its own arguments. */
|
|
772
|
+
protected override acceptArguments(args: string[]): void {
|
|
773
|
+
refuseArguments("BisectRunCommand", args);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
private command: string[] = [];
|
|
777
|
+
|
|
778
|
+
/** The command and its arguments */
|
|
779
|
+
setCommand(argv: string[]): this {
|
|
780
|
+
this.checkCallable();
|
|
781
|
+
this.command = [...argv];
|
|
782
|
+
return this;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
protected override arguments(): string[] {
|
|
786
|
+
return ["run", ...this.command];
|
|
787
|
+
}
|
|
788
|
+
}
|