@statewalker/vcs-commands 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -8
- package/dist/commands/add-command.d.ts +265 -34
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/add-interactive.d.ts +46 -0
- package/dist/commands/add-patch/add-interactive.d.ts.map +1 -0
- package/dist/commands/add-patch/add-patch.d.ts +139 -0
- package/dist/commands/add-patch/add-patch.d.ts.map +1 -0
- package/dist/commands/add-patch/index.d.ts +6 -0
- package/dist/commands/add-patch/index.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-backend.d.ts +80 -0
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-modes.d.ts +71 -0
- package/dist/commands/add-patch/patch-modes.d.ts.map +1 -0
- package/dist/commands/add-patch/patch-session.d.ts +49 -0
- package/dist/commands/add-patch/patch-session.d.ts.map +1 -0
- package/dist/commands/am/am-command.d.ts +175 -0
- package/dist/commands/am/am-command.d.ts.map +1 -0
- package/dist/commands/am/index.d.ts +3 -0
- package/dist/commands/am/index.d.ts.map +1 -0
- package/dist/commands/am/mailinfo.d.ts +58 -0
- package/dist/commands/am/mailinfo.d.ts.map +1 -0
- package/dist/commands/am/patch-format.d.ts +24 -0
- package/dist/commands/am/patch-format.d.ts.map +1 -0
- package/dist/commands/apply/apply-command.d.ts +153 -0
- package/dist/commands/apply/apply-command.d.ts.map +1 -0
- package/dist/commands/apply/apply-engine.d.ts +195 -0
- package/dist/commands/apply/apply-engine.d.ts.map +1 -0
- package/dist/commands/apply/apply-parse.d.ts +86 -0
- package/dist/commands/apply/apply-parse.d.ts.map +1 -0
- package/dist/commands/apply/apply-types.d.ts +70 -0
- package/dist/commands/apply/apply-types.d.ts.map +1 -0
- package/dist/commands/apply/index.d.ts +6 -0
- package/dist/commands/apply/index.d.ts.map +1 -0
- package/dist/commands/apply/latin1.d.ts +32 -0
- package/dist/commands/apply/latin1.d.ts.map +1 -0
- package/dist/commands/apply/whitespace.d.ts +58 -0
- package/dist/commands/apply/whitespace.d.ts.map +1 -0
- package/dist/commands/attributes-source.d.ts +26 -0
- package/dist/commands/attributes-source.d.ts.map +1 -0
- package/dist/commands/backfill-command.d.ts +110 -0
- package/dist/commands/backfill-command.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-checkout.d.ts +64 -0
- package/dist/commands/bisect/bisect-checkout.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-command.d.ts +201 -0
- package/dist/commands/bisect/bisect-command.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-engine.d.ts +219 -0
- package/dist/commands/bisect/bisect-engine.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-graph.d.ts +127 -0
- package/dist/commands/bisect/bisect-graph.d.ts.map +1 -0
- package/dist/commands/bisect/bisect-quote.d.ts +27 -0
- package/dist/commands/bisect/bisect-quote.d.ts.map +1 -0
- package/dist/commands/bisect/index.d.ts +5 -0
- package/dist/commands/bisect/index.d.ts.map +1 -0
- package/dist/commands/blame-command.d.ts +122 -131
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/branch-command.d.ts +52 -2
- package/dist/commands/branch-command.d.ts.map +1 -1
- package/dist/commands/branch-tracking.d.ts +98 -0
- package/dist/commands/branch-tracking.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts +300 -18
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-paths.d.ts +124 -0
- package/dist/commands/checkout-paths.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +50 -42
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +49 -16
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clone-command.d.ts +134 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/comment-char-config.d.ts +35 -0
- package/dist/commands/comment-char-config.d.ts.map +1 -0
- package/dist/commands/commit-command.d.ts +311 -17
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/core-config.d.ts +78 -1
- package/dist/commands/core-config.d.ts.map +1 -1
- package/dist/commands/date-format.d.ts +58 -0
- package/dist/commands/date-format.d.ts.map +1 -0
- package/dist/commands/default-branch.d.ts +70 -0
- package/dist/commands/default-branch.d.ts.map +1 -0
- package/dist/commands/describe-command.d.ts.map +1 -1
- package/dist/commands/diff-command.d.ts +377 -30
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/diff-textconv.d.ts +40 -0
- package/dist/commands/diff-textconv.d.ts.map +1 -0
- package/dist/commands/fetch-command.d.ts +149 -10
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/format-patch-command.d.ts +164 -0
- package/dist/commands/format-patch-command.d.ts.map +1 -0
- package/dist/commands/fsck/fetch-fsck.d.ts +60 -0
- package/dist/commands/fsck/fetch-fsck.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-command.d.ts +227 -0
- package/dist/commands/fsck/fsck-command.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-loose.d.ts +71 -0
- package/dist/commands/fsck/fsck-loose.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-msg-ids.d.ts +122 -0
- package/dist/commands/fsck/fsck-msg-ids.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-object-checks.d.ts +159 -0
- package/dist/commands/fsck/fsck-object-checks.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-object-table.d.ts +140 -0
- package/dist/commands/fsck/fsck-object-table.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-pack.d.ts +122 -0
- package/dist/commands/fsck/fsck-pack.d.ts.map +1 -0
- package/dist/commands/fsck/index.d.ts +6 -0
- package/dist/commands/fsck/index.d.ts.map +1 -0
- package/dist/commands/fsck/verify-pack-command.d.ts +81 -0
- package/dist/commands/fsck/verify-pack-command.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +106 -39
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-date.d.ts +2 -0
- package/dist/commands/git-date.d.ts.map +1 -0
- package/dist/commands/git-describe.d.ts +67 -0
- package/dist/commands/git-describe.d.ts.map +1 -0
- package/dist/commands/git-hooks.d.ts +424 -0
- package/dist/commands/git-hooks.d.ts.map +1 -0
- package/dist/commands/git-ident.d.ts +128 -0
- package/dist/commands/git-ident.d.ts.map +1 -0
- package/dist/commands/hook-command.d.ts +96 -0
- package/dist/commands/hook-command.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +233 -0
- package/dist/commands/index-adder.d.ts.map +1 -0
- package/dist/commands/index-host.d.ts +86 -0
- package/dist/commands/index-host.d.ts.map +1 -0
- package/dist/commands/index.d.ts +56 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -2
- package/dist/commands/init-command.d.ts +62 -4
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/legacy-remotes.d.ts +55 -0
- package/dist/commands/legacy-remotes.d.ts.map +1 -0
- package/dist/commands/local-clone.d.ts +60 -0
- package/dist/commands/local-clone.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts +117 -0
- package/dist/commands/local-transport.d.ts.map +1 -0
- package/dist/commands/log-command.d.ts +216 -24
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +120 -0
- package/dist/commands/log-graph.d.ts.map +1 -0
- package/dist/commands/log-output.d.ts +323 -0
- package/dist/commands/log-output.d.ts.map +1 -0
- package/dist/commands/ls-remote-command.d.ts +23 -7
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/mailmap.d.ts +31 -0
- package/dist/commands/mailmap.d.ts.map +1 -0
- package/dist/commands/merge-bases.d.ts +85 -0
- package/dist/commands/merge-bases.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +221 -74
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-config.d.ts +13 -0
- package/dist/commands/merge-config.d.ts.map +1 -0
- package/dist/commands/merge-drivers.d.ts +130 -0
- package/dist/commands/merge-drivers.d.ts.map +1 -0
- package/dist/commands/merge-support.d.ts +260 -0
- package/dist/commands/merge-support.d.ts.map +1 -0
- package/dist/commands/message-cleanup.d.ts +86 -0
- package/dist/commands/message-cleanup.d.ts.map +1 -0
- package/dist/commands/mv-command.d.ts +94 -0
- package/dist/commands/mv-command.d.ts.map +1 -0
- package/dist/commands/notes-command.d.ts +256 -0
- package/dist/commands/notes-command.d.ts.map +1 -0
- package/dist/commands/notes-commands.d.ts +41 -0
- package/dist/commands/notes-commands.d.ts.map +1 -0
- package/dist/commands/notes-merge-command.d.ts +105 -0
- package/dist/commands/notes-merge-command.d.ts.map +1 -0
- package/dist/commands/notes-support.d.ts +125 -0
- package/dist/commands/notes-support.d.ts.map +1 -0
- package/dist/commands/notes-tree.d.ts +116 -0
- package/dist/commands/notes-tree.d.ts.map +1 -0
- package/dist/commands/object-id-input.d.ts +20 -0
- package/dist/commands/object-id-input.d.ts.map +1 -0
- package/dist/commands/octopus-merge.d.ts +59 -0
- package/dist/commands/octopus-merge.d.ts.map +1 -0
- package/dist/commands/ort-merge.d.ts +126 -0
- package/dist/commands/ort-merge.d.ts.map +1 -0
- package/dist/commands/ort-recursive.d.ts +53 -0
- package/dist/commands/ort-recursive.d.ts.map +1 -0
- package/dist/commands/pack-refs-command.d.ts +20 -0
- package/dist/commands/pack-refs-command.d.ts.map +1 -1
- package/dist/commands/patch-id.d.ts +44 -0
- package/dist/commands/patch-id.d.ts.map +1 -0
- package/dist/commands/pathspec-attributes.d.ts +64 -0
- package/dist/commands/pathspec-attributes.d.ts.map +1 -0
- package/dist/commands/pathspec.d.ts +324 -0
- package/dist/commands/pathspec.d.ts.map +1 -0
- package/dist/commands/post-index-change.d.ts +33 -0
- package/dist/commands/post-index-change.d.ts.map +1 -0
- package/dist/commands/pretty-format.d.ts +222 -0
- package/dist/commands/pretty-format.d.ts.map +1 -0
- package/dist/commands/promisor-remote.d.ts +80 -0
- package/dist/commands/promisor-remote.d.ts.map +1 -0
- package/dist/commands/pull-command.d.ts +59 -8
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +24 -8
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/read-tree-command.d.ts +112 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -0
- package/dist/commands/rebase-command.d.ts +507 -75
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/rebase-todo.d.ts +130 -0
- package/dist/commands/rebase-todo.d.ts.map +1 -0
- package/dist/commands/ref-decoration-filter.d.ts +53 -0
- package/dist/commands/ref-decoration-filter.d.ts.map +1 -0
- package/dist/commands/reflog-messages.d.ts +98 -0
- package/dist/commands/reflog-messages.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +31 -0
- package/dist/commands/remote-command.d.ts.map +1 -1
- package/dist/commands/remote-transport.d.ts +120 -0
- package/dist/commands/remote-transport.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +161 -7
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +103 -0
- package/dist/commands/restore-command.d.ts.map +1 -0
- package/dist/commands/rev-list-command.d.ts +78 -0
- package/dist/commands/rev-list-command.d.ts.map +1 -0
- package/dist/commands/rev-parse-command.d.ts +89 -0
- package/dist/commands/rev-parse-command.d.ts.map +1 -0
- package/dist/commands/revert-command.d.ts +46 -38
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-filenames.d.ts +95 -0
- package/dist/commands/revision-filenames.d.ts.map +1 -0
- package/dist/commands/revision-range.d.ts +67 -0
- package/dist/commands/revision-range.d.ts.map +1 -0
- package/dist/commands/revision-resolver.d.ts +325 -0
- package/dist/commands/revision-resolver.d.ts.map +1 -0
- package/dist/commands/rm-command.d.ts +69 -7
- package/dist/commands/rm-command.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +191 -0
- package/dist/commands/sequencer-pick.d.ts.map +1 -0
- package/dist/commands/sequencer-support.d.ts +125 -0
- package/dist/commands/sequencer-support.d.ts.map +1 -0
- package/dist/commands/serve-repository.d.ts +52 -0
- package/dist/commands/serve-repository.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-command.d.ts +190 -0
- package/dist/commands/sparse-checkout-command.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-support.d.ts +268 -0
- package/dist/commands/sparse-checkout-support.d.ts.map +1 -0
- package/dist/commands/stash-apply-command.d.ts +42 -8
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-create-command.d.ts +156 -2
- package/dist/commands/stash-create-command.d.ts.map +1 -1
- package/dist/commands/stash-drop-command.d.ts +2 -0
- package/dist/commands/stash-drop-command.d.ts.map +1 -1
- package/dist/commands/stash-working-tree.d.ts +23 -0
- package/dist/commands/stash-working-tree.d.ts.map +1 -1
- package/dist/commands/status-command.d.ts +300 -15
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/status-format.d.ts +155 -0
- package/dist/commands/status-format.d.ts.map +1 -0
- package/dist/commands/status-header.d.ts +64 -0
- package/dist/commands/status-header.d.ts.map +1 -0
- package/dist/commands/strerror.d.ts +7 -0
- package/dist/commands/strerror.d.ts.map +1 -0
- package/dist/commands/submodule-config.d.ts +38 -0
- package/dist/commands/submodule-config.d.ts.map +1 -0
- package/dist/commands/submodule-summary-command.d.ts +80 -0
- package/dist/commands/submodule-summary-command.d.ts.map +1 -0
- package/dist/commands/submodule-summary.d.ts +150 -0
- package/dist/commands/submodule-summary.d.ts.map +1 -0
- package/dist/commands/switch-command.d.ts +132 -0
- package/dist/commands/switch-command.d.ts.map +1 -0
- package/dist/commands/tag-command.d.ts +23 -2
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/tracking-info.d.ts +64 -0
- package/dist/commands/tracking-info.d.ts.map +1 -0
- package/dist/commands/trailers.d.ts +73 -0
- package/dist/commands/trailers.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +85 -1
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/untracked-cache-support.d.ts +54 -0
- package/dist/commands/untracked-cache-support.d.ts.map +1 -0
- package/dist/commands/worktree-add-command.d.ts +108 -0
- package/dist/commands/worktree-add-command.d.ts.map +1 -0
- package/dist/commands/worktree-list-command.d.ts +69 -0
- package/dist/commands/worktree-list-command.d.ts.map +1 -0
- package/dist/commands/worktree-lock-command.d.ts +44 -0
- package/dist/commands/worktree-lock-command.d.ts.map +1 -0
- package/dist/commands/worktree-overwrite-checks.d.ts +146 -6
- package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
- package/dist/commands/worktree-prune-command.d.ts +48 -0
- package/dist/commands/worktree-prune-command.d.ts.map +1 -0
- package/dist/commands/worktree-remove-command.d.ts +59 -0
- package/dist/commands/worktree-remove-command.d.ts.map +1 -0
- package/dist/commands/worktree-repair-command.d.ts +35 -0
- package/dist/commands/worktree-repair-command.d.ts.map +1 -0
- package/dist/commands/worktree-support.d.ts +64 -0
- package/dist/commands/worktree-support.d.ts.map +1 -0
- package/dist/commands-DIJ91NnD.js +62225 -0
- package/dist/core-commands/add.command.impl.d.ts.map +1 -1
- package/dist/errors/add-errors.d.ts +55 -0
- package/dist/errors/add-errors.d.ts.map +1 -1
- package/dist/errors/checkout-errors.d.ts +16 -0
- package/dist/errors/checkout-errors.d.ts.map +1 -1
- package/dist/errors/command-errors.d.ts +77 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/commit-errors.d.ts +9 -0
- package/dist/errors/commit-errors.d.ts.map +1 -1
- package/dist/errors/git-api-error.d.ts +59 -2
- package/dist/errors/git-api-error.d.ts.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +354 -19
- package/dist/errors/rebase-errors.d.ts +9 -0
- package/dist/errors/rebase-errors.d.ts.map +1 -1
- package/dist/errors/ref-errors.d.ts +32 -0
- package/dist/errors/ref-errors.d.ts.map +1 -1
- package/dist/errors/transport-errors.d.ts +12 -2
- package/dist/errors/transport-errors.d.ts.map +1 -1
- package/dist/errors/worktree-errors.d.ts +35 -0
- package/dist/errors/worktree-errors.d.ts.map +1 -0
- package/dist/git-command-BGiOJ8Zk.js +7246 -0
- package/dist/git-command.d.ts +428 -32
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +315 -5
- package/dist/git.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/remote-config/index.d.ts +1 -1
- package/dist/remote-config/index.d.ts.map +1 -1
- package/dist/remote-config/remote-config-store.d.ts +167 -6
- package/dist/remote-config/remote-config-store.d.ts.map +1 -1
- package/dist/remote-config/remote-refs.d.ts +7 -3
- package/dist/remote-config/remote-refs.d.ts.map +1 -1
- package/dist/rename/detect-renames.d.ts +148 -0
- package/dist/rename/detect-renames.d.ts.map +1 -0
- package/dist/rename/git-similarity.d.ts +44 -0
- package/dist/rename/git-similarity.d.ts.map +1 -0
- package/dist/rename/index.d.ts +2 -0
- package/dist/rename/index.d.ts.map +1 -1
- package/dist/results/binary-patch.d.ts +11 -0
- package/dist/results/binary-patch.d.ts.map +1 -0
- package/dist/results/blame-format.d.ts +55 -0
- package/dist/results/blame-format.d.ts.map +1 -0
- package/dist/results/cherry-pick-result.d.ts +10 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -1
- package/dist/results/clone-result.d.ts +18 -0
- package/dist/results/clone-result.d.ts.map +1 -1
- package/dist/results/combined-diff.d.ts +77 -0
- package/dist/results/combined-diff.d.ts.map +1 -0
- package/dist/results/diff-entry.d.ts +32 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts +34 -60
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-order.d.ts +25 -0
- package/dist/results/diff-order.d.ts.map +1 -0
- package/dist/results/diff-output.d.ts +249 -0
- package/dist/results/diff-output.d.ts.map +1 -0
- package/dist/results/fetch-result.d.ts +15 -0
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.d.ts +5 -0
- package/dist/results/index.d.ts.map +1 -1
- package/dist/results/index.js +2 -252
- package/dist/results/init-result.d.ts +7 -0
- package/dist/results/init-result.d.ts.map +1 -1
- package/dist/results/merge-result.d.ts +15 -1
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/pull-result.d.ts +17 -3
- package/dist/results/pull-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +47 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/quote-path.d.ts +27 -0
- package/dist/results/quote-path.d.ts.map +1 -0
- package/dist/results/rebase-result.d.ts +28 -1
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/revert-result.d.ts +10 -0
- package/dist/results/revert-result.d.ts.map +1 -1
- package/dist/results/stash-result.d.ts +5 -0
- package/dist/results/stash-result.d.ts.map +1 -1
- package/dist/results/status-result.d.ts +60 -6
- package/dist/results/status-result.d.ts.map +1 -1
- package/dist/results-WVlBhVb1.js +2935 -0
- package/dist/transport-command.d.ts +44 -1
- package/dist/transport-command.d.ts.map +1 -1
- package/package.json +15 -11
- package/src/commands/add-command.ts +1291 -226
- package/src/commands/add-patch/add-interactive.ts +941 -0
- package/src/commands/add-patch/add-patch.ts +1169 -0
- package/src/commands/add-patch/index.ts +5 -0
- package/src/commands/add-patch/patch-backend.ts +239 -0
- package/src/commands/add-patch/patch-modes.ts +249 -0
- package/src/commands/add-patch/patch-session.ts +159 -0
- package/src/commands/am/am-command.ts +1111 -0
- package/src/commands/am/index.ts +2 -0
- package/src/commands/am/mailinfo.ts +1015 -0
- package/src/commands/am/patch-format.ts +121 -0
- package/src/commands/apply/apply-command.ts +842 -0
- package/src/commands/apply/apply-engine.ts +1602 -0
- package/src/commands/apply/apply-parse.ts +1210 -0
- package/src/commands/apply/apply-types.ts +112 -0
- package/src/commands/apply/index.ts +5 -0
- package/src/commands/apply/latin1.ts +171 -0
- package/src/commands/apply/whitespace.ts +260 -0
- package/src/commands/attributes-source.ts +96 -0
- package/src/commands/backfill-command.ts +694 -0
- package/src/commands/bisect/bisect-checkout.ts +217 -0
- package/src/commands/bisect/bisect-command.ts +788 -0
- package/src/commands/bisect/bisect-engine.ts +1080 -0
- package/src/commands/bisect/bisect-graph.ts +595 -0
- package/src/commands/bisect/bisect-quote.ts +92 -0
- package/src/commands/bisect/index.ts +4 -0
- package/src/commands/blame-command.ts +711 -986
- package/src/commands/branch-command.ts +354 -32
- package/src/commands/branch-tracking.ts +331 -0
- package/src/commands/checkout-command.ts +1290 -243
- package/src/commands/checkout-paths.ts +784 -0
- package/src/commands/cherry-pick-command.ts +156 -396
- package/src/commands/clean-command.ts +504 -156
- package/src/commands/clone-command.ts +748 -69
- package/src/commands/comment-char-config.ts +160 -0
- package/src/commands/commit-command.ts +1782 -166
- package/src/commands/core-config.ts +166 -6
- package/src/commands/date-format.ts +668 -0
- package/src/commands/default-branch.ts +196 -0
- package/src/commands/describe-command.ts +2 -0
- package/src/commands/diff-command.ts +1916 -110
- package/src/commands/diff-textconv.ts +50 -0
- package/src/commands/fetch-command.ts +622 -68
- package/src/commands/format-patch-command.ts +974 -0
- package/src/commands/fsck/fetch-fsck.ts +229 -0
- package/src/commands/fsck/fsck-command.ts +3464 -0
- package/src/commands/fsck/fsck-loose.ts +297 -0
- package/src/commands/fsck/fsck-msg-ids.ts +176 -0
- package/src/commands/fsck/fsck-object-checks.ts +1085 -0
- package/src/commands/fsck/fsck-object-table.ts +373 -0
- package/src/commands/fsck/fsck-pack.ts +634 -0
- package/src/commands/fsck/index.ts +5 -0
- package/src/commands/fsck/verify-pack-command.ts +252 -0
- package/src/commands/gc-command.ts +324 -77
- package/src/commands/git-date.ts +9 -0
- package/src/commands/git-describe.ts +316 -0
- package/src/commands/git-hooks.ts +1483 -0
- package/src/commands/git-ident.ts +344 -0
- package/src/commands/hook-command.ts +247 -0
- package/src/commands/index-adder.ts +711 -0
- package/src/commands/index-host.ts +291 -0
- package/src/commands/index.ts +84 -0
- package/src/commands/init-command.ts +194 -14
- package/src/commands/legacy-remotes.ts +224 -0
- package/src/commands/local-clone.ts +183 -0
- package/src/commands/local-transport.ts +762 -0
- package/src/commands/log-command.ts +1930 -170
- package/src/commands/log-graph.ts +671 -0
- package/src/commands/log-output.ts +1359 -0
- package/src/commands/ls-remote-command.ts +105 -58
- package/src/commands/mailmap.ts +129 -0
- package/src/commands/merge-bases.ts +296 -0
- package/src/commands/merge-command.ts +1416 -491
- package/src/commands/merge-config.ts +25 -0
- package/src/commands/merge-drivers.ts +306 -0
- package/src/commands/merge-support.ts +1219 -0
- package/src/commands/message-cleanup.ts +275 -0
- package/src/commands/mv-command.ts +976 -0
- package/src/commands/notes-command.ts +890 -0
- package/src/commands/notes-commands.ts +87 -0
- package/src/commands/notes-merge-command.ts +777 -0
- package/src/commands/notes-support.ts +402 -0
- package/src/commands/notes-tree.ts +617 -0
- package/src/commands/object-id-input.ts +27 -0
- package/src/commands/octopus-merge.ts +378 -0
- package/src/commands/ort-merge.ts +1660 -0
- package/src/commands/ort-recursive.ts +160 -0
- package/src/commands/pack-refs-command.ts +39 -22
- package/src/commands/patch-id.ts +204 -0
- package/src/commands/pathspec-attributes.ts +162 -0
- package/src/commands/pathspec.ts +1199 -0
- package/src/commands/post-index-change.ts +62 -0
- package/src/commands/pretty-format.ts +1432 -0
- package/src/commands/promisor-remote.ts +298 -0
- package/src/commands/pull-command.ts +326 -33
- package/src/commands/push-command.ts +257 -29
- package/src/commands/read-tree-command.ts +861 -0
- package/src/commands/rebase-command.ts +3820 -372
- package/src/commands/rebase-todo.ts +584 -0
- package/src/commands/ref-decoration-filter.ts +118 -0
- package/src/commands/reflog-messages.ts +177 -0
- package/src/commands/remote-command.ts +124 -23
- package/src/commands/remote-transport.ts +383 -0
- package/src/commands/reset-command.ts +821 -104
- package/src/commands/restore-command.ts +350 -0
- package/src/commands/rev-list-command.ts +167 -0
- package/src/commands/rev-parse-command.ts +299 -0
- package/src/commands/revert-command.ts +152 -399
- package/src/commands/revision-filenames.ts +254 -0
- package/src/commands/revision-range.ts +222 -0
- package/src/commands/revision-resolver.ts +1397 -0
- package/src/commands/rm-command.ts +613 -67
- package/src/commands/sequencer-pick.ts +874 -0
- package/src/commands/sequencer-support.ts +876 -0
- package/src/commands/serve-repository.ts +125 -0
- package/src/commands/sparse-checkout-command.ts +1389 -0
- package/src/commands/sparse-checkout-support.ts +793 -0
- package/src/commands/stash-apply-command.ts +376 -343
- package/src/commands/stash-create-command.ts +625 -42
- package/src/commands/stash-drop-command.ts +15 -2
- package/src/commands/stash-working-tree.ts +168 -24
- package/src/commands/status-command.ts +1326 -105
- package/src/commands/status-format.ts +775 -0
- package/src/commands/status-header.ts +332 -0
- package/src/commands/strerror.ts +29 -0
- package/src/commands/submodule-config.ts +94 -0
- package/src/commands/submodule-summary-command.ts +333 -0
- package/src/commands/submodule-summary.ts +446 -0
- package/src/commands/switch-command.ts +402 -0
- package/src/commands/tag-command.ts +129 -41
- package/src/commands/tracking-info.ts +201 -0
- package/src/commands/trailers.ts +417 -0
- package/src/commands/tree-restore.ts +204 -4
- package/src/commands/untracked-cache-support.ts +198 -0
- package/src/commands/worktree-add-command.ts +458 -0
- package/src/commands/worktree-list-command.ts +206 -0
- package/src/commands/worktree-lock-command.ts +96 -0
- package/src/commands/worktree-overwrite-checks.ts +452 -26
- package/src/commands/worktree-prune-command.ts +99 -0
- package/src/commands/worktree-remove-command.ts +186 -0
- package/src/commands/worktree-repair-command.ts +59 -0
- package/src/commands/worktree-support.ts +214 -0
- package/src/core-commands/add.command.impl.ts +8 -2
- package/src/errors/add-errors.ts +45 -0
- package/src/errors/checkout-errors.ts +26 -2
- package/src/errors/command-errors.ts +101 -1
- package/src/errors/commit-errors.ts +18 -2
- package/src/errors/git-api-error.ts +82 -2
- package/src/errors/index.ts +1 -0
- package/src/errors/merge-errors.ts +2 -2
- package/src/errors/rebase-errors.ts +12 -0
- package/src/errors/ref-errors.ts +56 -2
- package/src/errors/remote-errors.ts +2 -2
- package/src/errors/stash-errors.ts +1 -1
- package/src/errors/transport-errors.ts +20 -4
- package/src/errors/worktree-errors.ts +49 -0
- package/src/git-command.ts +1207 -118
- package/src/git.ts +538 -12
- package/src/index.ts +1 -1
- package/src/remote-config/index.ts +2 -0
- package/src/remote-config/remote-config-store.ts +378 -18
- package/src/remote-config/remote-refs.ts +22 -6
- package/src/rename/detect-renames.ts +715 -0
- package/src/rename/git-similarity.ts +116 -0
- package/src/rename/index.ts +2 -0
- package/src/results/binary-patch.ts +401 -0
- package/src/results/blame-format.ts +239 -0
- package/src/results/cherry-pick-result.ts +10 -0
- package/src/results/clone-result.ts +21 -0
- package/src/results/combined-diff.ts +585 -0
- package/src/results/diff-entry.ts +35 -0
- package/src/results/diff-formatter.ts +152 -288
- package/src/results/diff-order.ts +64 -0
- package/src/results/diff-output.ts +1053 -0
- package/src/results/fetch-result.ts +15 -0
- package/src/results/index.ts +5 -0
- package/src/results/init-result.ts +9 -0
- package/src/results/merge-result.ts +15 -1
- package/src/results/pull-result.ts +17 -3
- package/src/results/push-result.ts +48 -0
- package/src/results/quote-path.ts +103 -0
- package/src/results/rebase-result.ts +37 -0
- package/src/results/revert-result.ts +10 -0
- package/src/results/stash-result.ts +6 -0
- package/src/results/status-result.ts +127 -46
- package/src/transport-command.ts +121 -2
- package/dist/commands-CsLNyvZ1.js +0 -12587
- package/dist/status-result-BpyUK1Sg.js +0 -519
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git's hooks (githooks(5), hook.c): finding a hook as `find_hook` does and running it
|
|
3
|
+
* through the host's {@link HookRunner}.
|
|
4
|
+
*
|
|
5
|
+
* ```typescript
|
|
6
|
+
* const hooks = new HookSession(workingCopy);
|
|
7
|
+
* const result = await hooks.run("pre-commit", { env: { GIT_INDEX_FILE: ".git/index" } });
|
|
8
|
+
* if (result && result.exitCode !== 0) throw new Error("pre-commit refused the commit");
|
|
9
|
+
* hooks.output; // what the hook wrote (git relays it on stderr), and any hints
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* A hook is a file named after it in `core.hooksPath` (relative to the worktree top, the git
|
|
13
|
+
* directory when bare; `~/` the home directory) or else in `$GIT_DIR/hooks` (the common git
|
|
14
|
+
* directory of a linked worktree). It counts only when executable: a file that is not gets
|
|
15
|
+
* git's `advice.ignoredHook` hint, once per hook name. Without a runner on the host
|
|
16
|
+
* environment (`GitHostEnvironment.hookRunner`), nothing is looked up and no hook runs.
|
|
17
|
+
*
|
|
18
|
+
* Every hook runs in the worktree top (the git directory when bare) with `GIT_PREFIX` empty,
|
|
19
|
+
* as git's setup exports it, plus the variables of the call; its stdout goes to its stderr
|
|
20
|
+
* unless the call asks otherwise (`RUN_HOOKS_OPT_INIT`'s `stdout_to_stderr`).
|
|
21
|
+
*/
|
|
22
|
+
import type { RefTransactionHook } from "@statewalker/vcs-core";
|
|
23
|
+
import type { FilesApi } from "@statewalker/vcs-utils/files";
|
|
24
|
+
import { type GitHostEnvironment, type HookRunner, type WorkingCopy } from "@statewalker/vcs-working-tree";
|
|
25
|
+
/** What a hook is given beyond its name. */
|
|
26
|
+
export interface HookCallOptions {
|
|
27
|
+
/** Arguments after the script */
|
|
28
|
+
args?: string[];
|
|
29
|
+
/** What the hook reads on stdin (text is written as UTF-8) */
|
|
30
|
+
stdin?: string | Uint8Array;
|
|
31
|
+
/** Variables set for the hook (GIT_INDEX_FILE, GIT_EDITOR, ...) */
|
|
32
|
+
env?: Record<string, string>;
|
|
33
|
+
/** Keep the hook's stdout apart (default false: sent to stderr, as git's hooks) */
|
|
34
|
+
keepStdout?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The directory the hook runs in, a path of the repository's FilesApi, in place of the
|
|
37
|
+
* worktree top (git's `opt.dir`: `worktree add` runs post-checkout in the new worktree);
|
|
38
|
+
* the hook is then named by its absolute path, as git names it there
|
|
39
|
+
*/
|
|
40
|
+
dir?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether git's setup exported `GIT_PREFIX` (default true: the commands that run in a
|
|
43
|
+
* repository; `clone` and the receive side do not)
|
|
44
|
+
*/
|
|
45
|
+
prefix?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Variables the hook runs without, the host's own and the session's included (git's
|
|
48
|
+
* `opt.env` entries without a value: `worktree add` unsets `GIT_DIR` and `GIT_WORK_TREE`)
|
|
49
|
+
*/
|
|
50
|
+
unsetEnv?: string[];
|
|
51
|
+
}
|
|
52
|
+
/** What running a hook gave: its exit code and output as text. */
|
|
53
|
+
export interface HookResult {
|
|
54
|
+
exitCode: number;
|
|
55
|
+
stdout: string;
|
|
56
|
+
stderr: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A hook started by {@link HookSession.start}: its stdin and stdout, and its exit. The shape
|
|
60
|
+
* of the transport's `ProcReceiveProcess`.
|
|
61
|
+
*/
|
|
62
|
+
export interface StartedHook {
|
|
63
|
+
/** false: it takes its whole stdin before it runs (the runner has no `start`) */
|
|
64
|
+
readonly interactive: boolean;
|
|
65
|
+
write(data: Uint8Array): Promise<void>;
|
|
66
|
+
closeStdin(): Promise<void>;
|
|
67
|
+
readonly stdout: AsyncIterable<Uint8Array>;
|
|
68
|
+
closeStdout(): void;
|
|
69
|
+
/** Waits for it to exit (its stderr kept in the session's output): its exit code */
|
|
70
|
+
wait(): Promise<number>;
|
|
71
|
+
/** Stops it, where the runner can (`HookProcess.kill`) */
|
|
72
|
+
kill?(): void;
|
|
73
|
+
}
|
|
74
|
+
/** A hook found: where it is, for the runner and for git's messages. */
|
|
75
|
+
export interface FoundHook {
|
|
76
|
+
/** The path git names it by, relative to the hook's directory or absolute */
|
|
77
|
+
path: string;
|
|
78
|
+
/** Its path in the repository's FilesApi, when it lies there */
|
|
79
|
+
filesPath?: string;
|
|
80
|
+
/** Its absolute path on the host, when known */
|
|
81
|
+
hostPath?: string;
|
|
82
|
+
}
|
|
83
|
+
/** The hook runner of a working copy's host environment, if any. */
|
|
84
|
+
export declare function hookRunnerOf(workingCopy: WorkingCopy): HookRunner | undefined;
|
|
85
|
+
/** Where the repository's files are, for hooks: its FilesApi, worktree top and git dirs. */
|
|
86
|
+
export interface HookLayout {
|
|
87
|
+
files: FilesApi;
|
|
88
|
+
/** The worktree top ("" for the FilesApi root) */
|
|
89
|
+
top: string;
|
|
90
|
+
/** The git directory */
|
|
91
|
+
gitDir: string;
|
|
92
|
+
/** Where the hook runs: the worktree top, the git directory when bare */
|
|
93
|
+
cwd: string;
|
|
94
|
+
bare: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* The git directory as git exports it to hooks (`GIT_DIR`): where the worktree's `.git` is
|
|
97
|
+
* a gitfile (a linked worktree, a submodule), the real path of the git directory it names
|
|
98
|
+
* (setup.c, `read_gitfile_gently`'s `real_pathdup`); `.` in a bare repository (discovered
|
|
99
|
+
* from its top, where hooks run); absent for a `.git` directory, which git does not export
|
|
100
|
+
*/
|
|
101
|
+
gitDirEnv?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The repository a {@link HookSession} runs hooks of: where its files are, its settings and
|
|
105
|
+
* the host's environment (the runner). A working copy gives all three (see
|
|
106
|
+
* {@link hookHostOf}); the receive side of a local push gives the remote repository's.
|
|
107
|
+
*/
|
|
108
|
+
export interface HookHost {
|
|
109
|
+
layout(): Promise<HookLayout | undefined>;
|
|
110
|
+
configValue(key: string): string | undefined;
|
|
111
|
+
environment(): GitHostEnvironment | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The `hook.<name>.<variable>` settings (event, command, enabled) in the configuration's
|
|
114
|
+
* order, for git 2.5x's configured hooks; absent: none are configured
|
|
115
|
+
*/
|
|
116
|
+
hookSettings?(): HookSetting[];
|
|
117
|
+
/**
|
|
118
|
+
* Variables of the host every hook of this repository runs without unless a call sets them
|
|
119
|
+
* itself: the receive side of a local push, which git starts with `local_repo_env` cleared
|
|
120
|
+
* ({@link LOCAL_REPO_ENV}, connect.c)
|
|
121
|
+
*/
|
|
122
|
+
unsetEnv?: readonly string[];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* environment.c's `local_repo_env` (git 2.43 and 2.56): the variables naming the local
|
|
126
|
+
* repository, which connect.c removes from the environment of a receive-pack or upload-pack
|
|
127
|
+
* it starts for a local (or `ext::`, `ssh` on the same host) remote, so the remote's hooks
|
|
128
|
+
* never see the pushing repository's objects, config or index.
|
|
129
|
+
*/
|
|
130
|
+
export declare const LOCAL_REPO_ENV: readonly string[];
|
|
131
|
+
/** One `hook.<name>.<variable>` setting (git 2.5x's configured hooks). */
|
|
132
|
+
export interface HookSetting {
|
|
133
|
+
/** The hook's friendly name (`<name>`) */
|
|
134
|
+
name: string;
|
|
135
|
+
variable: "event" | "command" | "enabled";
|
|
136
|
+
/** The value as git reads it (unquoted); undefined for a variable without `=` */
|
|
137
|
+
value: string | undefined;
|
|
138
|
+
/** The file it was read from, as the host names it (absent where the config cannot tell) */
|
|
139
|
+
file?: string;
|
|
140
|
+
/** Its line in that file, from 1 */
|
|
141
|
+
line?: number;
|
|
142
|
+
/** The scope of that file (git's `config_scope_name`: `local`, `global`, ...) */
|
|
143
|
+
scope?: string;
|
|
144
|
+
}
|
|
145
|
+
/** The hook host of a working copy. */
|
|
146
|
+
export declare function hookHostOf(workingCopy: WorkingCopy): HookHost;
|
|
147
|
+
/**
|
|
148
|
+
* The `hook.<name>.<variable>` settings (event, command, enabled) among a configuration's
|
|
149
|
+
* entries in the order git reads them (an opened repository's `listWithOrigin`, else `list`
|
|
150
|
+
* without origins): the hook settings of a repository a push reaches.
|
|
151
|
+
*/
|
|
152
|
+
export declare function hookSettingsFromEntries(entries: ReadonlyArray<{
|
|
153
|
+
key: string;
|
|
154
|
+
value: string | null;
|
|
155
|
+
file?: string;
|
|
156
|
+
line?: number;
|
|
157
|
+
scope?: string;
|
|
158
|
+
}>): HookSetting[];
|
|
159
|
+
/** Whether `name` is one of git's hooks (hook.c `is_known_hook`, hook-list.h). */
|
|
160
|
+
export declare function isKnownHook(name: string): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* What git 2.5x dies with (or warns of) on reading the configured hooks, which it does on
|
|
163
|
+
* looking up any hook (hook.c `hook_config_lookup_all`, `build_hook_config_map`): a
|
|
164
|
+
* variable without `=` (`error: missing value for ...`, then git's `bad config variable`), a
|
|
165
|
+
* friendly name that is a known hook name, a name of some event with no command (unless
|
|
166
|
+
* disabled). Returns the fatal message (undefined when none) and git's warnings (a friendly
|
|
167
|
+
* name equal to its event; a disabled one without a command).
|
|
168
|
+
*/
|
|
169
|
+
export declare function hookSettingsCheck(settings: readonly HookSetting[]): {
|
|
170
|
+
fatal?: string;
|
|
171
|
+
warnings: string[];
|
|
172
|
+
};
|
|
173
|
+
/** One configured hook of an event, as git 2.5x's `list_hooks` keeps it (`git hook list`). */
|
|
174
|
+
export interface ConfiguredHookEntry {
|
|
175
|
+
/** Its friendly name (`hook.<name>`) */
|
|
176
|
+
name: string;
|
|
177
|
+
/** Its `hook.<name>.command` (absent: only a disabled hook may have none) */
|
|
178
|
+
command?: string;
|
|
179
|
+
/** `hook.<name>.enabled=false` */
|
|
180
|
+
disabled: boolean;
|
|
181
|
+
/** The whole event is disabled (`hook.<event>.enabled=false`, `<event>` no friendly name) */
|
|
182
|
+
eventDisabled: boolean;
|
|
183
|
+
/** The scope of its last event line (`local`, `global`, ...), where the config tells */
|
|
184
|
+
scope?: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* git 2.5x's configured hooks of `event` (hook.c `build_hook_config_map`,
|
|
188
|
+
* `list_hooks_add_configured`): the friendly names whose `hook.<name>.event` names it, in the
|
|
189
|
+
* order of their last such line (an empty value drops the name from every event), each with
|
|
190
|
+
* its last `hook.<name>.command`, whether `hook.<name>.enabled=false` disables it and whether
|
|
191
|
+
* the event itself is disabled (`hook.<event>.enabled=false`, `<event>` not a friendly name).
|
|
192
|
+
* Disabled ones are kept, as `git hook list` shows them; none of them runs.
|
|
193
|
+
*/
|
|
194
|
+
export declare function configuredHookEntries(settings: readonly HookSetting[], event: string): ConfiguredHookEntry[];
|
|
195
|
+
/**
|
|
196
|
+
* git 2.5x's configured hooks of `event` that run (see {@link configuredHookEntries}): those
|
|
197
|
+
* neither disabled nor of a disabled event. A name with no command is left out (git refuses
|
|
198
|
+
* to run any hook then, see {@link hookSettingsCheck}).
|
|
199
|
+
*/
|
|
200
|
+
export declare function configuredHooks(settings: readonly HookSetting[], event: string): Array<{
|
|
201
|
+
name: string;
|
|
202
|
+
command: string;
|
|
203
|
+
}>;
|
|
204
|
+
/** One hook `git hook list` lists: a configured one or the hooks directory's script. */
|
|
205
|
+
export type HookListEntry = ({
|
|
206
|
+
kind: "configured";
|
|
207
|
+
} & ConfiguredHookEntry) | {
|
|
208
|
+
kind: "traditional";
|
|
209
|
+
/** The script's path as git names it (`.git/hooks/pre-commit`) */
|
|
210
|
+
path: string;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* A file of a working copy's common git directory (`remotes/<name>`, `packed-refs`) as the
|
|
214
|
+
* repository's FilesApi names it; undefined when the working copy has no files layout.
|
|
215
|
+
*/
|
|
216
|
+
export declare function commonGitFileOf(workingCopy: WorkingCopy, name: string): Promise<{
|
|
217
|
+
files: FilesApi;
|
|
218
|
+
path: string;
|
|
219
|
+
} | undefined>;
|
|
220
|
+
/**
|
|
221
|
+
* The hooks one command runs, with git's per-process memory of the hints given and the
|
|
222
|
+
* output the hooks wrote (git relays it on its stderr, the hints included).
|
|
223
|
+
*/
|
|
224
|
+
export declare class HookSession {
|
|
225
|
+
/** The hook names whose `advice.ignoredHook` hint was given (git's `advise_given`) */
|
|
226
|
+
private readonly advised;
|
|
227
|
+
/** What the hooks wrote, and the hints, in order */
|
|
228
|
+
private readonly chunks;
|
|
229
|
+
/** What the hooks whose stdout git keeps apart (pre-push) wrote there */
|
|
230
|
+
private readonly stdoutChunks;
|
|
231
|
+
private readonly host;
|
|
232
|
+
/** Variables every hook of this session gets, below each call's own (see {@link withEnv}) */
|
|
233
|
+
private processEnv;
|
|
234
|
+
constructor(source: WorkingCopy | HookHost);
|
|
235
|
+
/**
|
|
236
|
+
* A session sharing this one's output and hints whose hooks all get `env` too (below each
|
|
237
|
+
* call's own variables): the hooks of a git command git runs as a child process with
|
|
238
|
+
* variables set, as a sequencer's `git commit` with GIT_REFLOG_ACTION.
|
|
239
|
+
*/
|
|
240
|
+
withEnv(env: Record<string, string>): HookSession;
|
|
241
|
+
private get runner();
|
|
242
|
+
/**
|
|
243
|
+
* The committer variables the host sets (`GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL`), as
|
|
244
|
+
* the host environment's `committer` gives them: what git's http-backend checks before
|
|
245
|
+
* naming the pushing user the committer of its children.
|
|
246
|
+
*/
|
|
247
|
+
get hostCommitter(): {
|
|
248
|
+
name?: string;
|
|
249
|
+
email?: string;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* The host's `GIT_ALTERNATE_OBJECT_DIRECTORIES` (the host environment's
|
|
253
|
+
* `alternateObjectDirectories`): what a quarantined pre-receive gets the repository's
|
|
254
|
+
* objects appended to, as tmp-objdir.c's `env_append` appends them.
|
|
255
|
+
*/
|
|
256
|
+
get hostAlternateObjectDirectories(): string | undefined;
|
|
257
|
+
/** Whether hooks can run at all: the host environment has a runner. */
|
|
258
|
+
get enabled(): boolean;
|
|
259
|
+
/** The runner's git version (default 2.56). */
|
|
260
|
+
get compatibility(): "2.43" | "2.56";
|
|
261
|
+
/** Everything the hooks wrote (stderr, and stdout sent there) and the hints, as git shows it. */
|
|
262
|
+
get output(): string;
|
|
263
|
+
/** What the hooks whose stdout git keeps on its own stdout wrote there (pre-push). */
|
|
264
|
+
get stdout(): string;
|
|
265
|
+
/** Text added to the output, as git writes its own messages between the hooks' output. */
|
|
266
|
+
append(text: string): void;
|
|
267
|
+
/**
|
|
268
|
+
* A file of the git directory as git names it to hooks (`git_path`): relative to the
|
|
269
|
+
* directory the hooks run in (`.git/index`, `.git/COMMIT_EDITMSG`), else absolute.
|
|
270
|
+
* `absolute` names it by its host path where there is one, as git names a lock file
|
|
271
|
+
* (lockfile.c resolves the path it locks: `index.lock` of `commit -a`).
|
|
272
|
+
*/
|
|
273
|
+
gitPath(name: string, absolute?: boolean): Promise<string>;
|
|
274
|
+
/** A file of the git directory as the repository's FilesApi names it (no layout: none). */
|
|
275
|
+
gitFile(name: string): Promise<{
|
|
276
|
+
files: FilesApi;
|
|
277
|
+
path: string;
|
|
278
|
+
} | undefined>;
|
|
279
|
+
/**
|
|
280
|
+
* A file of the repository's common directory (the main git directory of a linked
|
|
281
|
+
* worktree: `objects/`, `packed-refs`) as the repository's FilesApi names it.
|
|
282
|
+
*/
|
|
283
|
+
commonGitFile(name: string): Promise<{
|
|
284
|
+
files: FilesApi;
|
|
285
|
+
path: string;
|
|
286
|
+
} | undefined>;
|
|
287
|
+
/**
|
|
288
|
+
* A path of the repository's FilesApi as hooks are told it: its absolute host path where the
|
|
289
|
+
* files have one (as git names `GIT_QUARANTINE_PATH`), else relative to the directory the
|
|
290
|
+
* hooks run in; as given without a layout.
|
|
291
|
+
*/
|
|
292
|
+
hookPathOf(filesPath: string): Promise<string>;
|
|
293
|
+
/**
|
|
294
|
+
* The bytes of a file a git option names (`git hook run --to-stdin=<path>`): a relative
|
|
295
|
+
* path from the directory git runs in (the worktree top, the git directory when bare),
|
|
296
|
+
* through the repository's FilesApi; an absolute one through it when it lies there, else
|
|
297
|
+
* through the host. Undefined when it cannot be read.
|
|
298
|
+
*/
|
|
299
|
+
readFileAt(path: string): Promise<Uint8Array | undefined>;
|
|
300
|
+
/**
|
|
301
|
+
* The git directory's absolute host path, where the repository's files have one: its real
|
|
302
|
+
* path (symbolic links followed), as git names it after a `getcwd` (clone's GIT_DIR, the
|
|
303
|
+
* receive side's `absolute_path` in the git directory), or with `{ real: false }` as the
|
|
304
|
+
* host names it, as git's `absolute_path` of `.git` from the top keeps the logical `$PWD`
|
|
305
|
+
* (lockfile.c's "Unable to create" message).
|
|
306
|
+
*/
|
|
307
|
+
hostGitDir(options?: {
|
|
308
|
+
real?: boolean;
|
|
309
|
+
}): Promise<string | undefined>;
|
|
310
|
+
/** Whether `name` exists as an executable hook (git's `hook_exists`), giving no hint. */
|
|
311
|
+
exists(name: string): Promise<boolean>;
|
|
312
|
+
/**
|
|
313
|
+
* The hooks of `name` git runs, in order (hook.c `list_hooks`): the configured ones (git
|
|
314
|
+
* 2.5x, see {@link configuredHooks}), then the hooks directory's script ({@link find}).
|
|
315
|
+
*/
|
|
316
|
+
private list;
|
|
317
|
+
/**
|
|
318
|
+
* Every hook of `name` git 2.5x's `list_hooks` keeps, in order (`git hook list`): the
|
|
319
|
+
* configured ones, disabled ones included (see {@link configuredHookEntries}; none under
|
|
320
|
+
* 2.43), then the hooks directory's script ({@link find}, its hint given). Throws git's
|
|
321
|
+
* fatal error for a broken `hook.*` configuration.
|
|
322
|
+
*/
|
|
323
|
+
listAll(name: string): Promise<HookListEntry[]>;
|
|
324
|
+
/** Whether the configured hooks' warnings were given (git gives them once per process). */
|
|
325
|
+
private settingsChecked;
|
|
326
|
+
/**
|
|
327
|
+
* git 2.5x's checks of the configured hooks on a hook's lookup ({@link hookSettingsCheck}):
|
|
328
|
+
* its warnings once, its fatal error thrown (on every lookup, as each git process dies).
|
|
329
|
+
*/
|
|
330
|
+
private checkSettings;
|
|
331
|
+
/**
|
|
332
|
+
* The hook `name` (git's `find_hook`): undefined when absent or not executable; the latter
|
|
333
|
+
* gives the `advice.ignoredHook` hint (once per name) unless `advise` is false.
|
|
334
|
+
*/
|
|
335
|
+
find(name: string, advise?: boolean): Promise<FoundHook | undefined>;
|
|
336
|
+
/**
|
|
337
|
+
* Runs the hook `name` (git's `run_hooks_opt`): undefined when there is none (or no
|
|
338
|
+
* runner), else its exit code and output. Its output is kept in {@link output}.
|
|
339
|
+
*/
|
|
340
|
+
run(name: string, options?: HookCallOptions): Promise<HookResult | undefined>;
|
|
341
|
+
/**
|
|
342
|
+
* Starts the hook `name` found as git's `find_hook` finds it (the hooks directory's script
|
|
343
|
+
* alone: no configured hook, as receive-pack's proc-receive), its stdin and stdout piped to
|
|
344
|
+
* the caller. Undefined when there is none (or no runner). Its stderr is kept in
|
|
345
|
+
* {@link output} and handed to `onStderr` as it comes where the runner streams it (git's
|
|
346
|
+
* `copy_to_sideband`), else once it exited; either way all of it before `wait()` resolves.
|
|
347
|
+
*
|
|
348
|
+
* A runner that cannot start a hook it talks to (no `HookRunner.start`) gets a process that
|
|
349
|
+
* takes the whole stdin first (`interactive: false`): the hook runs once its stdin is closed.
|
|
350
|
+
*/
|
|
351
|
+
start(name: string, options?: HookCallOptions & {
|
|
352
|
+
onStderr?: (text: string) => Promise<void> | void;
|
|
353
|
+
}): Promise<StartedHook | undefined>;
|
|
354
|
+
/** The invocation of one hook of `name` (see {@link runOne}). */
|
|
355
|
+
private invocationOf;
|
|
356
|
+
/** Runs one hook of `name` (see {@link run}). */
|
|
357
|
+
private runOne;
|
|
358
|
+
}
|
|
359
|
+
/** git's null object id of the length of `like` (sha1 when none is known). */
|
|
360
|
+
export declare function nullIdLike(like?: string): string;
|
|
361
|
+
/**
|
|
362
|
+
* The post-checkout hook (githooks(5)): the HEAD left and the one checked out (git's null id
|
|
363
|
+
* for none) and `1` for a branch switch, `0` for a path checkout. Its exit code (0 when no
|
|
364
|
+
* hook ran) becomes the command's exit status in git.
|
|
365
|
+
*/
|
|
366
|
+
export declare function runPostCheckoutHook(hooks: HookSession, oldId: string | undefined, newId: string | undefined, branchSwitch: boolean, env?: Record<string, string>,
|
|
367
|
+
/** The directory it runs in (a FilesApi path), in place of the worktree top */
|
|
368
|
+
dir?: string,
|
|
369
|
+
/** Whether git's setup exported `GIT_PREFIX` (not for clone) */
|
|
370
|
+
prefix?: boolean,
|
|
371
|
+
/** Variables the hook runs without (`worktree add`: `GIT_DIR`, `GIT_WORK_TREE`) */
|
|
372
|
+
unsetEnv?: string[]): Promise<number>;
|
|
373
|
+
/** What the sequencer's hooks write: `COMMIT_EDITMSG` and the rest of the git directory's state. */
|
|
374
|
+
export interface SequencerHookState {
|
|
375
|
+
read(path: string): Promise<string | undefined>;
|
|
376
|
+
write(path: string, content: string): Promise<void>;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* try_to_commit's prepare-commit-msg (sequencer.c `run_prepare_commit_msg_hook`): when the
|
|
380
|
+
* hook exists, the message written to COMMIT_EDITMSG, the hook told `message`, and the file's
|
|
381
|
+
* text taken back as the commit's message. A failing hook throws git's "'prepare-commit-msg'
|
|
382
|
+
* hook failed". Without the hook, the message as it is.
|
|
383
|
+
*/
|
|
384
|
+
export declare function sequencerPrepareMessage(hooks: HookSession, state: SequencerHookState, message: string): Promise<string>;
|
|
385
|
+
/** try_to_commit's post-commit hook (`run_commit_hook(0, index_file, ..., "post-commit")`). */
|
|
386
|
+
export declare function sequencerPostCommit(hooks: HookSession): Promise<void>;
|
|
387
|
+
/**
|
|
388
|
+
* git's reference-transaction hook (refs.c `run_transaction_hook`) for a ref store's
|
|
389
|
+
* transactions: told `preparing` (2.5x), `prepared`, `committed` or `aborted` with an
|
|
390
|
+
* `<old> <new> <ref>` line per update (git 2.43 lists a symbolic ref the update went
|
|
391
|
+
* through, HEAD, ahead of the ref it names; 2.5x leaves it out); a refusal in `preparing`
|
|
392
|
+
* or `prepared` aborts the transaction. Calls about a transaction only the other git
|
|
393
|
+
* version makes (`context.only`) are left out.
|
|
394
|
+
*/
|
|
395
|
+
export declare function refTransactionHookOf(hooks: HookSession,
|
|
396
|
+
/** How the hook runs beyond its state and stdin (the receive side: GIT_DIR, no prefix) */
|
|
397
|
+
runOptions?: Pick<HookCallOptions, "env" | "prefix">): RefTransactionHook;
|
|
398
|
+
/** How a sequencer runs `git commit` (sequencer.c `run_git_commit`), for its hooks. */
|
|
399
|
+
export interface GitCommitHookRun {
|
|
400
|
+
/** VERIFY_MSG: pre-commit and commit-msg run (else `git commit -n`) */
|
|
401
|
+
verify: boolean;
|
|
402
|
+
/** EDIT_MSG (`-e`): an editor runs, so the hooks get no `GIT_EDITOR=:` */
|
|
403
|
+
editor: boolean;
|
|
404
|
+
/** prepare-commit-msg's arguments after the message file (`message`, `commit HEAD`) */
|
|
405
|
+
hookArgs: string[];
|
|
406
|
+
/** Variables of the `git commit` run (`GIT_REFLOG_ACTION`) */
|
|
407
|
+
env?: Record<string, string>;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* The hooks of a `git commit` a sequencer runs, up to the commit (builtin/commit.c
|
|
411
|
+
* `prepare_to_commit`): pre-commit (with VERIFY_MSG), `template` written to COMMIT_EDITMSG
|
|
412
|
+
* for prepare-commit-msg, the editor over what it left (`edit`), then commit-msg (with
|
|
413
|
+
* VERIFY_MSG). The file's text once they ran; a refusing hook throws {@link HookFailedError}.
|
|
414
|
+
*/
|
|
415
|
+
export declare function gitCommitMessageHooks(hooks: HookSession, state: SequencerHookState, template: string, run: GitCommitHookRun, edit: (text: string) => string | Promise<string>): Promise<string>;
|
|
416
|
+
/**
|
|
417
|
+
* The hooks of a `git commit` a sequencer runs, once HEAD has moved: post-commit, then for an
|
|
418
|
+
* amend post-rewrite told `amend` with `<old> <new>` (commit_post_rewrite).
|
|
419
|
+
*/
|
|
420
|
+
export declare function gitCommitAfterHooks(hooks: HookSession, run: GitCommitHookRun, amended?: {
|
|
421
|
+
from: string;
|
|
422
|
+
to: string;
|
|
423
|
+
}): Promise<void>;
|
|
424
|
+
//# sourceMappingURL=git-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-hooks.d.ts","sourceRoot":"","sources":["../../src/commands/git-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAA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EAAE,kBAAkB,EACzB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED,+FAA+F;AAC/F,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW;AAClB,0FAA0F;AAC1F,UAAU,GAAE,IAAI,CAAC,eAAe,EAAE,KAAK,GAAG,QAAQ,CAAM,GACvD,kBAAkB,CAoCpB;AAED,uFAAuF;AACvF,MAAM,WAAW,gBAAgB;IAC/B,uEAAuE;IACvE,MAAM,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,MAAM,EAAE,OAAO,CAAC;IAChB,uFAAuF;IACvF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAeD;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAC/C,OAAO,CAAC,MAAM,CAAC,CAqBjB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,gBAAgB,EACrB,OAAO,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The author and committer of the commits (and the tagger of the tags) our commands write,
|
|
3
|
+
* resolved as git's `ident.c` resolves them, so that the same commands run with the same
|
|
4
|
+
* environment give the same object ids as native git.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const env = { readFile: async () => undefined, committer: { date: "1700000000 +0100" } };
|
|
9
|
+
* const config = { value: (key: string) => ({ "user.name": "Ada", "user.email": "ada@example.com" })[key] };
|
|
10
|
+
* resolveCommitterIdent(env, config);
|
|
11
|
+
* // { name: "Ada", email: "ada@example.com", timestamp: 1700000000, tzOffset: "+0100" }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The order, per field, is git's `fmt_ident`:
|
|
15
|
+
*
|
|
16
|
+
* - the name and email: `GIT_AUTHOR_*` / `GIT_COMMITTER_*` (the host environment's `author` /
|
|
17
|
+
* `committer`), then `author.name` / `committer.name` (and `.email`), then `user.name` /
|
|
18
|
+
* `user.email`, then `$EMAIL` for the email (the host environment's `defaultEmail`). A
|
|
19
|
+
* variable set to an empty string counts; an empty `author.*` / `committer.*` does not.
|
|
20
|
+
* Any `*.email` key in the configuration, even empty, even the other role's, stops the
|
|
21
|
+
* email there: `user.email`, else empty (`<>`). Likewise `*.name` for the name;
|
|
22
|
+
* - with `user.useConfigOnly`, a commit or tag refuses an identity the configuration does not
|
|
23
|
+
* give, with git's message ({@link IdentityUnknownError});
|
|
24
|
+
* - a commit or tag refuses an empty name and a name of crud only ({@link InvalidIdentError});
|
|
25
|
+
* - the date: `GIT_AUTHOR_DATE` / `GIT_COMMITTER_DATE` in any form {@link parseGitDate} reads,
|
|
26
|
+
* else the clock with the local timezone offset.
|
|
27
|
+
*
|
|
28
|
+
* Where git would ask the system (the user's full name from passwd, `user@host`), a portable
|
|
29
|
+
* host knows nothing: the name or email of the command's other identity is used when it was
|
|
30
|
+
* given one explicitly (a commit with only `setAuthor` is committed by that author, dated
|
|
31
|
+
* now), else {@link DEFAULT_IDENT}'s, the identity the ref stores write in reflogs. Never
|
|
32
|
+
* "Unknown", and never an error where git fails to guess.
|
|
33
|
+
*/
|
|
34
|
+
import type { PersonIdent } from "@statewalker/vcs-core";
|
|
35
|
+
import type { GitHostEnvironment, WorkingCopy } from "@statewalker/vcs-working-tree";
|
|
36
|
+
import { GitApiError } from "../errors/index.js";
|
|
37
|
+
export { localTimezoneOffset, parseGitDate } from "./git-date.js";
|
|
38
|
+
/** The identity of a commit nobody is configured for (the ref stores' reflog identity). */
|
|
39
|
+
export declare const DEFAULT_IDENT: {
|
|
40
|
+
readonly name: "webrun-vcs";
|
|
41
|
+
readonly email: "vcs@localhost";
|
|
42
|
+
};
|
|
43
|
+
/** What the resolver reads of the configuration: a value by its key, undefined when unset. */
|
|
44
|
+
export interface IdentConfig {
|
|
45
|
+
value(key: string): string | undefined;
|
|
46
|
+
}
|
|
47
|
+
/** Whose identity: git's `WANT_AUTHOR_IDENT` / `WANT_COMMITTER_IDENT`. */
|
|
48
|
+
export type IdentRole = "author" | "committer";
|
|
49
|
+
/** How an identity is resolved. */
|
|
50
|
+
export interface ResolveIdentOptions {
|
|
51
|
+
/** The clock, in seconds, when the variables give no date (default: now) */
|
|
52
|
+
now?: number;
|
|
53
|
+
/**
|
|
54
|
+
* The name and email used where git would ask the system (the full name from passwd,
|
|
55
|
+
* `user@host`): a command's other, explicitly given identity; {@link DEFAULT_IDENT}
|
|
56
|
+
* otherwise. Never its date: the date is the variables' or the clock's.
|
|
57
|
+
*/
|
|
58
|
+
fallback?: Pick<PersonIdent, "name" | "email">;
|
|
59
|
+
/**
|
|
60
|
+
* git's `IDENT_STRICT` (default true, as for commits and tags): `user.useConfigOnly`
|
|
61
|
+
* refuses an identity the configuration does not give, and an empty name or one of crud
|
|
62
|
+
* only is refused ({@link InvalidIdentError}). Reflog lines are not strict.
|
|
63
|
+
*/
|
|
64
|
+
strict?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* git's refusal of an identity it may not guess (`user.useConfigOnly`): the hint git prints
|
|
68
|
+
* and its `fatal:` line, as the message.
|
|
69
|
+
*/
|
|
70
|
+
export declare class IdentityUnknownError extends GitApiError {
|
|
71
|
+
readonly role: IdentRole;
|
|
72
|
+
constructor(role: IdentRole, what: "name" | "email");
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* git's refusal of a name a commit or tag may not carry (`IDENT_STRICT`): an empty one
|
|
76
|
+
* (`empty ident name (for <email>) not allowed`, after the hint when the name came from
|
|
77
|
+
* `user.name`), or one of crud only (`name consists only of disallowed characters: <name>`).
|
|
78
|
+
*/
|
|
79
|
+
export declare class InvalidIdentError extends GitApiError {
|
|
80
|
+
readonly role: IdentRole;
|
|
81
|
+
readonly reason: "empty" | "crud";
|
|
82
|
+
/**
|
|
83
|
+
* @param detail the email (for an empty name) or the name (crud only), as given
|
|
84
|
+
* @param hint whether git prints its hint first (the name came from the default)
|
|
85
|
+
*/
|
|
86
|
+
constructor(role: IdentRole, reason: "empty" | "crud", detail: string, hint: boolean);
|
|
87
|
+
}
|
|
88
|
+
/** git's refusal of a `GIT_AUTHOR_DATE` / `GIT_COMMITTER_DATE` it cannot read. */
|
|
89
|
+
export declare class InvalidDateError extends GitApiError {
|
|
90
|
+
readonly date: string;
|
|
91
|
+
constructor(date: string);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A name or email as git writes it (`strbuf_addstr_without_crud`): crud trimmed from both
|
|
95
|
+
* ends, `<`, `>` and newlines dropped inside.
|
|
96
|
+
*/
|
|
97
|
+
export declare function withoutCrud(text: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* git's `fmt_ident` for `role` (not strict unless asked): the identity named by the
|
|
100
|
+
* environment and the configuration, undefined when neither names anyone (no name, email
|
|
101
|
+
* or date): a caller then decides (the reflog's store identity). A field git would guess
|
|
102
|
+
* from the system is {@link DEFAULT_IDENT}'s.
|
|
103
|
+
*/
|
|
104
|
+
export declare function findIdent(role: IdentRole, environment: GitHostEnvironment | undefined, config: IdentConfig | undefined, options?: Omit<ResolveIdentOptions, "fallback">): PersonIdent | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* The committer of a commit or the tagger of a tag made now, as git's
|
|
107
|
+
* `git_committer_info(IDENT_STRICT)` resolves it (see the module comment for the order).
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveCommitterIdent(environment: GitHostEnvironment | undefined, config: IdentConfig | undefined, options?: ResolveIdentOptions): PersonIdent;
|
|
110
|
+
/**
|
|
111
|
+
* The author of a commit made now, as git's `git_author_info(IDENT_STRICT)` resolves it
|
|
112
|
+
* (see the module comment for the order).
|
|
113
|
+
*/
|
|
114
|
+
export declare function resolveAuthorIdent(environment: GitHostEnvironment | undefined, config: IdentConfig | undefined, options?: ResolveIdentOptions): PersonIdent;
|
|
115
|
+
/**
|
|
116
|
+
* The date of an identity made now for `role`: `GIT_AUTHOR_DATE` / `GIT_COMMITTER_DATE`, else
|
|
117
|
+
* `now` (default the clock) in the local offset. git's date of `commit --author=<who>`.
|
|
118
|
+
*/
|
|
119
|
+
export declare function resolveIdentDate(role: IdentRole, environment: GitHostEnvironment | undefined, now?: number): Pick<PersonIdent, "timestamp" | "tzOffset">;
|
|
120
|
+
/** The host environment a working copy's configuration carries, if any. */
|
|
121
|
+
export declare function hostEnvironmentOf(workingCopy: WorkingCopy): GitHostEnvironment | undefined;
|
|
122
|
+
/** The configuration of a working copy as the resolver reads it. */
|
|
123
|
+
export declare function identConfigOf(workingCopy: WorkingCopy): IdentConfig | undefined;
|
|
124
|
+
/** {@link resolveCommitterIdent} on a working copy's environment and configuration. */
|
|
125
|
+
export declare function committerIdentOf(workingCopy: WorkingCopy, options?: ResolveIdentOptions): PersonIdent;
|
|
126
|
+
/** {@link resolveAuthorIdent} on a working copy's environment and configuration. */
|
|
127
|
+
export declare function authorIdentOf(workingCopy: WorkingCopy, options?: ResolveIdentOptions): PersonIdent;
|
|
128
|
+
//# sourceMappingURL=git-ident.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-ident.d.ts","sourceRoot":"","sources":["../../src/commands/git-ident.ts"],"names":[],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