@statewalker/vcs-commands 0.7.0 → 0.8.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 +38 -0
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/am/am-command.d.ts +55 -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.map +1 -1
- package/dist/commands/apply/apply-engine.d.ts.map +1 -1
- package/dist/commands/apply/apply-parse.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/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/checkout-command.d.ts +19 -3
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/cherry-pick-command.d.ts +59 -0
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +12 -0
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +191 -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/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 +252 -5
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/fetch-command.d.ts +20 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- 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 +41 -1
- 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 +4 -0
- package/dist/commands/git-describe.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +35 -0
- 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 +26 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -3
- package/dist/commands/interpret-trailers-command.d.ts +90 -0
- package/dist/commands/interpret-trailers-command.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 +296 -11
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +26 -1
- package/dist/commands/log-graph.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +133 -5
- 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 +30 -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 +96 -9
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-support.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.d.ts +48 -0
- package/dist/commands/name-rev.d.ts.map +1 -0
- package/dist/commands/notes-command.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 +10 -0
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +160 -9
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/read-tree-command.d.ts +6 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +168 -6
- 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/remote-command.d.ts +138 -29
- package/dist/commands/remote-command.d.ts.map +1 -1
- 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 +2 -3
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +2 -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 +154 -2
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +32 -0
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +32 -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 +84 -4
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/sequencer-support.d.ts +2 -0
- 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/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.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 +375 -0
- package/dist/commands/submodule-commands.d.ts.map +1 -0
- package/dist/commands/submodule-model.d.ts +288 -0
- package/dist/commands/submodule-model.d.ts.map +1 -0
- package/dist/commands/submodule-update-command.d.ts +198 -0
- package/dist/commands/submodule-update-command.d.ts.map +1 -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-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-ISM52N0n.js} +70736 -54492
- 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.map +1 -1
- package/dist/errors/index.js +57 -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/{git-command-BGiOJ8Zk.js → fsck-DLRpbwTj.js} +6230 -71
- package/dist/git-command.d.ts +27 -1
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +267 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/remote-config/index.d.ts +1 -1
- package/dist/remote-config/index.d.ts.map +1 -1
- package/dist/remote-config/remote-config-store.d.ts +55 -0
- package/dist/remote-config/remote-config-store.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-output.d.ts +85 -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/index.d.ts +4 -0
- package/dist/results/index.d.ts.map +1 -1
- package/dist/results/index.js +2 -2
- package/dist/results/push-result.d.ts +7 -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-WVlBhVb1.js → results-TB2IJ64h.js} +2168 -403
- 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 +178 -17
- package/src/commands/am/am-command.ts +262 -42
- package/src/commands/am/index.ts +1 -0
- package/src/commands/am/mailsplit.ts +326 -0
- package/src/commands/apply/apply-command.ts +6 -6
- package/src/commands/apply/apply-engine.ts +1 -1
- package/src/commands/apply/apply-parse.ts +7 -8
- package/src/commands/bisect/bisect-command.ts +18 -5
- 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/checkout-command.ts +69 -43
- package/src/commands/cherry-pick-command.ts +143 -0
- package/src/commands/clean-command.ts +34 -3
- package/src/commands/clone-command.ts +2 -1
- package/src/commands/commit-command.ts +782 -64
- 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/diff-color-config.ts +274 -0
- package/src/commands/diff-command.ts +1009 -49
- package/src/commands/fetch-command.ts +142 -8
- 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 +314 -46
- package/src/commands/fsck/fetch-fsck.ts +172 -18
- package/src/commands/gc-command.ts +31 -1
- package/src/commands/git-describe.ts +31 -11
- package/src/commands/git-hooks.ts +81 -0
- 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 +26 -0
- package/src/commands/interpret-trailers-command.ts +256 -0
- package/src/commands/local-transport.ts +109 -10
- package/src/commands/log-command.ts +1246 -210
- package/src/commands/log-graph.ts +123 -26
- package/src/commands/log-output.ts +280 -21
- package/src/commands/ls-remote-command.ts +5 -0
- package/src/commands/mailmap.ts +119 -0
- package/src/commands/merge-base-command.ts +170 -0
- package/src/commands/merge-bases.ts +63 -8
- package/src/commands/merge-command.ts +330 -82
- package/src/commands/merge-support.ts +14 -1
- package/src/commands/mv-command.ts +6 -3
- package/src/commands/name-rev.ts +171 -0
- package/src/commands/notes-command.ts +11 -1
- 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 +26 -7
- package/src/commands/push-command.ts +682 -65
- package/src/commands/read-tree-command.ts +28 -1
- package/src/commands/rebase-command.ts +933 -129
- 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/remote-command.ts +449 -69
- package/src/commands/remote-transport.ts +9 -1
- package/src/commands/reset-command.ts +36 -31
- package/src/commands/restore-command.ts +12 -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 +402 -15
- package/src/commands/revert-command.ts +82 -0
- package/src/commands/revision-range.ts +204 -4
- package/src/commands/revision-resolver.ts +23 -8
- package/src/commands/rm-command.ts +282 -21
- package/src/commands/sequencer-pick.ts +498 -85
- package/src/commands/sequencer-support.ts +20 -2
- package/src/commands/serve-repository.ts +18 -3
- package/src/commands/show-command.ts +490 -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 +5 -2
- 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 +1517 -0
- package/src/commands/submodule-model.ts +930 -0
- package/src/commands/submodule-update-command.ts +1092 -0
- package/src/commands/switch-command.ts +3 -1
- package/src/commands/tag-command.ts +876 -64
- package/src/commands/trailers.ts +837 -100
- package/src/commands/tree-restore.ts +38 -10
- package/src/commands/verify-command.ts +235 -0
- package/src/commands/worktree-add-command.ts +268 -24
- 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 +2 -1
- package/src/errors/ref-errors.ts +23 -0
- package/src/errors/worktree-errors.ts +8 -1
- package/src/git-command.ts +66 -1
- package/src/git.ts +404 -1
- package/src/remote-config/index.ts +2 -0
- package/src/remote-config/remote-config-store.ts +101 -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-output.ts +195 -30
- package/src/results/diff-pickaxe.ts +304 -0
- package/src/results/diff-words.ts +395 -0
- package/src/results/index.ts +4 -0
- package/src/results/push-result.ts +7 -0
- package/src/results/rebase-result.ts +3 -0
- package/src/results/stash-result.ts +7 -0
- 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
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `%(atom)` table of git's ref-filter.c: each atom's name, what it reads (the ref alone,
|
|
3
|
+
* the object, or something else), how it sorts, and its argument parser with git's errors.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { RefFilterError } from "../../errors/index.js";
|
|
9
|
+
import { expandStringArg, matchArgValue, matchBoolArg, parseColorSpec } from "../pretty-format.js";
|
|
10
|
+
import type { TrailerFormatOptions } from "../trailers.js";
|
|
11
|
+
|
|
12
|
+
/** ref-filter.c's info_source: what an atom reads. */
|
|
13
|
+
export type AtomSource = "none" | "obj" | "other";
|
|
14
|
+
/** ref-filter.c's cmp_type: how a sort key compares. */
|
|
15
|
+
export type AtomCmpType = "str" | "ulong" | "time";
|
|
16
|
+
|
|
17
|
+
/** The atoms git knows (ref-filter.c's `valid_atom`), in its table order. */
|
|
18
|
+
export const ATOM_NAMES = [
|
|
19
|
+
"refname",
|
|
20
|
+
"objecttype",
|
|
21
|
+
"objectsize",
|
|
22
|
+
"objectname",
|
|
23
|
+
"deltabase",
|
|
24
|
+
"tree",
|
|
25
|
+
"parent",
|
|
26
|
+
"numparent",
|
|
27
|
+
"object",
|
|
28
|
+
"type",
|
|
29
|
+
"tag",
|
|
30
|
+
"author",
|
|
31
|
+
"authorname",
|
|
32
|
+
"authoremail",
|
|
33
|
+
"authordate",
|
|
34
|
+
"committer",
|
|
35
|
+
"committername",
|
|
36
|
+
"committeremail",
|
|
37
|
+
"committerdate",
|
|
38
|
+
"tagger",
|
|
39
|
+
"taggername",
|
|
40
|
+
"taggeremail",
|
|
41
|
+
"taggerdate",
|
|
42
|
+
"creator",
|
|
43
|
+
"creatordate",
|
|
44
|
+
"describe",
|
|
45
|
+
"subject",
|
|
46
|
+
"body",
|
|
47
|
+
"trailers",
|
|
48
|
+
"contents",
|
|
49
|
+
"signature",
|
|
50
|
+
"raw",
|
|
51
|
+
"upstream",
|
|
52
|
+
"push",
|
|
53
|
+
"symref",
|
|
54
|
+
"flag",
|
|
55
|
+
"HEAD",
|
|
56
|
+
"color",
|
|
57
|
+
"worktreepath",
|
|
58
|
+
"align",
|
|
59
|
+
"end",
|
|
60
|
+
"if",
|
|
61
|
+
"then",
|
|
62
|
+
"else",
|
|
63
|
+
"rest",
|
|
64
|
+
"ahead-behind",
|
|
65
|
+
"is-base",
|
|
66
|
+
] as const;
|
|
67
|
+
|
|
68
|
+
/** An atom's kind (git's `enum atom_type`). */
|
|
69
|
+
export type AtomType = (typeof ATOM_NAMES)[number];
|
|
70
|
+
|
|
71
|
+
const SOURCES: Partial<Record<AtomType, AtomSource>> = {
|
|
72
|
+
objecttype: "other",
|
|
73
|
+
objectsize: "other",
|
|
74
|
+
objectname: "other",
|
|
75
|
+
deltabase: "other",
|
|
76
|
+
"ahead-behind": "other",
|
|
77
|
+
"is-base": "other",
|
|
78
|
+
};
|
|
79
|
+
const OBJ_ATOMS = new Set<AtomType>([
|
|
80
|
+
"tree",
|
|
81
|
+
"parent",
|
|
82
|
+
"numparent",
|
|
83
|
+
"object",
|
|
84
|
+
"type",
|
|
85
|
+
"tag",
|
|
86
|
+
"author",
|
|
87
|
+
"authorname",
|
|
88
|
+
"authoremail",
|
|
89
|
+
"authordate",
|
|
90
|
+
"committer",
|
|
91
|
+
"committername",
|
|
92
|
+
"committeremail",
|
|
93
|
+
"committerdate",
|
|
94
|
+
"tagger",
|
|
95
|
+
"taggername",
|
|
96
|
+
"taggeremail",
|
|
97
|
+
"taggerdate",
|
|
98
|
+
"creator",
|
|
99
|
+
"creatordate",
|
|
100
|
+
"describe",
|
|
101
|
+
"subject",
|
|
102
|
+
"body",
|
|
103
|
+
"trailers",
|
|
104
|
+
"contents",
|
|
105
|
+
"signature",
|
|
106
|
+
"raw",
|
|
107
|
+
]);
|
|
108
|
+
const CMP_TYPES: Partial<Record<AtomType, AtomCmpType>> = {
|
|
109
|
+
objectsize: "ulong",
|
|
110
|
+
numparent: "ulong",
|
|
111
|
+
authordate: "time",
|
|
112
|
+
committerdate: "time",
|
|
113
|
+
taggerdate: "time",
|
|
114
|
+
creatordate: "time",
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/** The source of an atom (git's `valid_atom[].source`). */
|
|
118
|
+
export function atomSource(type: AtomType): AtomSource {
|
|
119
|
+
return SOURCES[type] ?? (OBJ_ATOMS.has(type) ? "obj" : "none");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** `refname`'s options (and `symref`'s, `upstream`'s, `push`'s): ref-filter.c's refname_atom. */
|
|
123
|
+
export interface RefnameOption {
|
|
124
|
+
option: "normal" | "short" | "lstrip" | "rstrip";
|
|
125
|
+
lstrip?: number;
|
|
126
|
+
rstrip?: number;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** The contents options (ref-filter.c's `C_*`). */
|
|
130
|
+
export type ContentsOption =
|
|
131
|
+
| "bare"
|
|
132
|
+
| "body"
|
|
133
|
+
| "body-dep"
|
|
134
|
+
| "length"
|
|
135
|
+
| "lines"
|
|
136
|
+
| "sig"
|
|
137
|
+
| "sub"
|
|
138
|
+
| "sub-sanitize"
|
|
139
|
+
| "trailers";
|
|
140
|
+
|
|
141
|
+
/** An atom of a format or sort key, parsed (git's `struct used_atom`). */
|
|
142
|
+
export interface UsedAtom {
|
|
143
|
+
type: AtomType;
|
|
144
|
+
/** The atom as written, `*` and arguments included */
|
|
145
|
+
name: string;
|
|
146
|
+
/** Dereferenced (`*name`): read from the object a tag peels to */
|
|
147
|
+
deref: boolean;
|
|
148
|
+
cmpType: AtomCmpType;
|
|
149
|
+
source: AtomSource;
|
|
150
|
+
refname?: RefnameOption;
|
|
151
|
+
remote?: {
|
|
152
|
+
option: "ref" | "track" | "trackshort" | "remotename" | "remoteref";
|
|
153
|
+
nobracket: boolean;
|
|
154
|
+
push: boolean;
|
|
155
|
+
pushRemote: boolean;
|
|
156
|
+
};
|
|
157
|
+
contents?: {
|
|
158
|
+
option: ContentsOption;
|
|
159
|
+
trailers?: TrailerFormatOptions;
|
|
160
|
+
lines?: number;
|
|
161
|
+
};
|
|
162
|
+
raw?: "bare" | "length";
|
|
163
|
+
oid?: { option: "full" | "short" | "length"; length?: number };
|
|
164
|
+
objectsize?: "size" | "disk";
|
|
165
|
+
nameMailmap?: boolean;
|
|
166
|
+
email?: { trim: boolean; localpart: boolean; mailmap: boolean };
|
|
167
|
+
signature?: string;
|
|
168
|
+
describe?: { tags?: boolean; abbrev?: number; match: string[]; exclude: string[] };
|
|
169
|
+
color?: string;
|
|
170
|
+
align?: { position: "left" | "middle" | "right"; width: number };
|
|
171
|
+
ifThenElse?: { cmp: "equal" | "unequal" | "none"; str?: string };
|
|
172
|
+
/** The committish of `%(ahead-behind:<x>)` / `%(is-base:<x>)` */
|
|
173
|
+
base?: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** What an atom's parser needs of the format. */
|
|
177
|
+
export interface AtomParseContext {
|
|
178
|
+
/** Whether colors are shown (`--color`): `%(color:...)` is empty otherwise */
|
|
179
|
+
useColor: boolean;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const fatal = (message: string) => new RefFilterError(`fatal: ${message}`, 128);
|
|
183
|
+
|
|
184
|
+
function atomPrefix(name: string): string {
|
|
185
|
+
const colon = name.indexOf(":");
|
|
186
|
+
return colon >= 0 ? name.slice(0, colon) : name;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const errNoArg = (name: string) => fatal(`%(${atomPrefix(name)}) does not take arguments`);
|
|
190
|
+
const errBadArg = (name: string, arg: string) =>
|
|
191
|
+
fatal(`unrecognized %(${atomPrefix(name)}) argument: ${arg}`);
|
|
192
|
+
|
|
193
|
+
/** strtol_i: a whole decimal int, else undefined. */
|
|
194
|
+
function strtolI(text: string): number | undefined {
|
|
195
|
+
if (!/^[ \t\n\v\f\r]*[+-]?\d+$/.test(text)) return undefined;
|
|
196
|
+
const n = Number.parseInt(text.trim(), 10);
|
|
197
|
+
return n >= -2147483648 && n <= 2147483647 ? n : undefined;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** strtoul_ui: a whole unsigned decimal (git takes no sign), else undefined. */
|
|
201
|
+
function strtoulUi(text: string): number | undefined {
|
|
202
|
+
if (!/^[ \t\n\v\f\r]*\+?\d+$/.test(text)) return undefined;
|
|
203
|
+
const n = Number.parseInt(text.trim(), 10);
|
|
204
|
+
return n <= 0xffffffff ? n : undefined;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function parseRefnameOption(arg: string | undefined, name: string): RefnameOption {
|
|
208
|
+
if (arg === undefined) return { option: "normal" };
|
|
209
|
+
if (arg === "short") return { option: "short" };
|
|
210
|
+
const l = /^(?:lstrip|strip)=(.*)$/s.exec(arg);
|
|
211
|
+
if (l) {
|
|
212
|
+
const n = strtolI(l[1] as string);
|
|
213
|
+
if (n === undefined) throw fatal(`Integer value expected refname:lstrip=${l[1]}`);
|
|
214
|
+
return { option: "lstrip", lstrip: n };
|
|
215
|
+
}
|
|
216
|
+
const r = /^rstrip=(.*)$/s.exec(arg);
|
|
217
|
+
if (r) {
|
|
218
|
+
const n = strtolI(r[1] as string);
|
|
219
|
+
if (n === undefined) throw fatal(`Integer value expected refname:rstrip=${r[1]}`);
|
|
220
|
+
return { option: "rstrip", rstrip: n };
|
|
221
|
+
}
|
|
222
|
+
throw errBadArg(name, arg);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* ref-filter.c's match_atom_arg_value: `candidate` or `candidate=value` at the start of
|
|
227
|
+
* `text` (values end at the next comma); the rest after the comma.
|
|
228
|
+
*/
|
|
229
|
+
function matchAtomArgValue(
|
|
230
|
+
text: string,
|
|
231
|
+
candidate: string,
|
|
232
|
+
): { value: string | undefined; rest: string } | undefined {
|
|
233
|
+
if (!text.startsWith(candidate)) return undefined;
|
|
234
|
+
const after = text.slice(candidate.length);
|
|
235
|
+
let value: string | undefined;
|
|
236
|
+
let tail: string;
|
|
237
|
+
if (after.startsWith("=")) {
|
|
238
|
+
const comma = after.indexOf(",", 1);
|
|
239
|
+
value = comma >= 0 ? after.slice(1, comma) : after.slice(1);
|
|
240
|
+
tail = comma >= 0 ? after.slice(comma) : "";
|
|
241
|
+
} else if (after !== "" && !after.startsWith(",")) return undefined;
|
|
242
|
+
else tail = after;
|
|
243
|
+
return { value, rest: tail.startsWith(",") ? tail.slice(1) : tail };
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function parseBoolValue(value: string): boolean | undefined {
|
|
247
|
+
const v = value.toLowerCase();
|
|
248
|
+
if (v === "true" || v === "yes" || v === "on") return true;
|
|
249
|
+
if (v === "false" || v === "no" || v === "off" || v === "") return false;
|
|
250
|
+
const n = /^([+-]?\d+)([kmg]?)$/.exec(v);
|
|
251
|
+
return n ? Number(n[1]) !== 0 : undefined;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** format_set_trailers_options over `arg` (git appends the `)` the atom ended with). */
|
|
255
|
+
function parseTrailersOptions(arg: string): TrailerFormatOptions {
|
|
256
|
+
const fmt = `${arg})`;
|
|
257
|
+
const options: TrailerFormatOptions & { keys?: string[] } = {};
|
|
258
|
+
let i = 0;
|
|
259
|
+
for (;;) {
|
|
260
|
+
if (fmt[i] === ")") break;
|
|
261
|
+
const key = matchArgValue(fmt, i, "key");
|
|
262
|
+
if (key) {
|
|
263
|
+
if (key.value === undefined) throw fatal("expected %(trailers:key=<value>)");
|
|
264
|
+
options.keys = [...(options.keys ?? []), key.value];
|
|
265
|
+
options.onlyTrailers = true;
|
|
266
|
+
i = key.end;
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const separator = matchArgValue(fmt, i, "separator");
|
|
270
|
+
if (separator) {
|
|
271
|
+
options.separator = expandStringArg(separator.value ?? "");
|
|
272
|
+
i = separator.end;
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
const kv = matchArgValue(fmt, i, "key_value_separator");
|
|
276
|
+
if (kv) {
|
|
277
|
+
options.keyValueSeparator = expandStringArg(kv.value ?? "");
|
|
278
|
+
i = kv.end;
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
const flag = (
|
|
282
|
+
[
|
|
283
|
+
["only", "onlyTrailers"],
|
|
284
|
+
["unfold", "unfold"],
|
|
285
|
+
["keyonly", "keyOnly"],
|
|
286
|
+
["valueonly", "valueOnly"],
|
|
287
|
+
] as const
|
|
288
|
+
).find(([n]) => matchBoolArg(fmt, i, n));
|
|
289
|
+
if (!flag) {
|
|
290
|
+
const rest = fmt.slice(i);
|
|
291
|
+
const end = rest.search(/[,)]/);
|
|
292
|
+
throw fatal(`unknown %(trailers) argument: ${end >= 0 ? rest.slice(0, end) : rest}`);
|
|
293
|
+
}
|
|
294
|
+
const parsed = matchBoolArg(fmt, i, flag[0]) as { value: boolean; end: number };
|
|
295
|
+
options[flag[1]] = parsed.value;
|
|
296
|
+
i = parsed.end;
|
|
297
|
+
}
|
|
298
|
+
return options;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function parseAlign(arg: string | undefined): NonNullable<UsedAtom["align"]> {
|
|
302
|
+
if (arg === undefined) throw fatal("expected format: %(align:<width>,<position>)");
|
|
303
|
+
const positionOf = (s: string) =>
|
|
304
|
+
s === "right" || s === "middle" || s === "left" ? s : undefined;
|
|
305
|
+
let position: "left" | "middle" | "right" = "left";
|
|
306
|
+
let width: number | undefined;
|
|
307
|
+
for (const s of arg.split(",")) {
|
|
308
|
+
if (s.startsWith("position=")) {
|
|
309
|
+
const p = positionOf(s.slice(9));
|
|
310
|
+
if (!p) throw fatal(`unrecognized position:${s.slice(9)}`);
|
|
311
|
+
position = p;
|
|
312
|
+
} else if (s.startsWith("width=")) {
|
|
313
|
+
const w = strtoulUi(s.slice(6));
|
|
314
|
+
if (w === undefined) throw fatal(`unrecognized width:${s.slice(6)}`);
|
|
315
|
+
width = w;
|
|
316
|
+
} else if (strtoulUi(s) !== undefined) {
|
|
317
|
+
width = strtoulUi(s);
|
|
318
|
+
} else if (positionOf(s)) position = positionOf(s) as typeof position;
|
|
319
|
+
else throw fatal(`unrecognized %(align) argument: ${s}`);
|
|
320
|
+
}
|
|
321
|
+
if (width === undefined || width === 0xffffffff) {
|
|
322
|
+
throw fatal("positive width expected with the %(align) atom");
|
|
323
|
+
}
|
|
324
|
+
return { position, width };
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function parseDescribe(arg: string | undefined): NonNullable<UsedAtom["describe"]> {
|
|
328
|
+
const out: NonNullable<UsedAtom["describe"]> = { match: [], exclude: [] };
|
|
329
|
+
let rest = arg ?? "";
|
|
330
|
+
while (rest !== "") {
|
|
331
|
+
const bad = rest;
|
|
332
|
+
const tags = matchAtomArgValue(rest, "tags");
|
|
333
|
+
if (tags && (tags.value === undefined || parseBoolValue(tags.value) !== undefined)) {
|
|
334
|
+
out.tags = tags.value === undefined ? true : (parseBoolValue(tags.value) as boolean);
|
|
335
|
+
rest = tags.rest;
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
const abbrev = matchAtomArgValue(rest, "abbrev");
|
|
339
|
+
if (abbrev) {
|
|
340
|
+
const v = abbrev.value ?? "";
|
|
341
|
+
if (!v) throw fatal("argument expected for describe:abbrev");
|
|
342
|
+
const lead = /^[ \t\n\v\f\r]*[+-]?\d*/.exec(v)?.[0] ?? "";
|
|
343
|
+
const n = Number.parseInt(lead.trim(), 10);
|
|
344
|
+
if (n < 0) throw fatal(`positive value expected describe:abbrev=${v}`);
|
|
345
|
+
if (lead.length !== v.length || !/\d/.test(lead)) {
|
|
346
|
+
throw fatal(`cannot fully parse describe:abbrev=${v}`);
|
|
347
|
+
}
|
|
348
|
+
out.abbrev = n;
|
|
349
|
+
rest = abbrev.rest;
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
const match = matchAtomArgValue(rest, "match");
|
|
353
|
+
if (match) {
|
|
354
|
+
if (!match.value) throw fatal("value expected describe:match=");
|
|
355
|
+
out.match.push(match.value);
|
|
356
|
+
rest = match.rest;
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
const exclude = matchAtomArgValue(rest, "exclude");
|
|
360
|
+
if (exclude) {
|
|
361
|
+
if (!exclude.value) throw fatal("value expected describe:exclude=");
|
|
362
|
+
out.exclude.push(exclude.value);
|
|
363
|
+
rest = exclude.rest;
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
throw errBadArg("describe", bad);
|
|
367
|
+
}
|
|
368
|
+
return out;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* ref-filter.c's parse_ref_filter_atom for one atom (`text` is what stands between `%(` and
|
|
373
|
+
* `)`, the `*` included): the atom, or git's die message as a {@link RefFilterError}.
|
|
374
|
+
*/
|
|
375
|
+
export function parseAtom(text: string, context: AtomParseContext): UsedAtom {
|
|
376
|
+
const deref = text.startsWith("*");
|
|
377
|
+
const sp = deref ? text.slice(1) : text;
|
|
378
|
+
if (sp === "") throw fatal(`malformed field name: ${text}`);
|
|
379
|
+
const colon = sp.indexOf(":");
|
|
380
|
+
const atomName = colon >= 0 ? sp.slice(0, colon) : sp;
|
|
381
|
+
const type = (ATOM_NAMES as readonly string[]).includes(atomName)
|
|
382
|
+
? (atomName as AtomType)
|
|
383
|
+
: undefined;
|
|
384
|
+
if (!type) throw fatal(`unknown field name: ${text}`);
|
|
385
|
+
// "%(atom:)" is "%(atom)"
|
|
386
|
+
let arg = colon >= 0 ? sp.slice(colon + 1) : undefined;
|
|
387
|
+
if (arg === "") arg = undefined;
|
|
388
|
+
const atom: UsedAtom = {
|
|
389
|
+
type,
|
|
390
|
+
name: text,
|
|
391
|
+
deref,
|
|
392
|
+
cmpType: CMP_TYPES[type] ?? "str",
|
|
393
|
+
source: atomSource(type),
|
|
394
|
+
};
|
|
395
|
+
switch (type) {
|
|
396
|
+
case "refname":
|
|
397
|
+
case "symref":
|
|
398
|
+
atom.refname = parseRefnameOption(arg, text);
|
|
399
|
+
break;
|
|
400
|
+
case "upstream":
|
|
401
|
+
case "push": {
|
|
402
|
+
const push = type === "push";
|
|
403
|
+
atom.remote = { option: "ref", nobracket: false, push, pushRemote: false };
|
|
404
|
+
if (arg === undefined) {
|
|
405
|
+
atom.refname = { option: "normal" };
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
atom.refname = { option: "normal" };
|
|
409
|
+
for (const s of arg.split(",")) {
|
|
410
|
+
if (s === "track") atom.remote.option = "track";
|
|
411
|
+
else if (s === "trackshort") atom.remote.option = "trackshort";
|
|
412
|
+
else if (s === "nobracket") atom.remote.nobracket = true;
|
|
413
|
+
else if (s === "remotename") {
|
|
414
|
+
atom.remote.option = "remotename";
|
|
415
|
+
atom.remote.pushRemote = true;
|
|
416
|
+
} else if (s === "remoteref") {
|
|
417
|
+
atom.remote.option = "remoteref";
|
|
418
|
+
atom.remote.pushRemote = true;
|
|
419
|
+
} else {
|
|
420
|
+
atom.remote.option = "ref";
|
|
421
|
+
// git parses the whole argument, not the item
|
|
422
|
+
atom.refname = parseRefnameOption(arg, text);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
case "objecttype":
|
|
428
|
+
if (arg !== undefined) throw errNoArg("objecttype");
|
|
429
|
+
break;
|
|
430
|
+
case "objectsize":
|
|
431
|
+
if (arg === undefined) atom.objectsize = "size";
|
|
432
|
+
else if (arg === "disk") atom.objectsize = "disk";
|
|
433
|
+
else throw errBadArg("objectsize", arg);
|
|
434
|
+
break;
|
|
435
|
+
case "deltabase":
|
|
436
|
+
if (arg !== undefined) throw errNoArg("deltabase");
|
|
437
|
+
break;
|
|
438
|
+
case "body":
|
|
439
|
+
if (arg !== undefined) throw errNoArg("body");
|
|
440
|
+
atom.contents = { option: "body-dep" };
|
|
441
|
+
break;
|
|
442
|
+
case "subject":
|
|
443
|
+
if (arg === undefined) atom.contents = { option: "sub" };
|
|
444
|
+
else if (arg === "sanitize") atom.contents = { option: "sub-sanitize" };
|
|
445
|
+
else throw errBadArg("subject", arg);
|
|
446
|
+
break;
|
|
447
|
+
case "signature": {
|
|
448
|
+
const options = [
|
|
449
|
+
"signer",
|
|
450
|
+
"grade",
|
|
451
|
+
"key",
|
|
452
|
+
"fingerprint",
|
|
453
|
+
"primarykeyfingerprint",
|
|
454
|
+
"trustlevel",
|
|
455
|
+
];
|
|
456
|
+
if (arg !== undefined && !options.includes(arg)) throw errBadArg("signature", arg);
|
|
457
|
+
atom.signature = arg ?? "";
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
case "trailers":
|
|
461
|
+
atom.contents = {
|
|
462
|
+
option: "trailers",
|
|
463
|
+
trailers: arg === undefined ? {} : parseTrailersOptions(arg),
|
|
464
|
+
};
|
|
465
|
+
break;
|
|
466
|
+
case "contents":
|
|
467
|
+
if (arg === undefined) atom.contents = { option: "bare" };
|
|
468
|
+
else if (arg === "body") atom.contents = { option: "body" };
|
|
469
|
+
else if (arg === "size") {
|
|
470
|
+
atom.cmpType = "ulong";
|
|
471
|
+
atom.contents = { option: "length" };
|
|
472
|
+
} else if (arg === "signature") atom.contents = { option: "sig" };
|
|
473
|
+
else if (arg === "subject") atom.contents = { option: "sub" };
|
|
474
|
+
else if (arg === "trailers") atom.contents = { option: "trailers", trailers: {} };
|
|
475
|
+
else if (arg.startsWith("trailers:")) {
|
|
476
|
+
atom.contents = { option: "trailers", trailers: parseTrailersOptions(arg.slice(9)) };
|
|
477
|
+
} else if (arg.startsWith("lines=")) {
|
|
478
|
+
const n = strtoulUi(arg.slice(6));
|
|
479
|
+
if (n === undefined) throw fatal(`positive value expected contents:lines=${arg.slice(6)}`);
|
|
480
|
+
atom.contents = { option: "lines", lines: n };
|
|
481
|
+
} else throw errBadArg("contents", arg);
|
|
482
|
+
break;
|
|
483
|
+
case "describe":
|
|
484
|
+
atom.describe = parseDescribe(arg);
|
|
485
|
+
break;
|
|
486
|
+
case "raw":
|
|
487
|
+
if (arg === undefined) atom.raw = "bare";
|
|
488
|
+
else if (arg === "size") {
|
|
489
|
+
atom.cmpType = "ulong";
|
|
490
|
+
atom.raw = "length";
|
|
491
|
+
} else throw errBadArg("raw", arg);
|
|
492
|
+
break;
|
|
493
|
+
case "objectname":
|
|
494
|
+
case "tree":
|
|
495
|
+
case "parent":
|
|
496
|
+
if (arg === undefined) atom.oid = { option: "full" };
|
|
497
|
+
else if (arg === "short") atom.oid = { option: "short" };
|
|
498
|
+
else if (arg.startsWith("short=")) {
|
|
499
|
+
const n = strtoulUi(arg.slice(6));
|
|
500
|
+
if (n === undefined || n === 0) {
|
|
501
|
+
throw fatal(`positive value expected '${arg.slice(6)}' in %(${text})`);
|
|
502
|
+
}
|
|
503
|
+
atom.oid = { option: "length", length: Math.max(n, 4) };
|
|
504
|
+
} else throw errBadArg(text, arg);
|
|
505
|
+
break;
|
|
506
|
+
case "authorname":
|
|
507
|
+
case "committername":
|
|
508
|
+
case "taggername":
|
|
509
|
+
if (arg === undefined) atom.nameMailmap = false;
|
|
510
|
+
else if (arg === "mailmap") atom.nameMailmap = true;
|
|
511
|
+
else throw errBadArg(text, arg);
|
|
512
|
+
break;
|
|
513
|
+
case "authoremail":
|
|
514
|
+
case "committeremail":
|
|
515
|
+
case "taggeremail": {
|
|
516
|
+
const email = { trim: false, localpart: false, mailmap: false };
|
|
517
|
+
let rest = arg;
|
|
518
|
+
for (;;) {
|
|
519
|
+
if (rest === undefined) break;
|
|
520
|
+
const bad = rest;
|
|
521
|
+
if (rest.startsWith("trim")) {
|
|
522
|
+
email.trim = true;
|
|
523
|
+
rest = rest.slice(4);
|
|
524
|
+
} else if (rest.startsWith("localpart")) {
|
|
525
|
+
email.localpart = true;
|
|
526
|
+
rest = rest.slice(9);
|
|
527
|
+
} else if (rest.startsWith("mailmap")) {
|
|
528
|
+
email.mailmap = true;
|
|
529
|
+
rest = rest.slice(7);
|
|
530
|
+
} else throw errBadArg(text, bad);
|
|
531
|
+
if (rest === "") break;
|
|
532
|
+
if (rest.startsWith(",")) rest = rest.slice(1);
|
|
533
|
+
else throw errBadArg(text, rest);
|
|
534
|
+
}
|
|
535
|
+
atom.email = email;
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
case "align":
|
|
539
|
+
atom.align = parseAlign(arg);
|
|
540
|
+
break;
|
|
541
|
+
case "if":
|
|
542
|
+
if (arg === undefined) atom.ifThenElse = { cmp: "none" };
|
|
543
|
+
else if (arg.startsWith("equals=")) atom.ifThenElse = { cmp: "equal", str: arg.slice(7) };
|
|
544
|
+
else if (arg.startsWith("notequals=")) {
|
|
545
|
+
atom.ifThenElse = { cmp: "unequal", str: arg.slice(10) };
|
|
546
|
+
} else throw errBadArg("if", arg);
|
|
547
|
+
break;
|
|
548
|
+
case "rest":
|
|
549
|
+
if (arg !== undefined) throw errNoArg("rest");
|
|
550
|
+
break;
|
|
551
|
+
case "HEAD":
|
|
552
|
+
if (arg !== undefined) throw errNoArg("HEAD");
|
|
553
|
+
break;
|
|
554
|
+
case "color": {
|
|
555
|
+
if (arg === undefined) throw fatal("expected format: %(color:<color>)");
|
|
556
|
+
let color: string;
|
|
557
|
+
try {
|
|
558
|
+
color = parseColorSpec(arg);
|
|
559
|
+
} catch {
|
|
560
|
+
throw new RefFilterError(
|
|
561
|
+
`error: invalid color value: ${arg}\nfatal: unrecognized color: %(color:${arg})`,
|
|
562
|
+
128,
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
atom.color = context.useColor ? color : "";
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
case "ahead-behind":
|
|
569
|
+
if (arg === undefined) throw fatal("expected format: %(ahead-behind:<committish>)");
|
|
570
|
+
atom.base = arg;
|
|
571
|
+
break;
|
|
572
|
+
case "is-base":
|
|
573
|
+
if (arg === undefined) throw fatal("expected format: %(is-base:<committish>)");
|
|
574
|
+
atom.base = arg;
|
|
575
|
+
break;
|
|
576
|
+
default:
|
|
577
|
+
// atoms without a parser take any argument
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
return atom;
|
|
581
|
+
}
|