@statewalker/vcs-commands 0.7.0 → 0.9.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/dist/commands/add-command.d.ts +70 -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.map +1 -1
- package/dist/commands/am/am-command.d.ts +102 -1
- package/dist/commands/am/am-command.d.ts.map +1 -1
- package/dist/commands/am/index.d.ts +1 -0
- package/dist/commands/am/index.d.ts.map +1 -1
- package/dist/commands/am/mailsplit.d.ts +88 -0
- package/dist/commands/am/mailsplit.d.ts.map +1 -0
- 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-engine.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/bisect/bisect-command.d.ts +2 -0
- package/dist/commands/bisect/bisect-command.d.ts.map +1 -1
- package/dist/commands/blame-command.d.ts +303 -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/branch-command.d.ts +148 -18
- package/dist/commands/branch-command.d.ts.map +1 -1
- package/dist/commands/branch-info-command.d.ts +55 -0
- package/dist/commands/branch-info-command.d.ts.map +1 -0
- package/dist/commands/branch-tracking.d.ts +106 -17
- package/dist/commands/branch-tracking.d.ts.map +1 -1
- package/dist/commands/branch-upstream-command.d.ts +83 -0
- package/dist/commands/branch-upstream-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/checkout-command.d.ts +26 -3
- package/dist/commands/checkout-command.d.ts.map +1 -1
- 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 +82 -1
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +44 -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 +116 -2
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +239 -5
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/commit-reuse.d.ts +33 -0
- package/dist/commands/commit-reuse.d.ts.map +1 -0
- package/dist/commands/config-command.d.ts +236 -0
- package/dist/commands/config-command.d.ts.map +1 -0
- package/dist/commands/config-value-types.d.ts +91 -0
- package/dist/commands/config-value-types.d.ts.map +1 -0
- package/dist/commands/core-config.d.ts +20 -0
- package/dist/commands/core-config.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-color-config.d.ts +73 -0
- package/dist/commands/diff-color-config.d.ts.map +1 -0
- package/dist/commands/diff-command.d.ts +369 -10
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/fetch-command.d.ts +80 -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/fmt-merge-msg-command.d.ts +124 -0
- package/dist/commands/fmt-merge-msg-command.d.ts.map +1 -0
- package/dist/commands/fork-point.d.ts +38 -0
- package/dist/commands/fork-point.d.ts.map +1 -0
- package/dist/commands/format-patch-command.d.ts +69 -3
- package/dist/commands/format-patch-command.d.ts.map +1 -1
- package/dist/commands/fsck/fetch-fsck.d.ts +51 -0
- package/dist/commands/fsck/fetch-fsck.d.ts.map +1 -1
- package/dist/commands/gc-command.d.ts +8 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-describe.d.ts +81 -4
- package/dist/commands/git-describe.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +50 -1
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/grep/grep-command.d.ts +210 -0
- package/dist/commands/grep/grep-command.d.ts.map +1 -0
- package/dist/commands/grep/grep-engine.d.ts +218 -0
- package/dist/commands/grep/grep-engine.d.ts.map +1 -0
- package/dist/commands/grep/index.d.ts +3 -0
- package/dist/commands/grep/index.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +13 -2
- package/dist/commands/index-adder.d.ts.map +1 -1
- package/dist/commands/index.d.ts +38 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +5 -3
- package/dist/commands/init-command.d.ts +89 -0
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/interpret-trailers-command.d.ts +90 -0
- package/dist/commands/interpret-trailers-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 +36 -5
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/log-command.d.ts +527 -13
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +30 -3
- package/dist/commands/log-graph.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +199 -6
- package/dist/commands/log-output.d.ts.map +1 -1
- package/dist/commands/ls-remote-command.d.ts +2 -0
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/mailmap.d.ts +53 -0
- package/dist/commands/mailmap.d.ts.map +1 -1
- package/dist/commands/merge-base-command.d.ts +60 -0
- package/dist/commands/merge-base-command.d.ts.map +1 -0
- package/dist/commands/merge-bases.d.ts +23 -0
- package/dist/commands/merge-bases.d.ts.map +1 -1
- package/dist/commands/merge-command.d.ts +147 -10
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-drivers.d.ts +2 -0
- 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 +10 -0
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/message-cleanup.d.ts +2 -0
- package/dist/commands/message-cleanup.d.ts.map +1 -1
- package/dist/commands/mv-command.d.ts +4 -0
- package/dist/commands/mv-command.d.ts.map +1 -1
- 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 +136 -0
- package/dist/commands/name-rev.d.ts.map +1 -0
- package/dist/commands/notes-command.d.ts.map +1 -1
- 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 +16 -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.d.ts +58 -0
- package/dist/commands/patch-id.d.ts.map +1 -1
- package/dist/commands/pathspec-file.d.ts +39 -0
- package/dist/commands/pathspec-file.d.ts.map +1 -0
- package/dist/commands/pathspec.d.ts +3 -0
- package/dist/commands/pathspec.d.ts.map +1 -1
- package/dist/commands/pretty-format.d.ts +43 -3
- package/dist/commands/pretty-format.d.ts.map +1 -1
- package/dist/commands/promisor-remote.d.ts.map +1 -1
- package/dist/commands/pull-command.d.ts +186 -32
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +225 -9
- 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 +20 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +189 -8
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/ref-filter/for-each-ref-command.d.ts +121 -0
- package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -0
- package/dist/commands/ref-filter/index.d.ts +8 -0
- package/dist/commands/ref-filter/index.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-atoms.d.ts +88 -0
- package/dist/commands/ref-filter/ref-atoms.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-filter.d.ts +178 -0
- package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-format.d.ts +222 -0
- package/dist/commands/ref-filter/ref-format.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-listing-command.d.ts +56 -0
- package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-quote.d.ts +20 -0
- package/dist/commands/ref-filter/ref-quote.d.ts.map +1 -0
- package/dist/commands/ref-filter/version-compare.d.ts +20 -0
- package/dist/commands/ref-filter/version-compare.d.ts.map +1 -0
- package/dist/commands/reflog-command.d.ts +120 -0
- package/dist/commands/reflog-command.d.ts.map +1 -1
- package/dist/commands/reflog-walk.d.ts +72 -0
- package/dist/commands/reflog-walk.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 +179 -29
- package/dist/commands/remote-command.d.ts.map +1 -1
- 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 +7 -1
- package/dist/commands/remote-transport.d.ts.map +1 -1
- package/dist/commands/reset-command.d.ts +21 -4
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +9 -3
- package/dist/commands/restore-command.d.ts.map +1 -1
- package/dist/commands/rev-filter/commit-filter.d.ts +95 -0
- package/dist/commands/rev-filter/commit-filter.d.ts.map +1 -0
- package/dist/commands/rev-filter/commit-grep.d.ts +91 -0
- package/dist/commands/rev-filter/commit-grep.d.ts.map +1 -0
- package/dist/commands/rev-filter/index.d.ts +3 -0
- package/dist/commands/rev-filter/index.d.ts.map +1 -0
- package/dist/commands/rev-list-command.d.ts +226 -2
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +54 -1
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +34 -1
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/revision-resolver.d.ts +15 -0
- package/dist/commands/revision-resolver.d.ts.map +1 -1
- package/dist/commands/rm-command.d.ts +70 -2
- package/dist/commands/rm-command.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +186 -5
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/sequencer-support.d.ts +12 -1
- package/dist/commands/sequencer-support.d.ts.map +1 -1
- package/dist/commands/serve-repository.d.ts +7 -0
- package/dist/commands/serve-repository.d.ts.map +1 -1
- 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-command.d.ts +130 -0
- package/dist/commands/show-command.d.ts.map +1 -0
- package/dist/commands/show-commit.d.ts +11 -0
- package/dist/commands/show-commit.d.ts.map +1 -0
- package/dist/commands/signature-check.d.ts +164 -0
- package/dist/commands/signature-check.d.ts.map +1 -0
- package/dist/commands/signing.d.ts +160 -0
- package/dist/commands/signing.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-command.d.ts.map +1 -1
- package/dist/commands/sparse-index-view.d.ts +45 -0
- package/dist/commands/sparse-index-view.d.ts.map +1 -0
- package/dist/commands/ssh-signer.d.ts +29 -0
- package/dist/commands/ssh-signer.d.ts.map +1 -0
- package/dist/commands/ssh-verifier.d.ts +42 -0
- package/dist/commands/ssh-verifier.d.ts.map +1 -0
- package/dist/commands/stash-apply-command.d.ts +5 -0
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-branch-command.d.ts +34 -0
- package/dist/commands/stash-branch-command.d.ts.map +1 -0
- package/dist/commands/stash-create-command.d.ts +17 -0
- package/dist/commands/stash-create-command.d.ts.map +1 -1
- package/dist/commands/stash-info.d.ts +93 -0
- package/dist/commands/stash-info.d.ts.map +1 -0
- package/dist/commands/stash-list-command.d.ts +16 -0
- package/dist/commands/stash-list-command.d.ts.map +1 -1
- package/dist/commands/stash-pop-command.d.ts +39 -0
- package/dist/commands/stash-pop-command.d.ts.map +1 -0
- package/dist/commands/stash-show-command.d.ts +48 -0
- package/dist/commands/stash-show-command.d.ts.map +1 -0
- package/dist/commands/stash-store-command.d.ts +29 -0
- package/dist/commands/stash-store-command.d.ts.map +1 -0
- package/dist/commands/stash-working-tree.d.ts.map +1 -1
- package/dist/commands/status-command.d.ts +31 -2
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/status-header.d.ts +5 -0
- package/dist/commands/status-header.d.ts.map +1 -1
- package/dist/commands/submodule-add-command.d.ts +89 -0
- package/dist/commands/submodule-add-command.d.ts.map +1 -0
- package/dist/commands/submodule-auth.d.ts +90 -0
- package/dist/commands/submodule-auth.d.ts.map +1 -0
- package/dist/commands/submodule-commands.d.ts +463 -0
- package/dist/commands/submodule-commands.d.ts.map +1 -0
- 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 +296 -0
- package/dist/commands/submodule-model.d.ts.map +1 -0
- 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 +206 -0
- package/dist/commands/submodule-update-command.d.ts.map +1 -0
- 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/tag-command.d.ts +259 -10
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/trailers.d.ts +218 -17
- package/dist/commands/trailers.d.ts.map +1 -1
- package/dist/commands/tree-restore.d.ts +7 -0
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/verify-command.d.ts +92 -0
- package/dist/commands/verify-command.d.ts.map +1 -0
- package/dist/commands/worktree-add-command.d.ts +79 -7
- package/dist/commands/worktree-add-command.d.ts.map +1 -1
- package/dist/commands/worktree-overwrite-checks.d.ts +2 -0
- package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
- package/dist/commands/worktree-path-rules.d.ts +66 -0
- package/dist/commands/worktree-path-rules.d.ts.map +1 -0
- package/dist/commands/worktree-remove-command.d.ts +10 -3
- package/dist/commands/worktree-remove-command.d.ts.map +1 -1
- package/dist/commands/worktree-repair-command.d.ts +15 -2
- package/dist/commands/worktree-repair-command.d.ts.map +1 -1
- package/dist/commands/worktree-support.d.ts +5 -0
- package/dist/commands/worktree-support.d.ts.map +1 -1
- package/dist/{commands-DIJ91NnD.js → commands-CNvli5bl.js} +49442 -54941
- package/dist/errors/checkout-errors.d.ts +19 -0
- package/dist/errors/checkout-errors.d.ts.map +1 -1
- package/dist/errors/command-errors.d.ts +25 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/index.js +85 -3
- package/dist/errors/ref-errors.d.ts +19 -0
- package/dist/errors/ref-errors.d.ts.map +1 -1
- package/dist/errors/worktree-errors.d.ts +6 -1
- package/dist/errors/worktree-errors.d.ts.map +1 -1
- package/dist/fsck-CPeDh9fh.js +5138 -0
- package/dist/git-command.d.ts +58 -2
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +363 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/guarded-transport-command.d.ts +82 -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 +6 -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 +55 -0
- package/dist/remote-config/remote-config-store.d.ts.map +1 -1
- package/dist/remote-transport-CCmBadm-.js +1606 -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/clone-result.d.ts +9 -0
- package/dist/results/clone-result.d.ts.map +1 -1
- package/dist/results/combined-diff.d.ts +3 -0
- package/dist/results/combined-diff.d.ts.map +1 -1
- package/dist/results/diff-check.d.ts +38 -0
- package/dist/results/diff-check.d.ts.map +1 -0
- package/dist/results/diff-color.d.ts +135 -0
- package/dist/results/diff-color.d.ts.map +1 -0
- 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 +10 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-output.d.ts +103 -1
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/diff-pickaxe.d.ts +67 -0
- package/dist/results/diff-pickaxe.d.ts.map +1 -0
- package/dist/results/diff-words.d.ts +55 -0
- package/dist/results/diff-words.d.ts.map +1 -0
- package/dist/results/fetch-result.d.ts +12 -1
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.d.ts +6 -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 +8 -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 +12 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/rebase-result.d.ts +2 -0
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/stash-result.d.ts +6 -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-BDuEgdLU.js +46847 -0
- package/dist/transport-command.d.ts +14 -0
- package/dist/transport-command.d.ts.map +1 -1
- package/dist/whitespace/index.d.ts +2 -0
- package/dist/whitespace/index.d.ts.map +1 -0
- package/dist/whitespace/whitespace-rule.d.ts +94 -0
- package/dist/whitespace/whitespace-rule.d.ts.map +1 -0
- package/package.json +12 -12
- package/src/commands/add-command.ts +293 -17
- package/src/commands/add-patch/add-patch.ts +8 -0
- package/src/commands/add-patch/patch-backend.ts +20 -2
- package/src/commands/am/am-command.ts +400 -46
- package/src/commands/am/index.ts +1 -0
- package/src/commands/am/mailsplit.ts +326 -0
- package/src/commands/apply/apply-command.ts +58 -15
- package/src/commands/apply/apply-engine.ts +1 -1
- package/src/commands/apply/apply-parse.ts +17 -8
- package/src/commands/apply/index.ts +8 -1
- package/src/commands/bisect/bisect-command.ts +18 -5
- package/src/commands/blame-command.ts +1450 -51
- package/src/commands/blame-ignore.ts +307 -0
- package/src/commands/branch-command.ts +528 -53
- package/src/commands/branch-info-command.ts +150 -0
- package/src/commands/branch-tracking.ts +335 -60
- package/src/commands/branch-upstream-command.ts +218 -0
- package/src/commands/check-mailmap-command.ts +129 -0
- package/src/commands/checkout-command.ts +166 -55
- package/src/commands/checkout-paths.ts +28 -0
- package/src/commands/cherry-command.ts +187 -0
- package/src/commands/cherry-pick-command.ts +185 -1
- package/src/commands/clean-command.ts +126 -15
- package/src/commands/clean-interactive.ts +522 -0
- package/src/commands/clone-command.ts +598 -45
- package/src/commands/commit-command.ts +925 -74
- package/src/commands/commit-reuse.ts +94 -0
- package/src/commands/config-command.ts +1256 -0
- package/src/commands/config-value-types.ts +358 -0
- package/src/commands/core-config.ts +40 -0
- package/src/commands/describe-command.ts +341 -254
- package/src/commands/diff-color-config.ts +274 -0
- package/src/commands/diff-command.ts +1619 -99
- package/src/commands/fetch-command.ts +495 -14
- package/src/commands/fetch-multiple-command.ts +665 -0
- package/src/commands/fmt-merge-msg-command.ts +715 -0
- package/src/commands/fork-point.ts +63 -0
- package/src/commands/format-patch-command.ts +496 -116
- package/src/commands/fsck/fetch-fsck.ts +172 -18
- package/src/commands/gc-command.ts +31 -1
- package/src/commands/git-describe.ts +460 -201
- package/src/commands/git-hooks.ts +123 -3
- package/src/commands/grep/grep-command.ts +1077 -0
- package/src/commands/grep/grep-engine.ts +1024 -0
- package/src/commands/grep/index.ts +2 -0
- package/src/commands/index-adder.ts +46 -7
- package/src/commands/index.ts +43 -0
- package/src/commands/init-command.ts +603 -49
- package/src/commands/interpret-trailers-command.ts +256 -0
- package/src/commands/line-log.ts +931 -0
- package/src/commands/local-transport.ts +109 -10
- package/src/commands/log-command.ts +2599 -326
- package/src/commands/log-graph.ts +129 -29
- package/src/commands/log-output.ts +449 -27
- package/src/commands/ls-remote-command.ts +5 -0
- package/src/commands/mailmap.ts +155 -0
- package/src/commands/merge-base-command.ts +170 -0
- package/src/commands/merge-bases.ts +63 -8
- package/src/commands/merge-command.ts +601 -95
- package/src/commands/merge-drivers.ts +3 -0
- package/src/commands/merge-strategy-options.ts +224 -0
- package/src/commands/merge-support.ts +115 -22
- package/src/commands/message-cleanup.ts +1 -1
- package/src/commands/mv-command.ts +6 -3
- package/src/commands/name-rev-command.ts +184 -0
- package/src/commands/name-rev.ts +762 -0
- package/src/commands/notes-command.ts +11 -1
- package/src/commands/octopus-merge.ts +35 -11
- package/src/commands/ort-merge.ts +41 -7
- package/src/commands/ort-recursive.ts +40 -2
- package/src/commands/patch-id.ts +109 -0
- package/src/commands/pathspec-file.ts +72 -0
- package/src/commands/pathspec.ts +14 -2
- package/src/commands/pretty-format.ts +103 -19
- package/src/commands/promisor-remote.ts +10 -1
- package/src/commands/pull-command.ts +734 -221
- package/src/commands/push-command.ts +1035 -68
- 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 +102 -4
- package/src/commands/rebase-command.ts +1074 -194
- package/src/commands/ref-filter/for-each-ref-command.ts +298 -0
- package/src/commands/ref-filter/index.ts +7 -0
- package/src/commands/ref-filter/ref-atoms.ts +581 -0
- package/src/commands/ref-filter/ref-filter.ts +651 -0
- package/src/commands/ref-filter/ref-format.ts +1070 -0
- package/src/commands/ref-filter/ref-listing-command.ts +421 -0
- package/src/commands/ref-filter/ref-quote.ts +69 -0
- package/src/commands/ref-filter/version-compare.ts +177 -0
- package/src/commands/reflog-command.ts +492 -2
- package/src/commands/reflog-walk.ts +234 -0
- package/src/commands/remerge-diff.ts +241 -0
- package/src/commands/remote-command.ts +537 -69
- package/src/commands/remote-show-command.ts +836 -0
- package/src/commands/remote-transport.ts +9 -1
- package/src/commands/reset-command.ts +114 -34
- package/src/commands/restore-command.ts +27 -41
- package/src/commands/rev-filter/commit-filter.ts +159 -0
- package/src/commands/rev-filter/commit-grep.ts +444 -0
- package/src/commands/rev-filter/index.ts +2 -0
- package/src/commands/rev-list-command.ts +578 -15
- package/src/commands/revert-command.ts +123 -1
- package/src/commands/revision-range.ts +207 -5
- package/src/commands/revision-resolver.ts +23 -8
- package/src/commands/rm-command.ts +282 -21
- package/src/commands/sequencer-pick.ts +818 -111
- package/src/commands/sequencer-support.ts +184 -4
- package/src/commands/serve-repository.ts +18 -3
- package/src/commands/shortlog-command.ts +354 -0
- package/src/commands/shortlog.ts +361 -0
- package/src/commands/show-command.ts +491 -0
- package/src/commands/show-commit.ts +24 -0
- package/src/commands/signature-check.ts +657 -0
- package/src/commands/signing.ts +385 -0
- package/src/commands/sparse-checkout-command.ts +2 -9
- package/src/commands/sparse-checkout-support.ts +2 -2
- package/src/commands/sparse-index-view.ts +135 -0
- package/src/commands/ssh-signer.ts +199 -0
- package/src/commands/ssh-verifier.ts +523 -0
- package/src/commands/stash-apply-command.ts +16 -4
- package/src/commands/stash-branch-command.ts +88 -0
- package/src/commands/stash-create-command.ts +28 -0
- package/src/commands/stash-info.ts +243 -0
- package/src/commands/stash-list-command.ts +33 -0
- package/src/commands/stash-pop-command.ts +83 -0
- package/src/commands/stash-show-command.ts +141 -0
- package/src/commands/stash-store-command.ts +82 -0
- package/src/commands/stash-working-tree.ts +2 -2
- package/src/commands/status-command.ts +120 -27
- package/src/commands/status-format.ts +1 -1
- package/src/commands/status-header.ts +41 -7
- package/src/commands/submodule-add-command.ts +509 -0
- package/src/commands/submodule-auth.ts +276 -0
- package/src/commands/submodule-commands.ts +1835 -0
- package/src/commands/submodule-fetch.ts +789 -0
- package/src/commands/submodule-model.ts +938 -0
- package/src/commands/submodule-unpack.ts +265 -0
- package/src/commands/submodule-update-command.ts +1126 -0
- package/src/commands/subtree-shift.ts +215 -0
- package/src/commands/switch-command.ts +12 -1
- package/src/commands/tag-command.ts +876 -64
- package/src/commands/trailers.ts +837 -100
- package/src/commands/tree-restore.ts +44 -11
- package/src/commands/verify-command.ts +235 -0
- package/src/commands/worktree-add-command.ts +268 -24
- package/src/commands/worktree-overwrite-checks.ts +5 -0
- package/src/commands/worktree-path-rules.ts +183 -0
- package/src/commands/worktree-remove-command.ts +39 -5
- package/src/commands/worktree-repair-command.ts +52 -5
- package/src/commands/worktree-support.ts +22 -1
- package/src/errors/checkout-errors.ts +29 -0
- package/src/errors/command-errors.ts +37 -1
- package/src/errors/ref-errors.ts +23 -0
- package/src/errors/worktree-errors.ts +8 -1
- package/src/git-command.ts +153 -2
- package/src/git.ts +550 -1
- package/src/guarded-transport-command.ts +171 -0
- package/src/index.ts +1 -0
- package/src/remote-config/index.ts +2 -0
- package/src/remote-config/remote-config-store.ts +101 -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/clone-result.ts +6 -0
- package/src/results/combined-diff.ts +38 -18
- package/src/results/diff-check.ts +185 -0
- package/src/results/diff-color.ts +868 -0
- package/src/results/diff-dirstat.ts +117 -0
- package/src/results/diff-entry.ts +12 -0
- package/src/results/diff-formatter.ts +1 -0
- package/src/results/diff-output.ts +322 -32
- package/src/results/diff-pickaxe.ts +304 -0
- package/src/results/diff-words.ts +395 -0
- package/src/results/fetch-result.ts +12 -1
- package/src/results/index.ts +6 -0
- package/src/results/init-result.ts +10 -1
- package/src/results/line-range-hunks.ts +126 -0
- package/src/results/merge-result.ts +9 -0
- package/src/results/pull-result.ts +7 -0
- package/src/results/push-result.ts +12 -0
- package/src/results/rebase-result.ts +3 -0
- package/src/results/stash-result.ts +7 -0
- package/src/results/status-result.ts +2 -2
- package/src/transport-command.ts +34 -3
- package/src/whitespace/index.ts +1 -0
- package/src/{commands/apply/whitespace.ts → whitespace/whitespace-rule.ts} +173 -23
- package/dist/commands/apply/whitespace.d.ts +0 -58
- package/dist/commands/apply/whitespace.d.ts.map +0 -1
- package/dist/git-command-BGiOJ8Zk.js +0 -7246
- package/dist/results-WVlBhVb1.js +0 -2935
|
@@ -11,11 +11,17 @@
|
|
|
11
11
|
* copies none (only `rebase --apply` does, through `rewritten`).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import {
|
|
15
|
+
type Commit,
|
|
16
|
+
formatPersonIdent,
|
|
17
|
+
type ObjectId,
|
|
18
|
+
type PersonIdent,
|
|
19
|
+
} from "@statewalker/vcs-core";
|
|
20
|
+
import { parseGitBool } from "@statewalker/vcs-utils";
|
|
16
21
|
import { compareGitPaths, encodeGitPath } from "@statewalker/vcs-utils/encoding";
|
|
17
|
-
|
|
22
|
+
import { wildmatch } from "@statewalker/vcs-working-tree";
|
|
18
23
|
import { GitCommand } from "../../git-command.js";
|
|
24
|
+
import { RemoteConfigStore } from "../../remote-config/index.js";
|
|
19
25
|
import { quotePath } from "../../results/quote-path.js";
|
|
20
26
|
import { ApplyCommand } from "../apply/apply-command.js";
|
|
21
27
|
import { ApplyEngine, type ApplyIO } from "../apply/apply-engine.js";
|
|
@@ -28,6 +34,7 @@ import {
|
|
|
28
34
|
textToLatin1,
|
|
29
35
|
} from "../apply/latin1.js";
|
|
30
36
|
import { coreBool } from "../core-config.js";
|
|
37
|
+
import { DiffCommand } from "../diff-command.js";
|
|
31
38
|
import { localTimezoneOffset, parseGitDate } from "../git-date.js";
|
|
32
39
|
import { withoutCrud } from "../git-ident.js";
|
|
33
40
|
import { configValue, conflictStyleOf } from "../merge-config.js";
|
|
@@ -47,8 +54,11 @@ import { ortResultEntries } from "../ort-merge.js";
|
|
|
47
54
|
import { mergeStoredTrees, storedBase } from "../ort-recursive.js";
|
|
48
55
|
import { updateHead, updateHeadExpecting } from "../reflog-messages.js";
|
|
49
56
|
import { removeBranchState, resetMerge, resetUnmergedToHead } from "../sequencer-support.js";
|
|
57
|
+
import { showCommitBytes } from "../show-commit.js";
|
|
58
|
+
import { SigningFailedError, signCommit, signPayload, signRequestOf } from "../signing.js";
|
|
50
59
|
import { appendSignoff } from "../trailers.js";
|
|
51
|
-
import { mailinfo
|
|
60
|
+
import { mailinfo } from "./mailinfo.js";
|
|
61
|
+
import { type MailsplitSource, splitMail } from "./mailsplit.js";
|
|
52
62
|
import {
|
|
53
63
|
type AmPatchFormat,
|
|
54
64
|
detectPatchFormat,
|
|
@@ -66,7 +76,15 @@ export interface AmResult {
|
|
|
66
76
|
errors: string;
|
|
67
77
|
}
|
|
68
78
|
|
|
69
|
-
type Resume =
|
|
79
|
+
type Resume =
|
|
80
|
+
| "apply"
|
|
81
|
+
| "continue"
|
|
82
|
+
| "allow-empty"
|
|
83
|
+
| "skip"
|
|
84
|
+
| "abort"
|
|
85
|
+
| "quit"
|
|
86
|
+
| "show-raw"
|
|
87
|
+
| "show-diff";
|
|
70
88
|
|
|
71
89
|
/** The options `git am` passes to `git apply` (kept in `apply-opt`). */
|
|
72
90
|
export interface AmApplyOptions {
|
|
@@ -86,6 +104,28 @@ export interface AmApplyOptions {
|
|
|
86
104
|
reject?: boolean;
|
|
87
105
|
/** `--ignore-whitespace` */
|
|
88
106
|
ignoreWhitespace?: boolean;
|
|
107
|
+
/** `--ignore-space-change` */
|
|
108
|
+
ignoreSpaceChange?: boolean;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The `git apply` options `git am` keeps in `apply-opt`, set on an apply: both the first
|
|
113
|
+
* attempt and the 3-way fallback's apply to the fake ancestor take all of them
|
|
114
|
+
* (`run_apply`).
|
|
115
|
+
*/
|
|
116
|
+
function configureApply(cmd: ApplyCommand, opts: string[]): ApplyCommand {
|
|
117
|
+
for (const a of opts) {
|
|
118
|
+
if (a.startsWith("-C")) cmd.setContext(Number(a.slice(2)));
|
|
119
|
+
else if (a.startsWith("-p")) cmd.setStrip(Number(a.slice(2)));
|
|
120
|
+
else if (a.startsWith("--whitespace=")) cmd.setWhitespace(a.slice(13));
|
|
121
|
+
else if (a.startsWith("--directory=")) cmd.setDirectory(a.slice(12));
|
|
122
|
+
else if (a.startsWith("--exclude=")) cmd.addExclude(a.slice(10));
|
|
123
|
+
else if (a.startsWith("--include=")) cmd.addInclude(a.slice(10));
|
|
124
|
+
else if (a === "--reject") cmd.setReject(true);
|
|
125
|
+
else if (a === "--ignore-whitespace" || a === "--ignore-space-change")
|
|
126
|
+
cmd.setIgnoreWhitespace(true);
|
|
127
|
+
}
|
|
128
|
+
return cmd;
|
|
89
129
|
}
|
|
90
130
|
|
|
91
131
|
/** `sq_quote_buf`. */
|
|
@@ -131,7 +171,11 @@ function sqDequoteAll(s: string): string[] {
|
|
|
131
171
|
* ```
|
|
132
172
|
*/
|
|
133
173
|
export class AmCommand extends GitCommand<AmResult> {
|
|
134
|
-
private mboxes: {
|
|
174
|
+
private mboxes: {
|
|
175
|
+
content: string;
|
|
176
|
+
name?: string;
|
|
177
|
+
maildir?: { name: string; content: Uint8Array | string }[];
|
|
178
|
+
}[] = [];
|
|
135
179
|
private patchFormat?: AmPatchFormat;
|
|
136
180
|
private fixedClock?: number;
|
|
137
181
|
private resume?: Resume;
|
|
@@ -141,8 +185,11 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
141
185
|
private keep: "t" | "b" | "f" = "f";
|
|
142
186
|
private messageId?: boolean;
|
|
143
187
|
private scissors?: boolean;
|
|
188
|
+
private quotedCr?: "nowarn" | "warn" | "strip";
|
|
144
189
|
private quiet = false;
|
|
145
190
|
private noVerify = false;
|
|
191
|
+
/** `-S[<keyid>]` / `--no-gpg-sign` (undefined: `commit.gpgSign`) */
|
|
192
|
+
private sign?: boolean | string;
|
|
146
193
|
private utf8 = true;
|
|
147
194
|
private ignoreDate = false;
|
|
148
195
|
private committerDateIsAuthorDate = false;
|
|
@@ -150,6 +197,8 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
150
197
|
private emptyMode: "stop" | "drop" | "keep" = "stop";
|
|
151
198
|
private applyOptions: AmApplyOptions = {};
|
|
152
199
|
private legacyMessages = false;
|
|
200
|
+
private interactive?: AmInteractiveReader;
|
|
201
|
+
private editor?: AmMessageEditor;
|
|
153
202
|
private out = "";
|
|
154
203
|
private err = "";
|
|
155
204
|
|
|
@@ -164,6 +213,18 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
164
213
|
return this;
|
|
165
214
|
}
|
|
166
215
|
|
|
216
|
+
/**
|
|
217
|
+
* A Maildir to apply, in order (`git am <dir>`): its messages, each named by its path in
|
|
218
|
+
* the Maildir (`cur/<file>`, `new/<file>`), split as `git mailsplit` splits a Maildir
|
|
219
|
+
* (`cur/` then `new/`, numbers in names compared as numbers). `name` is the directory as
|
|
220
|
+
* git names it in messages. A Maildir given first is read as mailboxes (git's format
|
|
221
|
+
* detection takes a directory for mbox).
|
|
222
|
+
*/
|
|
223
|
+
addMaildir(messages: { name: string; content: Uint8Array | string }[], name: string): this {
|
|
224
|
+
this.mboxes.push({ content: "", name, maildir: messages });
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
|
|
167
228
|
/**
|
|
168
229
|
* `--patch-format=<format>`: mbox, mboxrd, stgit or hg (Mercurial); detected from the
|
|
169
230
|
* first named mailbox when not given. An StGit series (`stgit-series`) names its patch
|
|
@@ -194,6 +255,17 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
194
255
|
return this;
|
|
195
256
|
}
|
|
196
257
|
|
|
258
|
+
/**
|
|
259
|
+
* `--show-current-patch[=raw|diff]`: the mail of the patch that stopped (`raw`, the
|
|
260
|
+
* default) or its diff (`diff`, `rebase-apply/patch`) on stdout, as they stand in
|
|
261
|
+
* `.git/rebase-apply/`; a session of `rebase --apply` shows its original commit
|
|
262
|
+
* (`git show <original-commit>`).
|
|
263
|
+
*/
|
|
264
|
+
setShowCurrentPatch(mode: "raw" | "diff" = "raw"): this {
|
|
265
|
+
this.resume = mode === "diff" ? "show-diff" : "show-raw";
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
|
|
197
269
|
/** `-3` / `--3way` (default `am.threeWay`). */
|
|
198
270
|
setThreeWay(value: boolean): this {
|
|
199
271
|
this.threeWay = value;
|
|
@@ -224,12 +296,23 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
224
296
|
return this;
|
|
225
297
|
}
|
|
226
298
|
|
|
227
|
-
/** `-c` / `--scissors`, `--no-scissors
|
|
299
|
+
/** `-c` / `--scissors`, `--no-scissors` (default `mailinfo.scissors`). */
|
|
228
300
|
setScissors(value: boolean): this {
|
|
229
301
|
this.scissors = value;
|
|
230
302
|
return this;
|
|
231
303
|
}
|
|
232
304
|
|
|
305
|
+
/**
|
|
306
|
+
* `--quoted-cr=<action>`: what mailinfo does with a CRLF line ending of a base64 or
|
|
307
|
+
* quoted-printable body (`warn`, the default from `mailinfo.quotedCr`, warns `quoted CRLF
|
|
308
|
+
* detected`; `strip` drops the CR; `nowarn` keeps it silently). Kept in `quoted-cr` for the
|
|
309
|
+
* whole session.
|
|
310
|
+
*/
|
|
311
|
+
setQuotedCr(action: "nowarn" | "warn" | "strip"): this {
|
|
312
|
+
this.quotedCr = action;
|
|
313
|
+
return this;
|
|
314
|
+
}
|
|
315
|
+
|
|
233
316
|
/** `--no-verify`: the applypatch-msg and pre-applypatch hooks do not run. */
|
|
234
317
|
setNoVerify(value: boolean): this {
|
|
235
318
|
this.checkCallable();
|
|
@@ -237,6 +320,27 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
237
320
|
return this;
|
|
238
321
|
}
|
|
239
322
|
|
|
323
|
+
/**
|
|
324
|
+
* `-S` (true) / `--no-gpg-sign` (false): whether to sign the commits; undefined (the
|
|
325
|
+
* default) leaves it to `commit.gpgSign`. Each commit is signed through the host's signer
|
|
326
|
+
* (`GitHostEnvironment.signer`) as git's commit_tree signs it; when it cannot be signed the
|
|
327
|
+
* am fails as git's does (`error: gpg failed to sign the data:`, `fatal: failed to write
|
|
328
|
+
* commit object`, exit 128), the patch left applied to the index in `.git/rebase-apply`
|
|
329
|
+
* and nothing committed.
|
|
330
|
+
*/
|
|
331
|
+
setSign(sign: boolean | undefined): this {
|
|
332
|
+
this.checkCallable();
|
|
333
|
+
this.sign = sign;
|
|
334
|
+
return this;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/** `-S<keyid>`: sign with this key (see {@link setSign}). */
|
|
338
|
+
setSigningKey(keyId: string): this {
|
|
339
|
+
this.checkCallable();
|
|
340
|
+
this.sign = keyId;
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
|
|
240
344
|
/** `-q`. */
|
|
241
345
|
setQuiet(value: boolean): this {
|
|
242
346
|
this.quiet = value;
|
|
@@ -285,6 +389,100 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
285
389
|
return this;
|
|
286
390
|
}
|
|
287
391
|
|
|
392
|
+
/**
|
|
393
|
+
* `git am -i` (`--interactive`): before each patch is applied (and before a resolved one
|
|
394
|
+
* is committed), builtin/am.c's `do_interactive` shows its message and asks "Apply?
|
|
395
|
+
* [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all: ". `reader` answers each such read of
|
|
396
|
+
* standard input with the line typed (only its first letter counts, either case; others
|
|
397
|
+
* ask again), or undefined at the end of input, which stops the am as git dies ("unable to
|
|
398
|
+
* read from stdin; aborting"). `y` applies, `n` skips the patch, `a` applies this one and
|
|
399
|
+
* the rest without asking, `e` hands `final-commit` to {@link setEditor} and asks again
|
|
400
|
+
* with its result, `v` prints the patch (`rebase-apply/patch`, as git's pager shows it).
|
|
401
|
+
* Give it again with `setResume("continue")` to be asked about a resolved patch (git's
|
|
402
|
+
* `am -i --resolved`, which shows the index's diff from HEAD as the patch).
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* const answers = ["y", "n"];
|
|
407
|
+
* const { output } = await git.am().addMbox(mbox, "mbox")
|
|
408
|
+
* .setInteractive(() => answers.shift()).call();
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
setInteractive(reader: AmInteractiveReader | undefined): this {
|
|
412
|
+
this.checkCallable();
|
|
413
|
+
this.interactive = reader;
|
|
414
|
+
return this;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* The editor of `git am -i`'s `e`: given the path of `final-commit` and the message, the
|
|
419
|
+
* edited message (taken as it stands), or undefined when it failed (the message is kept).
|
|
420
|
+
*/
|
|
421
|
+
setEditor(editor: AmMessageEditor): this {
|
|
422
|
+
this.checkCallable();
|
|
423
|
+
this.editor = editor;
|
|
424
|
+
return this;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* `do_interactive`: true when the patch is to be skipped (`n`); `a` turns the questions
|
|
429
|
+
* off for the rest of this run.
|
|
430
|
+
*/
|
|
431
|
+
private async doInteractive(st: AmState): Promise<boolean> {
|
|
432
|
+
const reader = this.interactive as AmInteractiveReader;
|
|
433
|
+
for (;;) {
|
|
434
|
+
this.out += `Commit Body is:\n--------------------------\n${st.msg ?? ""}--------------------------\n`;
|
|
435
|
+
const prompt = "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all: ";
|
|
436
|
+
this.out += prompt;
|
|
437
|
+
const reply = await reader({
|
|
438
|
+
prompt,
|
|
439
|
+
message: latin1ToText(st.msg ?? ""),
|
|
440
|
+
output: latin1ToText(this.out),
|
|
441
|
+
});
|
|
442
|
+
if (reply === undefined) this.fatal("unable to read from stdin; aborting");
|
|
443
|
+
const c = reply.charAt(0).toLowerCase();
|
|
444
|
+
if (c === "y") return false;
|
|
445
|
+
if (c === "a") {
|
|
446
|
+
this.interactive = undefined;
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
if (c === "n") return true;
|
|
450
|
+
if (c === "e") {
|
|
451
|
+
if (!this.editor) continue;
|
|
452
|
+
const path = await this.hooks.gitPath(`${DIR}/final-commit`);
|
|
453
|
+
const edited = await this.editor(
|
|
454
|
+
path,
|
|
455
|
+
latin1ToText((await this.read("final-commit")) ?? ""),
|
|
456
|
+
);
|
|
457
|
+
if (edited !== undefined) {
|
|
458
|
+
const text = textToLatin1(edited);
|
|
459
|
+
await this.write("final-commit", text);
|
|
460
|
+
st.msg = text;
|
|
461
|
+
}
|
|
462
|
+
} else if (c === "v") {
|
|
463
|
+
this.out += (await this.read("patch")) ?? "";
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** `write_index_patch`: the index's diff from HEAD's tree into `patch`. */
|
|
469
|
+
private async writeIndexPatch(): Promise<void> {
|
|
470
|
+
const head = await this.headId();
|
|
471
|
+
const diff = new DiffCommand(this.workingCopy)
|
|
472
|
+
.setCached(true)
|
|
473
|
+
.setOldTree(head ?? this.objectFormat.emptyTreeId)
|
|
474
|
+
.setRenames(false)
|
|
475
|
+
.setOptions({
|
|
476
|
+
defaultPrefix: true,
|
|
477
|
+
ignoreConfigNoPrefix: true,
|
|
478
|
+
textconv: false,
|
|
479
|
+
uiConfig: false,
|
|
480
|
+
submoduleFormat: "short",
|
|
481
|
+
orderFile: "",
|
|
482
|
+
});
|
|
483
|
+
await this.write("patch", bytesToLatin1(await diff.callBytes("patch")));
|
|
484
|
+
}
|
|
485
|
+
|
|
288
486
|
private state(): OperationState {
|
|
289
487
|
return new OperationState(this.workingCopy.checkout, this.refsStore);
|
|
290
488
|
}
|
|
@@ -351,6 +549,7 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
351
549
|
}
|
|
352
550
|
if (mode === "abort") return this.abort();
|
|
353
551
|
const st = await this.load();
|
|
552
|
+
if (mode === "show-raw" || mode === "show-diff") return this.showPatch(st, mode);
|
|
354
553
|
if (mode === "skip") {
|
|
355
554
|
// am_skip: clean_index(HEAD, HEAD), then the next patch
|
|
356
555
|
const head = await this.headId();
|
|
@@ -370,9 +569,29 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
370
569
|
this.fatal(`Stray .git/${DIR} directory found.\nUse "git am --abort" to remove it.`);
|
|
371
570
|
}
|
|
372
571
|
if (this.resume) this.fatal("Resolve operation not in progress, we are not resuming.");
|
|
572
|
+
if (this.interactive && !this.mboxes.length) {
|
|
573
|
+
this.fatal("interactive mode requires patches on the command line");
|
|
574
|
+
}
|
|
373
575
|
return this.setup();
|
|
374
576
|
}
|
|
375
577
|
|
|
578
|
+
/** git's show_patch. */
|
|
579
|
+
private async showPatch(st: AmState, mode: "show-raw" | "show-diff"): Promise<AmResult> {
|
|
580
|
+
const original = (await this.read("original-commit"))?.trim();
|
|
581
|
+
if (original) {
|
|
582
|
+
// `git show <original-commit> --`
|
|
583
|
+
this.out += bytesToLatin1(await showCommitBytes(this.workingCopy, original));
|
|
584
|
+
return this.result(0);
|
|
585
|
+
}
|
|
586
|
+
const name = mode === "show-raw" ? String(st.cur).padStart(4, "0") : "patch";
|
|
587
|
+
const content = await this.read(name);
|
|
588
|
+
if (content === undefined) {
|
|
589
|
+
this.fatal(`failed to read '.git/${DIR}/${name}': No such file or directory`);
|
|
590
|
+
}
|
|
591
|
+
this.out += content;
|
|
592
|
+
return this.result(0);
|
|
593
|
+
}
|
|
594
|
+
|
|
376
595
|
private async setup(): Promise<AmResult> {
|
|
377
596
|
const state = this.state();
|
|
378
597
|
const bool = (k: string) => {
|
|
@@ -388,7 +607,7 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
388
607
|
this.patchFormat ??
|
|
389
608
|
(this.mboxrd
|
|
390
609
|
? "mboxrd"
|
|
391
|
-
: first?.name !== undefined
|
|
610
|
+
: first?.name !== undefined && !first.maildir
|
|
392
611
|
? detectPatchFormat(first.content)
|
|
393
612
|
: "mbox");
|
|
394
613
|
if (!format) {
|
|
@@ -403,15 +622,18 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
403
622
|
};
|
|
404
623
|
const inputs = this.mboxes.length ? this.mboxes : [{ content: "" }];
|
|
405
624
|
if (format === "mbox" || format === "mboxrd") {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
625
|
+
// split_mail_mbox: git mailsplit -d4 -b [--keep-cr] [--mboxrd] -- <paths>
|
|
626
|
+
const sources: MailsplitSource[] = inputs.map((m) =>
|
|
627
|
+
m.maildir
|
|
628
|
+
? { maildir: m.maildir, name: m.name as string }
|
|
629
|
+
: { mbox: latin1ToBytes(m.content), ...(m.name !== undefined ? { name: m.name } : {}) },
|
|
630
|
+
);
|
|
631
|
+
const split = splitMail(sources, { allowBare: true, keepCr, mboxrd: format === "mboxrd" });
|
|
632
|
+
if (split.exitCode) {
|
|
633
|
+
this.err += split.errors;
|
|
634
|
+
this.fatal("Failed to split patches.");
|
|
414
635
|
}
|
|
636
|
+
for (const f of split.files) mails.push(bytesToLatin1(f.content));
|
|
415
637
|
} else if (format === "stgit-series") {
|
|
416
638
|
// split_mail_stgit_series: one named series file, whose patches are files next to it
|
|
417
639
|
// (this command reads no files: the first one cannot be opened)
|
|
@@ -430,6 +652,7 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
430
652
|
mails.push(stgitPatchToMail(""));
|
|
431
653
|
} else {
|
|
432
654
|
for (const mbox of inputs) {
|
|
655
|
+
if (mbox.maildir) failSplit(`could not open '${mbox.name}' for reading: Is a directory`);
|
|
433
656
|
if (format === "stgit") mails.push(stgitPatchToMail(mbox.content));
|
|
434
657
|
else {
|
|
435
658
|
const r = hgPatchToMail(mbox.content);
|
|
@@ -450,7 +673,7 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
450
673
|
await this.writeText("keep", this.keep);
|
|
451
674
|
await this.writeText("messageid", messageId ? "t" : "f");
|
|
452
675
|
await this.writeText("scissors", this.scissors === undefined ? "" : this.scissors ? "t" : "f");
|
|
453
|
-
await this.writeText("quoted-cr", "");
|
|
676
|
+
await this.writeText("quoted-cr", this.quotedCr ?? "");
|
|
454
677
|
await this.writeText(
|
|
455
678
|
"apply-opt",
|
|
456
679
|
this.applyArgs()
|
|
@@ -482,6 +705,7 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
482
705
|
for (const e of o.include ?? []) args.push(`--include=${e}`);
|
|
483
706
|
if (o.reject) args.push("--reject");
|
|
484
707
|
if (o.ignoreWhitespace) args.push("--ignore-whitespace");
|
|
708
|
+
if (o.ignoreSpaceChange) args.push("--ignore-space-change");
|
|
485
709
|
return args;
|
|
486
710
|
}
|
|
487
711
|
|
|
@@ -497,6 +721,7 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
497
721
|
keep: ((await t("keep")) || "f") as "t" | "b" | "f",
|
|
498
722
|
messageId: (await t("messageid")) === "t",
|
|
499
723
|
scissors: await t("scissors"),
|
|
724
|
+
quotedCr: await t("quoted-cr"),
|
|
500
725
|
applyOpts: sqDequoteAll(await t("apply-opt")),
|
|
501
726
|
};
|
|
502
727
|
const script = await this.read("author-script");
|
|
@@ -551,13 +776,14 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
551
776
|
(await this.patchIsEmpty()) &&
|
|
552
777
|
(await this.indexHasChanges()).length === 0;
|
|
553
778
|
if (bool("advice.mergeConflict") === false && !this.legacyMessages) throw new AmStop(128);
|
|
779
|
+
const cmd = this.interactive ? "git am -i" : "git am";
|
|
554
780
|
const lines = [
|
|
555
|
-
|
|
556
|
-
|
|
781
|
+
`When you have resolved this problem, run "${cmd} --continue".`,
|
|
782
|
+
`If you prefer to skip this patch, run "${cmd} --skip" instead.`,
|
|
557
783
|
...(patchEmptyAndClean
|
|
558
|
-
? [
|
|
784
|
+
? [`To record the empty patch as an empty commit, run "${cmd} --allow-empty".`]
|
|
559
785
|
: []),
|
|
560
|
-
|
|
786
|
+
`To restore the original branch and stop patching, run "${cmd} --abort".`,
|
|
561
787
|
];
|
|
562
788
|
if (this.legacyMessages) this.out += `${lines.join("\n")}\n`;
|
|
563
789
|
else {
|
|
@@ -594,11 +820,16 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
594
820
|
this.fatal(`cannot resume: .git/${DIR}/final-commit does not exist.`);
|
|
595
821
|
if (!st.author) this.fatal(`cannot resume: .git/${DIR}/author-script does not exist.`);
|
|
596
822
|
} else {
|
|
823
|
+
// setup_mailinfo: mailinfo.scissors and mailinfo.quotedCr, then the session's options
|
|
824
|
+
const config = this.mailinfoConfig();
|
|
825
|
+
const quotedCr = (st.quotedCr || config.quotedCr) as "nowarn" | "warn" | "strip";
|
|
826
|
+
const useScissors = st.scissors ? st.scissors === "t" : config.scissors;
|
|
597
827
|
const mi = mailinfo(mail, {
|
|
598
828
|
keepSubject: st.keep === "t",
|
|
599
829
|
keepNonPatchBrackets: st.keep === "b",
|
|
600
830
|
addMessageId: st.messageId,
|
|
601
|
-
|
|
831
|
+
useScissors,
|
|
832
|
+
quotedCr,
|
|
602
833
|
utf8: st.utf8,
|
|
603
834
|
// metainfo_charset: get_commit_output_encoding()
|
|
604
835
|
charset: configValue(this.workingCopy, "i18n.commitEncoding") ?? "UTF-8",
|
|
@@ -629,6 +860,11 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
629
860
|
);
|
|
630
861
|
await this.write("final-commit", msg);
|
|
631
862
|
}
|
|
863
|
+
if (this.interactive && (await this.doInteractive(st))) {
|
|
864
|
+
await this.next(st);
|
|
865
|
+
resume = false;
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
632
868
|
let msg = st.msg as string;
|
|
633
869
|
let toKeep = false;
|
|
634
870
|
if (await this.patchIsEmpty()) {
|
|
@@ -689,22 +925,54 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
689
925
|
return this.result(0);
|
|
690
926
|
}
|
|
691
927
|
|
|
928
|
+
/**
|
|
929
|
+
* `setup_mailinfo`'s config (`git_mailinfo_config`, in config order): `mailinfo.scissors`
|
|
930
|
+
* and `mailinfo.quotedCr`; a value git refuses dies as git's config callback does.
|
|
931
|
+
*/
|
|
932
|
+
private mailinfoConfig(): { scissors: boolean; quotedCr: "nowarn" | "warn" | "strip" } {
|
|
933
|
+
const out: { scissors: boolean; quotedCr: "nowarn" | "warn" | "strip" } = {
|
|
934
|
+
scissors: false,
|
|
935
|
+
quotedCr: "warn",
|
|
936
|
+
};
|
|
937
|
+
if (!this.workingCopy.config) return out;
|
|
938
|
+
const store = RemoteConfigStore.from(this.workingCopy);
|
|
939
|
+
const where = (key: string, file?: string, line?: number) =>
|
|
940
|
+
file !== undefined && line !== undefined
|
|
941
|
+
? `bad config variable '${key}' in file '${file}' at line ${line}`
|
|
942
|
+
: `unable to parse '${key}' from command-line config`;
|
|
943
|
+
const entries = store.entriesWithOriginFor(["mailinfo.scissors", "mailinfo.quotedcr"]) ?? [
|
|
944
|
+
...store
|
|
945
|
+
.valuesWithOrigin("mailinfo.scissors")
|
|
946
|
+
.map((e) => ({ ...e, key: "mailinfo.scissors" })),
|
|
947
|
+
...store
|
|
948
|
+
.valuesWithOrigin("mailinfo.quotedcr")
|
|
949
|
+
.map((e) => ({ ...e, key: "mailinfo.quotedcr" })),
|
|
950
|
+
];
|
|
951
|
+
for (const e of entries) {
|
|
952
|
+
if (e.key === "mailinfo.scissors") {
|
|
953
|
+
const v = e.text === undefined ? true : parseGitBool(e.text);
|
|
954
|
+
if (v === undefined) this.fatal(`bad boolean config value '${e.text}' for '${e.key}'`);
|
|
955
|
+
out.scissors = v;
|
|
956
|
+
} else if (e.text === undefined) {
|
|
957
|
+
this.err += `error: missing value for '${e.key}'\n`;
|
|
958
|
+
this.fatal(where(e.key, e.file, e.line));
|
|
959
|
+
} else if (e.text === "nowarn" || e.text === "warn" || e.text === "strip") {
|
|
960
|
+
out.quotedCr = e.text;
|
|
961
|
+
} else {
|
|
962
|
+
this.err += `error: bad action '${e.text}' for '${e.key}'\n`;
|
|
963
|
+
this.fatal(where(e.key, e.file, e.line));
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
return out;
|
|
967
|
+
}
|
|
968
|
+
|
|
692
969
|
private async runApply(st: AmState): Promise<number> {
|
|
693
970
|
const patch = (await this.read("patch")) ?? "";
|
|
694
971
|
const cmd = new ApplyCommand(this.workingCopy)
|
|
695
972
|
.addPatch(latin1ToBytes(patch), `.git/${DIR}/patch`)
|
|
696
973
|
.setIndex(true)
|
|
697
974
|
.setLegacyMessages(this.legacyMessages);
|
|
698
|
-
|
|
699
|
-
if (a.startsWith("-C")) cmd.setContext(Number(a.slice(2)));
|
|
700
|
-
else if (a.startsWith("-p")) cmd.setStrip(Number(a.slice(2)));
|
|
701
|
-
else if (a.startsWith("--whitespace=")) cmd.setWhitespace(a.slice(13));
|
|
702
|
-
else if (a.startsWith("--directory=")) cmd.setDirectory(a.slice(12));
|
|
703
|
-
else if (a.startsWith("--exclude=")) cmd.addExclude(a.slice(10));
|
|
704
|
-
else if (a.startsWith("--include=")) cmd.addInclude(a.slice(10));
|
|
705
|
-
else if (a === "--reject") cmd.setReject(true);
|
|
706
|
-
else if (a === "--ignore-whitespace") cmd.setIgnoreWhitespace(true);
|
|
707
|
-
}
|
|
975
|
+
configureApply(cmd, st.applyOpts);
|
|
708
976
|
if (st.threeway) cmd.setVerbose(false);
|
|
709
977
|
const r = await cmd.call();
|
|
710
978
|
this.out += pathToLatin1(r.output);
|
|
@@ -722,10 +990,15 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
722
990
|
undefined as unknown as ApplyIO,
|
|
723
991
|
() => undefined,
|
|
724
992
|
async () => 0,
|
|
725
|
-
() =>
|
|
993
|
+
(pattern, text) => wildmatch(latin1ToPath(pattern), latin1ToPath(text)),
|
|
726
994
|
);
|
|
727
995
|
for (const a of st.applyOpts) {
|
|
728
|
-
|
|
996
|
+
// --include/--exclude limit the patches the fake ancestor is built from too
|
|
997
|
+
if (a.startsWith("--exclude=") || a.startsWith("--include=")) {
|
|
998
|
+
const include = a.startsWith("--include=");
|
|
999
|
+
parser.limitByName.push({ pattern: pathToLatin1(a.slice(10)), include });
|
|
1000
|
+
if (include) parser.hasInclude = true;
|
|
1001
|
+
} else if (a.startsWith("-p")) {
|
|
729
1002
|
parser.pValue = Number(a.slice(2));
|
|
730
1003
|
parser.pValueKnown = true;
|
|
731
1004
|
} else if (a.startsWith("--directory="))
|
|
@@ -803,12 +1076,7 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
803
1076
|
.addPatch(latin1ToBytes(patch), `.git/${DIR}/patch`)
|
|
804
1077
|
.setTemporaryIndex(fake)
|
|
805
1078
|
.setLegacyMessages(this.legacyMessages);
|
|
806
|
-
|
|
807
|
-
if (a.startsWith("-C")) apply.setContext(Number(a.slice(2)));
|
|
808
|
-
else if (a.startsWith("-p")) apply.setStrip(Number(a.slice(2)));
|
|
809
|
-
else if (a.startsWith("--whitespace=")) apply.setWhitespace(a.slice(13));
|
|
810
|
-
else if (a.startsWith("--directory=")) apply.setDirectory(a.slice(12));
|
|
811
|
-
}
|
|
1079
|
+
configureApply(apply, st.applyOpts);
|
|
812
1080
|
const applied = await apply.call();
|
|
813
1081
|
this.out += pathToLatin1(applied.output);
|
|
814
1082
|
this.err += pathToLatin1(applied.errors);
|
|
@@ -921,17 +1189,49 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
921
1189
|
author = { ...author, name: latin1ToPath(author.name), email: latin1ToPath(author.email) };
|
|
922
1190
|
const message = latin1ToPath(msg);
|
|
923
1191
|
const parents = head ? [head] : [];
|
|
1192
|
+
// commit_tree_extended signs before writing: when it cannot, git's failure and nothing
|
|
1193
|
+
// written
|
|
1194
|
+
const sign = signRequestOf(this.workingCopy, this.sign);
|
|
924
1195
|
const objects = this.workingCopy.history?.objects;
|
|
925
1196
|
let id: ObjectId;
|
|
926
1197
|
if (!isUtf8Encoding(commitEncoding) && objects) {
|
|
927
1198
|
// commit_tree_extended: the `encoding` header, the message and idents as their bytes
|
|
928
|
-
let
|
|
929
|
-
for (const p of parents)
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1199
|
+
let head = `tree ${tree}\n`;
|
|
1200
|
+
for (const p of parents) head += `parent ${p}\n`;
|
|
1201
|
+
head += `author ${formatPersonIdent(author)}\ncommitter ${formatPersonIdent(committer)}\n`;
|
|
1202
|
+
head += `encoding ${commitEncoding}\n`;
|
|
1203
|
+
const body = `\n${message}`;
|
|
1204
|
+
let header = "";
|
|
1205
|
+
if (sign !== undefined) {
|
|
1206
|
+
const payload = encodeGitPath(head + body);
|
|
1207
|
+
const signature = latin1ToPath(
|
|
1208
|
+
bytesToLatin1(
|
|
1209
|
+
await this.signOrDie((cwd) =>
|
|
1210
|
+
signPayload(this.workingCopy, sign, payload, {
|
|
1211
|
+
committer,
|
|
1212
|
+
tail: [],
|
|
1213
|
+
...(cwd !== undefined ? { cwd } : {}),
|
|
1214
|
+
}),
|
|
1215
|
+
),
|
|
1216
|
+
),
|
|
1217
|
+
);
|
|
1218
|
+
// add_header_signature: the repository's header (`gpgsig`, `gpgsig-sha256` in a
|
|
1219
|
+
// SHA-256 repository) after the other headers, continuation lines indented
|
|
1220
|
+
const lines = (signature.endsWith("\n") ? signature.slice(0, -1) : signature).split("\n");
|
|
1221
|
+
header = `${this.objectFormat.signatureHeader} ${lines.join("\n ")}\n`;
|
|
1222
|
+
}
|
|
1223
|
+
id = await objects.putUnsized("commit", [encodeGitPath(head + header + body)]);
|
|
933
1224
|
} else {
|
|
934
|
-
|
|
1225
|
+
let commit: Commit = { tree, parents, author, committer, message };
|
|
1226
|
+
if (sign !== undefined) {
|
|
1227
|
+
commit = await this.signOrDie((cwd) =>
|
|
1228
|
+
signCommit(this.workingCopy, sign, commit, {
|
|
1229
|
+
tail: [],
|
|
1230
|
+
...(cwd !== undefined ? { cwd } : {}),
|
|
1231
|
+
}),
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
id = await this.commits.store(commit);
|
|
935
1235
|
}
|
|
936
1236
|
const action = this.reflogAction("am");
|
|
937
1237
|
// do_commit's update_ref("HEAD", commit, old_oid): HEAD expecting the commit it left
|
|
@@ -945,6 +1245,30 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
945
1245
|
await this.runAmHook("post-applypatch");
|
|
946
1246
|
}
|
|
947
1247
|
|
|
1248
|
+
/**
|
|
1249
|
+
* Runs a signing (`run(cwd)`, the signing program in the worktree top) as do_commit's
|
|
1250
|
+
* commit_tree: a signature that cannot be made adds gpg's lines and dies with `fatal:
|
|
1251
|
+
* failed to write commit object` (exit 128), or as the signing itself died.
|
|
1252
|
+
*/
|
|
1253
|
+
private async signOrDie<T>(run: (cwd: string | undefined) => Promise<T>): Promise<T> {
|
|
1254
|
+
let cwd: string | undefined;
|
|
1255
|
+
try {
|
|
1256
|
+
cwd = await this.hooks.hostWorkingDirectory();
|
|
1257
|
+
} catch {
|
|
1258
|
+
cwd = undefined;
|
|
1259
|
+
}
|
|
1260
|
+
try {
|
|
1261
|
+
return await run(cwd);
|
|
1262
|
+
} catch (error) {
|
|
1263
|
+
if (!(error instanceof SigningFailedError)) throw error;
|
|
1264
|
+
const lines = error.message.split("\n");
|
|
1265
|
+
this.err += `${lines.map(pathToLatin1).join("\n")}\n`;
|
|
1266
|
+
// the signing died itself (ssh without a key): nothing follows
|
|
1267
|
+
if (lines[lines.length - 1]?.startsWith("fatal: ")) throw new AmStop(128);
|
|
1268
|
+
this.fatal("failed to write commit object");
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
|
|
948
1272
|
private async resolve(st: AmState, allowEmpty: boolean): Promise<AmResult> {
|
|
949
1273
|
if (st.msg === undefined) this.fatal(`cannot resume: .git/${DIR}/final-commit does not exist.`);
|
|
950
1274
|
if (!st.author) this.fatal(`cannot resume: .git/${DIR}/author-script does not exist.`);
|
|
@@ -964,6 +1288,13 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
964
1288
|
"You still have unmerged paths in your index.\nYou should 'git add' each file with resolved conflicts to mark them as such.\nYou might run `git rm` on a file to accept \"deleted by them\" for it.\n";
|
|
965
1289
|
await this.dieUserResolve();
|
|
966
1290
|
}
|
|
1291
|
+
if (this.interactive) {
|
|
1292
|
+
await this.writeIndexPatch();
|
|
1293
|
+
if (await this.doInteractive(st)) {
|
|
1294
|
+
await this.next(st);
|
|
1295
|
+
return this.amRun(await this.load(), false);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
967
1298
|
await this.doCommit(st);
|
|
968
1299
|
await this.next(st);
|
|
969
1300
|
return this.amRun(await this.load(), false);
|
|
@@ -1026,6 +1357,27 @@ export class AmCommand extends GitCommand<AmResult> {
|
|
|
1026
1357
|
}
|
|
1027
1358
|
}
|
|
1028
1359
|
|
|
1360
|
+
/** A read of `git am -i`'s "Apply?" prompt (see `AmCommand.setInteractive`). */
|
|
1361
|
+
export interface AmInteractiveRequest {
|
|
1362
|
+
/** The prompt as git prints it */
|
|
1363
|
+
prompt: string;
|
|
1364
|
+
/** The commit message shown ("Commit Body is:") */
|
|
1365
|
+
message: string;
|
|
1366
|
+
/** What `git am` printed so far on standard output */
|
|
1367
|
+
output: string;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/** Answers `git am -i`'s question: the line typed, or undefined at the end of input. */
|
|
1371
|
+
export type AmInteractiveReader = (
|
|
1372
|
+
request: AmInteractiveRequest,
|
|
1373
|
+
) => string | undefined | Promise<string | undefined>;
|
|
1374
|
+
|
|
1375
|
+
/** The editor of `git am -i`'s `e`: the edited message, or undefined when it failed. */
|
|
1376
|
+
export type AmMessageEditor = (
|
|
1377
|
+
path: string,
|
|
1378
|
+
message: string,
|
|
1379
|
+
) => string | undefined | Promise<string | undefined>;
|
|
1380
|
+
|
|
1029
1381
|
interface AmState {
|
|
1030
1382
|
cur: number;
|
|
1031
1383
|
last: number;
|
|
@@ -1036,6 +1388,8 @@ interface AmState {
|
|
|
1036
1388
|
keep: "t" | "b" | "f";
|
|
1037
1389
|
messageId: boolean;
|
|
1038
1390
|
scissors: string;
|
|
1391
|
+
/** `quoted-cr`: nowarn, warn, strip, or empty (`mailinfo.quotedCr`) */
|
|
1392
|
+
quotedCr: string;
|
|
1039
1393
|
applyOpts: string[];
|
|
1040
1394
|
author?: { name: string; email: string; date: string };
|
|
1041
1395
|
msg?: string;
|