@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
|
@@ -3,21 +3,32 @@
|
|
|
3
3
|
* 2001`, `From:`, `Date:`, `Subject: [PATCH n/m] ...`, the message, `---`, the diffstat,
|
|
4
4
|
* the summary, the patch with binary hunks, the `-- ` signature), as git writes them byte
|
|
5
5
|
* for byte: numbered subjects, cover letters with the shortlog and diffstat, threading
|
|
6
|
-
* headers, `--base` prerequisite patch ids, signoffs
|
|
6
|
+
* headers, `--base` prerequisite patch ids, signoffs through the trailers engine, MIME
|
|
7
|
+
* attachments (`--attach`/`--inline`), notes after the `---` line, cover letters from the
|
|
8
|
+
* branch description, `--ignore-if-in-upstream` and the `format.*` settings.
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
11
|
import type { ObjectId, PersonIdent } from "@statewalker/vcs-core";
|
|
10
12
|
import { nullObjectIdLike } from "@statewalker/vcs-utils";
|
|
11
13
|
import { decodeGitPath, encodeGitPath } from "@statewalker/vcs-utils/encoding";
|
|
12
|
-
import {
|
|
14
|
+
import { RemoteConfigStore } from "../remote-config/index.js";
|
|
13
15
|
import { ChangeType } from "../results/diff-entry.js";
|
|
16
|
+
import { bytesToLatin1, latin1ToBytes } from "./apply/latin1.js";
|
|
14
17
|
import { showDate } from "./date-format.js";
|
|
15
18
|
import { DiffCommand } from "./diff-command.js";
|
|
16
19
|
import { LogCommand } from "./log-command.js";
|
|
17
|
-
import { mailFromHeader } from "./log-output.js";
|
|
20
|
+
import { mailFromHeader, mailSubjectLine } from "./log-output.js";
|
|
18
21
|
import { configValue } from "./merge-config.js";
|
|
19
22
|
import { type PatchIdChange, patchIdOfChanges } from "./patch-id.js";
|
|
20
|
-
import { sanitizedSubject
|
|
23
|
+
import { sanitizedSubject } from "./pretty-format.js";
|
|
24
|
+
import {
|
|
25
|
+
CREATION_FACTOR_FOR_THE_SAME_SERIES,
|
|
26
|
+
RANGE_DIFF_CREATION_FACTOR_DEFAULT,
|
|
27
|
+
RangeDiffBase,
|
|
28
|
+
type RangeDiffNotesOption,
|
|
29
|
+
} from "./range-diff/index.js";
|
|
30
|
+
import { commitSubject, outputEncoderFor, Shortlog } from "./shortlog.js";
|
|
31
|
+
import { trailerConfigOf } from "./trailers.js";
|
|
21
32
|
|
|
22
33
|
/** One file `git format-patch` writes (or one mail of `--stdout`). */
|
|
23
34
|
export interface FormatPatchFile {
|
|
@@ -33,11 +44,31 @@ export interface FormatPatchResult {
|
|
|
33
44
|
patches: FormatPatchFile[];
|
|
34
45
|
/** Standard output: the file names, or the mails with `--stdout` */
|
|
35
46
|
output: Uint8Array;
|
|
47
|
+
/** git's `warning:` lines (`using '<prev>' as range-diff origin of current series`) */
|
|
48
|
+
warnings?: string[];
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
/** Thrown where git dies (`fatal: ...`). */
|
|
39
52
|
export class FormatPatchError extends Error {}
|
|
40
53
|
|
|
54
|
+
/** `--cover-from-description` modes (`default` is `message`). */
|
|
55
|
+
export type CoverFromDescription = "default" | "none" | "message" | "subject" | "auto";
|
|
56
|
+
|
|
57
|
+
/** diff.c's mime_boundary_leader */
|
|
58
|
+
const MIME_BOUNDARY_LEADER = "------------";
|
|
59
|
+
|
|
60
|
+
/** builtin/log.c's COVER_FROM_AUTO_MAX_SUBJECT_LEN */
|
|
61
|
+
const COVER_FROM_AUTO_MAX_SUBJECT_LEN = 100;
|
|
62
|
+
|
|
63
|
+
/** parse_cover_from_description: dies on an unknown mode. */
|
|
64
|
+
function coverFromDescriptionMode(
|
|
65
|
+
value: string | undefined,
|
|
66
|
+
): "none" | "message" | "subject" | "auto" {
|
|
67
|
+
if (value === undefined || value === "default" || value === "message") return "message";
|
|
68
|
+
if (value === "none" || value === "subject" || value === "auto") return value;
|
|
69
|
+
throw new FormatPatchError(`${value}: invalid cover from description mode`);
|
|
70
|
+
}
|
|
71
|
+
|
|
41
72
|
/** Whether a version string (`2.56.0`, `2.43.0.windows.1`) is at least `major.minor`. */
|
|
42
73
|
function gitVersionAtLeast(version: string, major: number, minor: number): boolean {
|
|
43
74
|
const m = /^(\d+)\.(\d+)/.exec(version);
|
|
@@ -58,7 +89,7 @@ const MAIL_DEFAULT_WRAP = 72;
|
|
|
58
89
|
* const { output } = await git.formatPatch().setMaxCount(1).setStdout(true).call();
|
|
59
90
|
* ```
|
|
60
91
|
*/
|
|
61
|
-
export class FormatPatchCommand extends
|
|
92
|
+
export class FormatPatchCommand extends RangeDiffBase<FormatPatchResult> {
|
|
62
93
|
private revisions: string[] = [];
|
|
63
94
|
private maxCount?: number;
|
|
64
95
|
private root = false;
|
|
@@ -94,6 +125,16 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
94
125
|
private versionString = "2.56.0";
|
|
95
126
|
private messageIdTime?: () => number;
|
|
96
127
|
private writeFiles = true;
|
|
128
|
+
/** `--attach`/`--inline`/`--no-attach`: the boundary (true: the version string, null: none) */
|
|
129
|
+
private attach?: { boundary: string | true | null; inline: boolean };
|
|
130
|
+
private notesOptions: (boolean | string)[] = [];
|
|
131
|
+
private coverFromDescription?: string;
|
|
132
|
+
private ignoreIfInUpstream = false;
|
|
133
|
+
private interdiff?: string;
|
|
134
|
+
private rangeDiff?: string;
|
|
135
|
+
private creationFactor?: number;
|
|
136
|
+
/** What git prints on stderr without dying */
|
|
137
|
+
private readonly warnings: string[] = [];
|
|
97
138
|
|
|
98
139
|
/** A revision argument: `<since>` (to HEAD), `<a>..<b>`, `^<a>`, `<b>`. */
|
|
99
140
|
addRevision(revision: string): this {
|
|
@@ -174,6 +215,75 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
174
215
|
return this;
|
|
175
216
|
}
|
|
176
217
|
|
|
218
|
+
/**
|
|
219
|
+
* `--attach[=<boundary>]` (true: git's version string as the boundary) / `--no-attach`
|
|
220
|
+
* (false): each patch a MIME attachment (`Content-Disposition: attachment`) after the
|
|
221
|
+
* message and the diffstat. Default `format.attach`.
|
|
222
|
+
*/
|
|
223
|
+
setAttach(value: string | boolean): this {
|
|
224
|
+
this.attach = { boundary: value === false ? null : value, inline: false };
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* `--inline[=<boundary>]` (true: git's version string): as {@link setAttach}, the part
|
|
230
|
+
* marked `Content-Disposition: inline` (`--no-attach` turns either off).
|
|
231
|
+
*/
|
|
232
|
+
setInline(value: string | true): this {
|
|
233
|
+
this.attach = { boundary: value, inline: true };
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* `--notes` (true), `--notes=<ref>` (a ref, `x` is `refs/notes/x`), `--no-notes` (false):
|
|
239
|
+
* each call is one option, applied in order after `format.notes`. The notes go after the
|
|
240
|
+
* `---` line.
|
|
241
|
+
*/
|
|
242
|
+
setNotes(value: boolean | string): this {
|
|
243
|
+
this.notesOptions.push(value);
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* `--cover-from-description=<mode>`: how the cover letter uses `branch.<name>.description`
|
|
249
|
+
* (default `format.coverFromDescription`, else `message`).
|
|
250
|
+
*/
|
|
251
|
+
setCoverFromDescription(mode: CoverFromDescription | (string & {})): this {
|
|
252
|
+
this.coverFromDescription = mode;
|
|
253
|
+
return this;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** `--ignore-if-in-upstream`: leave out the patches the upstream side has (patch ids). */
|
|
257
|
+
setIgnoreIfInUpstream(value: boolean): this {
|
|
258
|
+
this.ignoreIfInUpstream = value;
|
|
259
|
+
return this;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* `--interdiff=<rev>`: the diff from `<rev>` (the previous version's tip) to this series'
|
|
264
|
+
* tip, in the cover letter or after the single patch (the last one given counts).
|
|
265
|
+
*/
|
|
266
|
+
setInterdiff(rev: string): this {
|
|
267
|
+
this.interdiff = rev;
|
|
268
|
+
return this;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* `--range-diff=<prev>`: the range-diff of the previous version (a range, or its tip, the
|
|
273
|
+
* range then reaching back to this series' base) against this series, in the cover letter
|
|
274
|
+
* or after the single patch.
|
|
275
|
+
*/
|
|
276
|
+
setRangeDiff(prev: string): this {
|
|
277
|
+
this.rangeDiff = prev;
|
|
278
|
+
return this;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** `--creation-factor=<n>` of `--range-diff` (default 999 from git 2.46 on, 60 before). */
|
|
282
|
+
setCreationFactor(factor: number): this {
|
|
283
|
+
this.creationFactor = factor;
|
|
284
|
+
return this;
|
|
285
|
+
}
|
|
286
|
+
|
|
177
287
|
/** `--cover-letter` / `--no-cover-letter` (default `format.coverLetter`). */
|
|
178
288
|
setCoverLetter(value: boolean): this {
|
|
179
289
|
this.coverLetter = value;
|
|
@@ -308,6 +418,11 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
308
418
|
return configValue(this.workingCopy, key);
|
|
309
419
|
}
|
|
310
420
|
|
|
421
|
+
/** Every value of a variable in order, `text` undefined for one without `=`. */
|
|
422
|
+
private configWhere(key: string): { text: string | undefined }[] {
|
|
423
|
+
return RemoteConfigStore.from(this.workingCopy).valuesWithOrigin(key);
|
|
424
|
+
}
|
|
425
|
+
|
|
311
426
|
private configAll(key: string): string[] {
|
|
312
427
|
const store = (this.workingCopy as unknown as { config?: { getAll?(k: string): string[] } })
|
|
313
428
|
.config;
|
|
@@ -353,7 +468,7 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
353
468
|
}
|
|
354
469
|
if (this.thread !== undefined) thread = this.thread;
|
|
355
470
|
const cfgCover = this.config("format.coverLetter");
|
|
356
|
-
let configCover: "on" | "off" | "auto" = "
|
|
471
|
+
let configCover: "on" | "off" | "auto" | "unset" = "unset";
|
|
357
472
|
if (cfgCover !== undefined)
|
|
358
473
|
configCover = cfgCover.toLowerCase() === "auto" ? "auto" : bool(cfgCover) ? "on" : "off";
|
|
359
474
|
const encodeHeaders = bool(this.config("format.encodeEmailHeaders")) ?? true;
|
|
@@ -392,6 +507,49 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
392
507
|
fromSpec = b === undefined ? fromCfg : b ? true : undefined;
|
|
393
508
|
}
|
|
394
509
|
|
|
510
|
+
// format.attach: a boundary, an empty value none, no value the version string; then
|
|
511
|
+
// --attach/--inline/--no-attach
|
|
512
|
+
let mime: { boundary: string; inline: boolean } | undefined;
|
|
513
|
+
const attachCfg = this.configWhere("format.attach").at(-1);
|
|
514
|
+
if (attachCfg) {
|
|
515
|
+
if (attachCfg.text === undefined) mime = { boundary: this.versionString, inline: false };
|
|
516
|
+
else if (attachCfg.text !== "") mime = { boundary: attachCfg.text, inline: false };
|
|
517
|
+
else mime = undefined;
|
|
518
|
+
}
|
|
519
|
+
if (this.attach) {
|
|
520
|
+
const b = this.attach.boundary;
|
|
521
|
+
mime =
|
|
522
|
+
b === null
|
|
523
|
+
? undefined
|
|
524
|
+
: { boundary: b === true ? this.versionString : b, inline: this.attach.inline };
|
|
525
|
+
}
|
|
526
|
+
// format.notes, then --notes/--notes=<ref>/--no-notes (display_notes_opt)
|
|
527
|
+
const notes = { show: false, useDefault: false, refs: [] as string[] };
|
|
528
|
+
const notesOption = (value: boolean | string) => {
|
|
529
|
+
if (value === true) {
|
|
530
|
+
notes.useDefault = true;
|
|
531
|
+
notes.show = true;
|
|
532
|
+
} else if (value === false) {
|
|
533
|
+
notes.useDefault = false;
|
|
534
|
+
notes.refs = [];
|
|
535
|
+
notes.show = false;
|
|
536
|
+
} else {
|
|
537
|
+
notes.refs.push(value);
|
|
538
|
+
notes.show = true;
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
for (const where of this.configWhere("format.notes")) {
|
|
542
|
+
const b = where.text === undefined ? true : maybeBool(where.text);
|
|
543
|
+
notesOption(b === undefined ? (where.text as string) : b);
|
|
544
|
+
}
|
|
545
|
+
for (const value of this.notesOptions) notesOption(value);
|
|
546
|
+
// format.coverFromDescription, then --cover-from-description (dies on a bad mode)
|
|
547
|
+
let coverMode = coverFromDescriptionMode(undefined);
|
|
548
|
+
const cfgCoverMode = this.config("format.coverFromDescription");
|
|
549
|
+
if (cfgCoverMode !== undefined) coverMode = coverFromDescriptionMode(cfgCoverMode);
|
|
550
|
+
if (this.coverFromDescription !== undefined)
|
|
551
|
+
coverMode = coverFromDescriptionMode(this.coverFromDescription);
|
|
552
|
+
|
|
395
553
|
let sprefix = this.subjectPrefix ?? this.config("format.subjectPrefix") ?? "PATCH";
|
|
396
554
|
const subjectPrefixGiven = this.subjectPrefix !== undefined;
|
|
397
555
|
if (this.rfc) {
|
|
@@ -436,18 +594,32 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
436
594
|
);
|
|
437
595
|
|
|
438
596
|
// the commits: newest first, merges left out
|
|
439
|
-
const { list, origin } = await this.walk();
|
|
597
|
+
const { list, origin, branchName } = await this.walk();
|
|
440
598
|
if (!list.length) return { patches: [], output: new Uint8Array(0) };
|
|
441
599
|
const total0 = list.length;
|
|
442
600
|
let cover = this.coverLetter;
|
|
443
601
|
if (cover === undefined) {
|
|
444
602
|
if (configCover === "auto") cover = total0 > 1;
|
|
603
|
+
else if (
|
|
604
|
+
// git 2.46 and later: a series with an interdiff or range-diff gets one
|
|
605
|
+
gitVersionAtLeast(this.versionString, 2, 46) &&
|
|
606
|
+
(this.interdiff !== undefined || this.rangeDiff !== undefined) &&
|
|
607
|
+
total0 > 1
|
|
608
|
+
)
|
|
609
|
+
cover = configCover !== "off";
|
|
445
610
|
else cover = configCover === "on";
|
|
446
611
|
}
|
|
447
612
|
if (!this.keepSubject && autoNumber && (total0 > 1 || cover)) numbered = true;
|
|
448
613
|
// rev.total: the last number shown (0: not numbered, -1: -k)
|
|
449
614
|
const total = numbered ? total0 + startNumber - 1 : this.keepSubject ? -1 : 0;
|
|
450
615
|
|
|
616
|
+
// --interdiff and --range-diff: in the cover letter, else after the single patch
|
|
617
|
+
const diffOfDiff = await this.diffOfDiffBlocks(list, origin, {
|
|
618
|
+
cover,
|
|
619
|
+
notes,
|
|
620
|
+
noPrefix,
|
|
621
|
+
});
|
|
622
|
+
|
|
451
623
|
// --base
|
|
452
624
|
const bases = await this.prepareBases(list);
|
|
453
625
|
|
|
@@ -480,8 +652,8 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
480
652
|
}
|
|
481
653
|
return h;
|
|
482
654
|
};
|
|
483
|
-
const fileName = (subject: string | undefined) => {
|
|
484
|
-
let name = outDir ? (outDir.endsWith("/") ? outDir : `${outDir}/`) : "";
|
|
655
|
+
const fileName = (subject: string | undefined, inDir = true) => {
|
|
656
|
+
let name = outDir && inDir ? (outDir.endsWith("/") ? outDir : `${outDir}/`) : "";
|
|
485
657
|
if (this.numberedFiles) return `${name}${nr}`;
|
|
486
658
|
const maxLen = encodeGitPath(name).length + nameMax - (suffix.length + 1);
|
|
487
659
|
if (this.rerollCount) name += `${sanitizedSubject(`v${this.rerollCount}`)}-`;
|
|
@@ -516,8 +688,10 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
516
688
|
encodeHeaders,
|
|
517
689
|
zeroCommit: this.zeroCommit,
|
|
518
690
|
outputEncoding,
|
|
691
|
+
coverMode,
|
|
692
|
+
...(branchName !== undefined ? { branchName } : {}),
|
|
519
693
|
});
|
|
520
|
-
const content = concat([text, latin(bases.text), latin(sig())]);
|
|
694
|
+
const content = concat([text, ...diffOfDiff.cover, latin(bases.text), latin(sig())]);
|
|
521
695
|
bases.text = "";
|
|
522
696
|
emit(fileName(this.numberedFiles ? undefined : "cover-letter"), content);
|
|
523
697
|
}
|
|
@@ -537,6 +711,21 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
537
711
|
ownId = messageId(id);
|
|
538
712
|
}
|
|
539
713
|
const subject = this.numberedFiles ? undefined : await this.fileSubject(id);
|
|
714
|
+
// log_write_email_headers: a multipart mail, the patch in a part of its own
|
|
715
|
+
let afterSubject = extraHeaders;
|
|
716
|
+
let statSep: string | undefined;
|
|
717
|
+
if (mime) {
|
|
718
|
+
const boundary = `${MIME_BOUNDARY_LEADER}${mime.boundary}`;
|
|
719
|
+
const part = fileName(subject, false);
|
|
720
|
+
afterSubject +=
|
|
721
|
+
`MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary="${boundary}"\n\n` +
|
|
722
|
+
`This is a multi-part message in MIME format.\n--${boundary}\n` +
|
|
723
|
+
"Content-Type: text/plain; charset=UTF-8; format=fixed\nContent-Transfer-Encoding: 8bit\n\n";
|
|
724
|
+
statSep =
|
|
725
|
+
`\n--${boundary}\nContent-Type: text/x-patch; name="${part}"\n` +
|
|
726
|
+
"Content-Transfer-Encoding: 8bit\n" +
|
|
727
|
+
`Content-Disposition: ${mime.inline ? "inline" : "attachment"}; filename="${part}"\n\n`;
|
|
728
|
+
}
|
|
540
729
|
const log = new LogCommand(this.workingCopy)
|
|
541
730
|
.add(id)
|
|
542
731
|
.setMaxCount(1)
|
|
@@ -548,6 +737,7 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
548
737
|
submoduleFormat: "short",
|
|
549
738
|
uiConfig: false,
|
|
550
739
|
...(noPrefix ? { noPrefix: true } : {}),
|
|
740
|
+
...(statSep !== undefined ? { statSep } : {}),
|
|
551
741
|
});
|
|
552
742
|
const bytes = await log.callBytes({
|
|
553
743
|
pretty: this.stdout && bool(this.config("format.mboxrd")) ? "mboxrd" : "email",
|
|
@@ -556,27 +746,39 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
556
746
|
patch: true,
|
|
557
747
|
showRoot: true,
|
|
558
748
|
mailmap: false,
|
|
559
|
-
|
|
749
|
+
// load_display_notes: the default refs unless only --notes=<ref> ones were asked for
|
|
750
|
+
...(!notes.show
|
|
751
|
+
? { notes: false }
|
|
752
|
+
: notes.useDefault || notes.refs.length === 0
|
|
753
|
+
? { notes: true, notesRefs: notes.refs }
|
|
754
|
+
: { notesRefs: notes.refs }),
|
|
560
755
|
abbrevCommit: false,
|
|
561
756
|
decorate: false,
|
|
562
757
|
mail: {
|
|
563
758
|
subject: subjectOf,
|
|
564
759
|
threadHeaders,
|
|
565
|
-
afterSubject
|
|
760
|
+
afterSubject,
|
|
566
761
|
zeroCommit: this.zeroCommit,
|
|
567
762
|
preserveSubject: this.keepSubject,
|
|
568
|
-
...(sob ? { signoff: sob } : {}),
|
|
763
|
+
...(sob ? { signoff: sob, trailerConfig: trailerConfigOf(this.workingCopy) } : {}),
|
|
764
|
+
...(mime ? { multipart: true } : {}),
|
|
569
765
|
...(fromIdent ? { from: fromIdent } : {}),
|
|
570
766
|
forceInBodyFrom: this.forceInBodyFrom,
|
|
571
767
|
encodeHeaders,
|
|
572
768
|
outputEncoding,
|
|
769
|
+
...(diffOfDiff.commentary.length ? { commentary: diffOfDiff.commentary } : {}),
|
|
573
770
|
},
|
|
574
771
|
});
|
|
575
772
|
const parts: Uint8Array[] = [];
|
|
576
773
|
// log-tree's shown_one: one blank line between the mails of --stdout
|
|
577
774
|
if (this.stdout && shownOne) parts.push(latin("\n"));
|
|
578
775
|
shownOne = true;
|
|
579
|
-
parts.push(
|
|
776
|
+
parts.push(
|
|
777
|
+
bytes,
|
|
778
|
+
...diffOfDiff.afterPatch,
|
|
779
|
+
latin(bases.text),
|
|
780
|
+
latin(mime ? `\n--${MIME_BOUNDARY_LEADER}${mime.boundary}--\n\n\n` : sig()),
|
|
781
|
+
);
|
|
580
782
|
bases.text = "";
|
|
581
783
|
emit(fileName(subject), concat(parts));
|
|
582
784
|
}
|
|
@@ -590,7 +792,108 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
590
792
|
}
|
|
591
793
|
}
|
|
592
794
|
const output = this.stdout ? concat(stdoutParts) : new TextEncoder().encode(out.join(""));
|
|
593
|
-
return { patches, output };
|
|
795
|
+
return { patches, output, ...(this.warnings.length ? { warnings: this.warnings } : {}) };
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* The `Interdiff:` and `Range-diff:` blocks (title line and output) where git puts them:
|
|
800
|
+
* in the cover letter; else after the patch from 2.46 on (each after an empty line), as
|
|
801
|
+
* commentary after the message before.
|
|
802
|
+
*/
|
|
803
|
+
private async diffOfDiffBlocks(
|
|
804
|
+
list: ObjectId[],
|
|
805
|
+
origin: ObjectId | undefined,
|
|
806
|
+
state: {
|
|
807
|
+
cover: boolean;
|
|
808
|
+
notes: { show: boolean; useDefault: boolean; refs: string[] };
|
|
809
|
+
noPrefix: boolean;
|
|
810
|
+
},
|
|
811
|
+
): Promise<{ cover: Uint8Array[]; afterPatch: Uint8Array[]; commentary: Uint8Array[] }> {
|
|
812
|
+
const none = { cover: [], afterPatch: [], commentary: [] };
|
|
813
|
+
const modern = gitVersionAtLeast(this.versionString, 2, 46);
|
|
814
|
+
const single = state.cover || list.length === 1;
|
|
815
|
+
if (this.interdiff !== undefined && !single)
|
|
816
|
+
throw new FormatPatchError("--interdiff requires --cover-letter or single patch");
|
|
817
|
+
if (this.creationFactor !== undefined && this.rangeDiff === undefined)
|
|
818
|
+
throw new FormatPatchError("the option '--creation-factor' requires '--range-diff'");
|
|
819
|
+
if (this.rangeDiff !== undefined && !single)
|
|
820
|
+
throw new FormatPatchError("--range-diff requires --cover-letter or single patch");
|
|
821
|
+
const head = list[0] as ObjectId;
|
|
822
|
+
// diff_title: "against v<n-1>" for an integer reroll count of at least 1
|
|
823
|
+
const title = (generic: string, rerolled: string) => {
|
|
824
|
+
const v =
|
|
825
|
+
this.rerollCount !== undefined && /^[+-]?\d+$/.test(this.rerollCount.trim())
|
|
826
|
+
? Number(this.rerollCount)
|
|
827
|
+
: undefined;
|
|
828
|
+
return v !== undefined && v >= 1 ? `${rerolled} v${v - 1}:` : `${generic}:`;
|
|
829
|
+
};
|
|
830
|
+
const blocks: { title: string; body: Uint8Array; indented: Uint8Array }[] = [];
|
|
831
|
+
if (this.interdiff !== undefined) {
|
|
832
|
+
const resolver = this.revisionResolver();
|
|
833
|
+
const id = await resolver.resolve(this.interdiff).catch(() => undefined);
|
|
834
|
+
if (id === undefined) throw new FormatPatchError(`Not a git revision: ${this.interdiff}`);
|
|
835
|
+
const diff = new DiffCommand(this.workingCopy)
|
|
836
|
+
.setOldTree(id)
|
|
837
|
+
.setNewTree(head)
|
|
838
|
+
.setOptions({
|
|
839
|
+
binaryPatch: !this.noBinary,
|
|
840
|
+
ignoreConfigNoPrefix: true,
|
|
841
|
+
submoduleFormat: "short",
|
|
842
|
+
uiConfig: false,
|
|
843
|
+
...(state.noPrefix ? { noPrefix: true } : {}),
|
|
844
|
+
});
|
|
845
|
+
const body = await diff.callBytes("patch");
|
|
846
|
+
blocks.push({
|
|
847
|
+
title: title("Interdiff", "Interdiff against"),
|
|
848
|
+
body,
|
|
849
|
+
indented: indentLines(body, " "),
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
if (this.rangeDiff !== undefined) {
|
|
853
|
+
const prev = this.rangeDiff;
|
|
854
|
+
const prevIsRange = await this.isRangeDiffRange(prev);
|
|
855
|
+
const range1 = prevIsRange ? prev : `${head}..${prev}`;
|
|
856
|
+
let range2: string;
|
|
857
|
+
if (origin) range2 = `${origin}..${head}`;
|
|
858
|
+
else if (prevIsRange)
|
|
859
|
+
throw new FormatPatchError("failed to infer range-diff origin of current series");
|
|
860
|
+
else {
|
|
861
|
+
this.warnings.push(`warning: using '${prev}' as range-diff origin of current series`);
|
|
862
|
+
range2 = `${prev}..${head}`;
|
|
863
|
+
}
|
|
864
|
+
// get_notes_args: the notes format-patch shows; a single patch's range-diff got none
|
|
865
|
+
// before git 2.52 (its log then showed the default notes)
|
|
866
|
+
const notes: RangeDiffNotesOption[] = !state.notes.show
|
|
867
|
+
? [false]
|
|
868
|
+
: state.notes.useDefault || state.notes.refs.length === 0
|
|
869
|
+
? [true]
|
|
870
|
+
: state.notes.refs;
|
|
871
|
+
const body = await this.showRangeDiff(range1, range2, {
|
|
872
|
+
creationFactor:
|
|
873
|
+
this.creationFactor ??
|
|
874
|
+
(modern ? CREATION_FACTOR_FOR_THE_SAME_SERIES : RANGE_DIFF_CREATION_FACTOR_DEFAULT),
|
|
875
|
+
notes: !state.cover && !gitVersionAtLeast(this.versionString, 2, 52) ? [] : notes,
|
|
876
|
+
dualColor: true,
|
|
877
|
+
color: false,
|
|
878
|
+
});
|
|
879
|
+
blocks.push({ title: title("Range-diff", "Range-diff against"), body, indented: body });
|
|
880
|
+
}
|
|
881
|
+
if (blocks.length === 0) return none;
|
|
882
|
+
const enc = new TextEncoder();
|
|
883
|
+
if (state.cover)
|
|
884
|
+
return {
|
|
885
|
+
...none,
|
|
886
|
+
cover: blocks.flatMap((b) => [enc.encode(`${b.title}\n`), b.body]),
|
|
887
|
+
};
|
|
888
|
+
if (modern)
|
|
889
|
+
return {
|
|
890
|
+
...none,
|
|
891
|
+
afterPatch: blocks.flatMap((b) => [enc.encode(`\n${b.title}\n`), b.indented]),
|
|
892
|
+
};
|
|
893
|
+
return {
|
|
894
|
+
...none,
|
|
895
|
+
commentary: blocks.map((b) => concat([enc.encode(`${b.title}\n`), b.indented])),
|
|
896
|
+
};
|
|
594
897
|
}
|
|
595
898
|
|
|
596
899
|
/** The subject for the file name (`%f`). */
|
|
@@ -609,6 +912,7 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
609
912
|
/** The commits to format (newest first), the single boundary commit, the branch name. */
|
|
610
913
|
private async walk(): Promise<{ list: ObjectId[]; origin?: ObjectId; branchName?: string }> {
|
|
611
914
|
const resolver = this.revisionResolver();
|
|
915
|
+
/** The object a name gives (a tag as itself) and the commit it peels to */
|
|
612
916
|
const resolve = async (spec: string) => {
|
|
613
917
|
const id = await resolver.resolve(spec, { type: "commit" } as never);
|
|
614
918
|
if (!id)
|
|
@@ -616,26 +920,34 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
616
920
|
`ambiguous argument '${spec}': unknown revision or path not in the working tree.`,
|
|
617
921
|
);
|
|
618
922
|
const peeled = (await resolver.peelToType(id, "commit")) ?? id;
|
|
619
|
-
return peeled;
|
|
923
|
+
return { id, peeled };
|
|
620
924
|
};
|
|
621
925
|
const positive: ObjectId[] = [];
|
|
622
926
|
const negative: ObjectId[] = [];
|
|
927
|
+
/** rev->cmdline's interesting entries: the name as given and its object */
|
|
928
|
+
const interesting: { name: string; id: ObjectId }[] = [];
|
|
623
929
|
let singleName: string | undefined;
|
|
624
930
|
for (const rev of this.revisions) {
|
|
625
931
|
const dots = rev.indexOf("..");
|
|
626
932
|
if (dots >= 0 && rev[dots + 2] !== ".") {
|
|
627
933
|
const a = rev.slice(0, dots) || "HEAD";
|
|
628
934
|
const b = rev.slice(dots + 2) || "HEAD";
|
|
629
|
-
negative.push(await resolve(a));
|
|
630
|
-
|
|
631
|
-
|
|
935
|
+
negative.push((await resolve(a)).peeled);
|
|
936
|
+
const tip = await resolve(b);
|
|
937
|
+
positive.push(tip.peeled);
|
|
938
|
+
interesting.push({ name: b, id: tip.id });
|
|
939
|
+
} else if (rev.startsWith("^")) negative.push((await resolve(rev.slice(1))).peeled);
|
|
632
940
|
else {
|
|
633
|
-
|
|
941
|
+
const tip = await resolve(rev);
|
|
942
|
+
positive.push(tip.peeled);
|
|
943
|
+
interesting.push({ name: rev, id: tip.id });
|
|
634
944
|
singleName = rev;
|
|
635
945
|
}
|
|
636
946
|
}
|
|
637
947
|
if (!positive.length && !negative.length) {
|
|
638
|
-
|
|
948
|
+
const head = await resolve("HEAD");
|
|
949
|
+
positive.push(head.peeled);
|
|
950
|
+
interesting.push({ name: "HEAD", id: head.id });
|
|
639
951
|
singleName = "HEAD";
|
|
640
952
|
}
|
|
641
953
|
let branchName: string | undefined;
|
|
@@ -643,7 +955,7 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
643
955
|
let checkHead = false;
|
|
644
956
|
if (this.maxCount === undefined && !this.root) {
|
|
645
957
|
negative.push(positive.pop() as ObjectId);
|
|
646
|
-
positive.push(await resolve("HEAD"));
|
|
958
|
+
positive.push((await resolve("HEAD")).peeled);
|
|
647
959
|
checkHead = true;
|
|
648
960
|
}
|
|
649
961
|
if (singleName === "HEAD") checkHead = true;
|
|
@@ -652,22 +964,53 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
652
964
|
branchName = branch?.startsWith("refs/heads/") ? branch.slice(11) : "";
|
|
653
965
|
}
|
|
654
966
|
}
|
|
967
|
+
// find_branch_name: the one interesting revision, when it names a branch at its tip
|
|
968
|
+
if (branchName === undefined && interesting.length === 1) {
|
|
969
|
+
const only = interesting[0] as { name: string; id: ObjectId };
|
|
970
|
+
const found = (await resolver.dwimRef(only.name).catch(() => []))[0];
|
|
971
|
+
if (found?.ref.startsWith("refs/heads/") && found.id === only.id)
|
|
972
|
+
branchName = found.ref.slice(11);
|
|
973
|
+
}
|
|
974
|
+
// --ignore-if-in-upstream: the patch ids of the upstream side (get_patch_ids)
|
|
975
|
+
let upstream: Set<string> | undefined;
|
|
976
|
+
if (this.ignoreIfInUpstream) {
|
|
977
|
+
const pending = [
|
|
978
|
+
...negative.map((id) => ({ id, uninteresting: true })),
|
|
979
|
+
...positive.map((id) => ({ id, uninteresting: false })),
|
|
980
|
+
];
|
|
981
|
+
// nothing to say when head and upstream are the same
|
|
982
|
+
if (pending.length === 2 && pending[0]?.id === pending[1]?.id) return { list: [] };
|
|
983
|
+
if (pending.length !== 2) throw new FormatPatchError("need exactly one range");
|
|
984
|
+
if (pending[0]?.uninteresting === pending[1]?.uninteresting)
|
|
985
|
+
throw new FormatPatchError("not a range");
|
|
986
|
+
upstream = new Set();
|
|
987
|
+
const check = new LogCommand(this.workingCopy);
|
|
988
|
+
check.add(negative[0] as ObjectId);
|
|
989
|
+
check.not(positive[0] as ObjectId);
|
|
990
|
+
for await (const c of await check.call()) {
|
|
991
|
+
if (c.parents.length > 1) continue;
|
|
992
|
+
upstream.add(await this.commitPatchId(c.id, c.parents[0], false));
|
|
993
|
+
}
|
|
994
|
+
}
|
|
655
995
|
const log = new LogCommand(this.workingCopy);
|
|
656
996
|
for (const p of positive) log.add(p);
|
|
657
997
|
for (const n of negative) log.not(n);
|
|
658
998
|
const list: ObjectId[] = [];
|
|
659
|
-
const
|
|
999
|
+
const walked = new Set<ObjectId>();
|
|
660
1000
|
const parentsOf = new Map<ObjectId, ObjectId[]>();
|
|
661
1001
|
for await (const c of await log.call()) {
|
|
662
1002
|
if (c.parents.length > 1) continue;
|
|
663
|
-
if (this.maxCount !== undefined &&
|
|
664
|
-
|
|
665
|
-
listed.add(c.id);
|
|
1003
|
+
if (this.maxCount !== undefined && walked.size >= this.maxCount) break;
|
|
1004
|
+
walked.add(c.id);
|
|
666
1005
|
parentsOf.set(c.id, c.parents);
|
|
1006
|
+
if (upstream?.size && upstream.has(await this.commitPatchId(c.id, c.parents[0], false)))
|
|
1007
|
+
continue;
|
|
1008
|
+
list.push(c.id);
|
|
667
1009
|
}
|
|
1010
|
+
// the walk's boundary (commits left out as already upstream still walked)
|
|
668
1011
|
const boundary = new Set<ObjectId>();
|
|
669
|
-
for (const id of
|
|
670
|
-
for (const p of parentsOf.get(id) ?? []) if (!
|
|
1012
|
+
for (const id of walked)
|
|
1013
|
+
for (const p of parentsOf.get(id) ?? []) if (!walked.has(p)) boundary.add(p);
|
|
671
1014
|
const origin = boundary.size === 1 ? [...boundary][0] : undefined;
|
|
672
1015
|
return {
|
|
673
1016
|
list,
|
|
@@ -676,6 +1019,36 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
676
1019
|
};
|
|
677
1020
|
}
|
|
678
1021
|
|
|
1022
|
+
/**
|
|
1023
|
+
* commit_patch_id: the patch id of a commit's diff against its parent (the empty tree for
|
|
1024
|
+
* a root), rename detection as asked; the null id for an empty diff.
|
|
1025
|
+
*/
|
|
1026
|
+
private async commitPatchId(
|
|
1027
|
+
id: ObjectId,
|
|
1028
|
+
parent: ObjectId | undefined,
|
|
1029
|
+
renames: boolean,
|
|
1030
|
+
): Promise<string> {
|
|
1031
|
+
const diff = new DiffCommand(this.workingCopy).setNewTree(id).setRenames(renames);
|
|
1032
|
+
if (parent) diff.setOldTree(parent);
|
|
1033
|
+
else diff.setOldTree(this.objectFormat.emptyTreeId);
|
|
1034
|
+
const changes: PatchIdChange[] = [];
|
|
1035
|
+
for (const e of await diff.call()) {
|
|
1036
|
+
const del = e.changeType === ChangeType.DELETE;
|
|
1037
|
+
const add = e.changeType === ChangeType.ADD;
|
|
1038
|
+
changes.push({
|
|
1039
|
+
path: (del ? e.oldPath : e.newPath) as string,
|
|
1040
|
+
...(e.changeType === ChangeType.RENAME || e.changeType === ChangeType.COPY
|
|
1041
|
+
? { oldPath: e.oldPath as string }
|
|
1042
|
+
: {}),
|
|
1043
|
+
...(!add && e.oldId ? { old: { mode: e.oldMode as number, id: e.oldId } } : {}),
|
|
1044
|
+
...(!del && e.newId ? { new: { mode: e.newMode as number, id: e.newId } } : {}),
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
return changes.length
|
|
1048
|
+
? await patchIdOfChanges(this.blobs, changes, { objectFormat: this.objectFormat })
|
|
1049
|
+
: this.objectFormat.nullId;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
679
1052
|
/** `get_base_commit` + `prepare_bases`: the text `print_bases` writes once. */
|
|
680
1053
|
private async prepareBases(list: ObjectId[]): Promise<{ text: string }> {
|
|
681
1054
|
let spec = this.base;
|
|
@@ -705,27 +1078,7 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
705
1078
|
for await (const c of await log.call()) {
|
|
706
1079
|
if (c.parents.length > 1 || inList.has(c.id)) continue;
|
|
707
1080
|
// commit_patch_id: the diff against the parent with rename detection (diff.renames)
|
|
708
|
-
|
|
709
|
-
const diff = new DiffCommand(this.workingCopy).setNewTree(c.id).setRenames(true);
|
|
710
|
-
if (parent) diff.setOldTree(parent);
|
|
711
|
-
const changes: PatchIdChange[] = [];
|
|
712
|
-
for (const e of await diff.call()) {
|
|
713
|
-
const del = e.changeType === ChangeType.DELETE;
|
|
714
|
-
const add = e.changeType === ChangeType.ADD;
|
|
715
|
-
changes.push({
|
|
716
|
-
path: (del ? e.oldPath : e.newPath) as string,
|
|
717
|
-
...(e.changeType === ChangeType.RENAME || e.changeType === ChangeType.COPY
|
|
718
|
-
? { oldPath: e.oldPath as string }
|
|
719
|
-
: {}),
|
|
720
|
-
...(!add && e.oldId ? { old: { mode: e.oldMode as number, id: e.oldId } } : {}),
|
|
721
|
-
...(!del && e.newId ? { new: { mode: e.newMode as number, id: e.newId } } : {}),
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
ids.push(
|
|
725
|
-
changes.length
|
|
726
|
-
? await patchIdOfChanges(this.blobs, changes, { objectFormat: this.objectFormat })
|
|
727
|
-
: this.objectFormat.nullId,
|
|
728
|
-
);
|
|
1081
|
+
ids.push(await this.commitPatchId(c.id, c.parents[0], true));
|
|
729
1082
|
}
|
|
730
1083
|
let text = `\nbase-commit: ${base}\n`;
|
|
731
1084
|
for (let i = ids.length - 1; i >= 0; i--) text += `prerequisite-patch-id: ${ids[i]}\n`;
|
|
@@ -746,6 +1099,10 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
746
1099
|
zeroCommit: boolean;
|
|
747
1100
|
/** get_log_output_encoding(): the shortlog's (the headers stay UTF-8) */
|
|
748
1101
|
outputEncoding: string;
|
|
1102
|
+
/** How the branch description is used (`--cover-from-description`) */
|
|
1103
|
+
coverMode: "none" | "message" | "subject" | "auto";
|
|
1104
|
+
/** The branch whose `branch.<name>.description` is read ("" for none) */
|
|
1105
|
+
branchName?: string;
|
|
749
1106
|
},
|
|
750
1107
|
): Promise<Uint8Array> {
|
|
751
1108
|
const head = list[0] as ObjectId;
|
|
@@ -767,50 +1124,72 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
767
1124
|
: { timestamp: mail.committer.timestamp, tzOffset: mail.committer.tzOffset };
|
|
768
1125
|
let text = `From ${mail.zeroCommit ? nullObjectIdLike(head) : head} Mon Sep 17 00:00:00 2001\n`;
|
|
769
1126
|
text += mail.thread;
|
|
770
|
-
|
|
1127
|
+
// git before 2.44 left the cover letter's headers unencoded (pp.encode_email_headers unset)
|
|
1128
|
+
const encodeHeaders = mail.encodeHeaders && gitVersionAtLeast(this.versionString, 2, 44);
|
|
1129
|
+
text += mailFromHeader(who.name, who.email, { encodeHeaders });
|
|
771
1130
|
text += `Date: ${showDate(date.timestamp, date.tzOffset, { type: "rfc2822", local: false })}\n`;
|
|
772
|
-
|
|
1131
|
+
// prepare_cover_text
|
|
1132
|
+
let subject = "*** SUBJECT HERE ***";
|
|
1133
|
+
let body = "*** BLURB HERE ***";
|
|
1134
|
+
const description =
|
|
1135
|
+
mail.coverMode !== "none" && mail.branchName
|
|
1136
|
+
? this.config(`branch.${mail.branchName}.description`)
|
|
1137
|
+
: undefined;
|
|
1138
|
+
if (description) {
|
|
1139
|
+
let firstParagraph: { subject: string; rest: string } | undefined;
|
|
1140
|
+
if (mail.coverMode === "subject" || mail.coverMode === "auto") {
|
|
1141
|
+
firstParagraph = formatSubject(description);
|
|
1142
|
+
body = firstParagraph.rest;
|
|
1143
|
+
}
|
|
1144
|
+
if (
|
|
1145
|
+
mail.coverMode === "message" ||
|
|
1146
|
+
(mail.coverMode === "auto" &&
|
|
1147
|
+
encodeGitPath(firstParagraph?.subject ?? "").length > COVER_FROM_AUTO_MAX_SUBJECT_LEN)
|
|
1148
|
+
)
|
|
1149
|
+
body = description;
|
|
1150
|
+
else subject = firstParagraph?.subject ?? subject;
|
|
1151
|
+
}
|
|
1152
|
+
// pp_email_subject: the title as format_subject joins it
|
|
1153
|
+
text += mailSubjectLine(mail.subject, formatSubject(subject).subject, {
|
|
1154
|
+
encodeHeaders,
|
|
1155
|
+
});
|
|
773
1156
|
if (eightBit)
|
|
774
1157
|
text +=
|
|
775
1158
|
"MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n";
|
|
776
1159
|
text += mail.afterSubject;
|
|
777
|
-
text += "\n
|
|
1160
|
+
text += "\n";
|
|
1161
|
+
// pp_remainder: leading blank lines dropped, each line without its trailing blanks
|
|
1162
|
+
let first = true;
|
|
1163
|
+
for (const line of linesWithEnds(body)) {
|
|
1164
|
+
const trimmed = line.replace(/[ \t\n\v\f\r]+$/, "");
|
|
1165
|
+
if (trimmed === "" && first) continue;
|
|
1166
|
+
first = false;
|
|
1167
|
+
text += `${trimmed}\n`;
|
|
1168
|
+
}
|
|
1169
|
+
text += "\n";
|
|
778
1170
|
const parts: Uint8Array[] = [new TextEncoder().encode(text)];
|
|
779
1171
|
text = "";
|
|
780
|
-
//
|
|
781
|
-
// commit's name and subject in the log output
|
|
782
|
-
// stored where they do not convert (logmsg_reencode)
|
|
783
|
-
const
|
|
784
|
-
const
|
|
1172
|
+
// generate_shortlog_cover_letter: authors (%aN, through the mailmap) in byte order, their
|
|
1173
|
+
// subjects oldest first, wrapped at 72; each commit's name and subject in the log output
|
|
1174
|
+
// encoding (shortlog_add_commit), as stored where they do not convert (logmsg_reencode)
|
|
1175
|
+
const mailmap = await this.readMailmap();
|
|
1176
|
+
const shortlog = new Shortlog<(s: string) => Uint8Array>({
|
|
1177
|
+
wrap: { width: MAIL_DEFAULT_WRAP, indent1: 2, indent2: 4 },
|
|
1178
|
+
});
|
|
785
1179
|
for (const [k, c] of commits.entries()) {
|
|
786
1180
|
if (!c) continue;
|
|
787
1181
|
const utf8 = await this.utf8AuthorAndMessage(list[k] as ObjectId, c);
|
|
788
|
-
const name = utf8.name;
|
|
789
|
-
const encoder =
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
listFor.push(subject);
|
|
797
|
-
byAuthor.set(name, listFor);
|
|
798
|
-
encoderOf.set(`${name}\n${listFor.length - 1}`, encoder);
|
|
799
|
-
if (!encoderOf.has(name)) encoderOf.set(name, encoder);
|
|
1182
|
+
const name = mailmap.map(utf8.name, c.author.email).name;
|
|
1183
|
+
const encoder = outputEncoderFor(
|
|
1184
|
+
mail.outputEncoding,
|
|
1185
|
+
`${name}\n${utf8.message}`,
|
|
1186
|
+
utf8.stored,
|
|
1187
|
+
);
|
|
1188
|
+
// shortlog_add_commit: `<none>` for an empty subject
|
|
1189
|
+
shortlog.insert(name, commitSubject(utf8.message) || "<none>", encoder);
|
|
800
1190
|
}
|
|
801
|
-
const names = [...byAuthor.keys()].sort(compareBytes);
|
|
802
1191
|
const utf8Encode = (x: string) => new TextEncoder().encode(x);
|
|
803
|
-
for (const
|
|
804
|
-
const subjects = byAuthor.get(name) as string[];
|
|
805
|
-
parts.push((encoderOf.get(name) ?? utf8Encode)(`${name} (${subjects.length}):\n`));
|
|
806
|
-
for (let j = subjects.length; j >= 1; j--)
|
|
807
|
-
parts.push(
|
|
808
|
-
(encoderOf.get(`${name}\n${j - 1}`) ?? utf8Encode)(
|
|
809
|
-
`${wrapText(subjects[j - 1] as string, 2, 4, MAIL_DEFAULT_WRAP)}\n`,
|
|
810
|
-
),
|
|
811
|
-
);
|
|
812
|
-
parts.push(utf8Encode("\n"));
|
|
813
|
-
}
|
|
1192
|
+
for (const piece of shortlog.pieces()) parts.push((piece.tag ?? utf8Encode)(piece.text));
|
|
814
1193
|
if (origin) {
|
|
815
1194
|
const originTree = (await this.commits.load(origin))?.tree;
|
|
816
1195
|
const headTree = commits[0]?.tree;
|
|
@@ -895,6 +1274,17 @@ export class FormatPatchCommand extends GitCommand<FormatPatchResult> {
|
|
|
895
1274
|
}
|
|
896
1275
|
}
|
|
897
1276
|
|
|
1277
|
+
/** Each line of `bytes` after `prefix` (diff_line_prefix). */
|
|
1278
|
+
function indentLines(bytes: Uint8Array, prefix: string): Uint8Array {
|
|
1279
|
+
const text = bytesToLatin1(bytes);
|
|
1280
|
+
if (!text) return bytes;
|
|
1281
|
+
const lines = text.split("\n");
|
|
1282
|
+
const last = lines.pop();
|
|
1283
|
+
let out = lines.map((l) => `${prefix}${l}\n`).join("");
|
|
1284
|
+
if (last) out += `${prefix}${last}`;
|
|
1285
|
+
return latin1ToBytes(out);
|
|
1286
|
+
}
|
|
1287
|
+
|
|
898
1288
|
/** git_parse_maybe_bool: undefined (git's -1) for a value that is not a boolean. */
|
|
899
1289
|
function maybeBool(value: string): boolean | undefined {
|
|
900
1290
|
const v = value.toLowerCase();
|
|
@@ -906,46 +1296,36 @@ function maybeBool(value: string): boolean | undefined {
|
|
|
906
1296
|
return undefined;
|
|
907
1297
|
}
|
|
908
1298
|
|
|
909
|
-
const LATIN1_NAME = /^(iso[-_]?8859-1|iso8859-1|latin-?1|l1|iso-ir-100|cp819|ibm819|csisolatin1)$/i;
|
|
910
|
-
|
|
911
|
-
const latin1Bytes = (s: string) => {
|
|
912
|
-
const out = new Uint8Array(s.length);
|
|
913
|
-
for (let i = 0; i < s.length; i++) out[i] = s.charCodeAt(i);
|
|
914
|
-
return out;
|
|
915
|
-
};
|
|
916
|
-
|
|
917
1299
|
/**
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
*
|
|
1300
|
+
* pretty.c's format_subject: the first paragraph's lines (each without its trailing
|
|
1301
|
+
* blanks; a blank line, the first one too, ends it) joined by a space, and what follows
|
|
1302
|
+
* the blank line that ends it.
|
|
921
1303
|
*/
|
|
922
|
-
function
|
|
923
|
-
const utf8 = (s: string) => new TextEncoder().encode(s);
|
|
924
|
-
const encoderFor = (charset: string) =>
|
|
925
|
-
/^utf-?8$/i.test(charset)
|
|
926
|
-
? utf8
|
|
927
|
-
: LATIN1_NAME.test(charset) && [...text].every((ch) => (ch.codePointAt(0) ?? 0) <= 0xff)
|
|
928
|
-
? latin1Bytes
|
|
929
|
-
: undefined;
|
|
930
|
-
return encoderFor(output) ?? encoderFor(stored) ?? utf8;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
function subjectLine(message: string): string {
|
|
934
|
-
const lines = message.split("\n");
|
|
935
|
-
let at = 0;
|
|
936
|
-
while (at < lines.length && (lines[at] as string).trim() === "") at++;
|
|
1304
|
+
function formatSubject(text: string): { subject: string; rest: string } {
|
|
937
1305
|
const parts: string[] = [];
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
1306
|
+
let at = 0;
|
|
1307
|
+
while (at < text.length) {
|
|
1308
|
+
const nl = text.indexOf("\n", at);
|
|
1309
|
+
const end = nl < 0 ? text.length : nl + 1;
|
|
1310
|
+
const line = text.slice(at, end).replace(/[ \t\n\v\f\r]+$/, "");
|
|
1311
|
+
at = end;
|
|
1312
|
+
if (line === "") break;
|
|
1313
|
+
parts.push(line);
|
|
1314
|
+
}
|
|
1315
|
+
return { subject: parts.join(" "), rest: text.slice(at) };
|
|
941
1316
|
}
|
|
942
1317
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1318
|
+
/** The lines of a text, each with its LF (get_one_line) */
|
|
1319
|
+
function linesWithEnds(text: string): string[] {
|
|
1320
|
+
const out: string[] = [];
|
|
1321
|
+
let at = 0;
|
|
1322
|
+
while (at < text.length) {
|
|
1323
|
+
const nl = text.indexOf("\n", at);
|
|
1324
|
+
const end = nl < 0 ? text.length : nl + 1;
|
|
1325
|
+
out.push(text.slice(at, end));
|
|
1326
|
+
at = end;
|
|
1327
|
+
}
|
|
1328
|
+
return out;
|
|
949
1329
|
}
|
|
950
1330
|
|
|
951
1331
|
/** `clean_message_id`: the id without its angle brackets and surrounding blanks. */
|