@statewalker/vcs-commands 0.5.0 → 0.6.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 +117 -0
- package/dist/commands/clone-command.d.ts.map +1 -1
- 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/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 +225 -0
- package/dist/commands/fsck/fsck-command.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-loose.d.ts +68 -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 +148 -0
- package/dist/commands/fsck/fsck-object-checks.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-object-table.d.ts +132 -0
- package/dist/commands/fsck/fsck-object-table.d.ts.map +1 -0
- package/dist/commands/fsck/fsck-pack.d.ts +115 -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 +43 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-date.d.ts +66 -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 +416 -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 +231 -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 +54 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -2
- package/dist/commands/init-command.d.ts +12 -1
- package/dist/commands/init-command.d.ts.map +1 -1
- 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 +209 -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 +252 -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 +106 -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 +41 -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 +41 -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 +80 -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 +321 -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 +155 -1
- 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 +53 -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-DnmlfwGV.js +61620 -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-DxvwPrPB.js +7612 -0
- package/dist/git-command.d.ts +413 -32
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +306 -3
- 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/remote-config-store.d.ts +105 -3
- 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 +10 -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/merge-result.d.ts +15 -1
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/pull-result.d.ts +12 -3
- package/dist/results/pull-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +42 -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-BZGa2Z3I.js +2934 -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 +832 -0
- package/src/commands/apply/apply-engine.ts +1603 -0
- package/src/commands/apply/apply-parse.ts +1209 -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 +1079 -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 +634 -67
- package/src/commands/commit-command.ts +1781 -166
- package/src/commands/core-config.ts +161 -6
- package/src/commands/date-format.ts +668 -0
- package/src/commands/describe-command.ts +2 -0
- package/src/commands/diff-command.ts +1898 -110
- package/src/commands/diff-textconv.ts +50 -0
- package/src/commands/fetch-command.ts +606 -66
- package/src/commands/format-patch-command.ts +969 -0
- package/src/commands/fsck/fetch-fsck.ts +229 -0
- package/src/commands/fsck/fsck-command.ts +3347 -0
- package/src/commands/fsck/fsck-loose.ts +287 -0
- package/src/commands/fsck/fsck-msg-ids.ts +176 -0
- package/src/commands/fsck/fsck-object-checks.ts +1044 -0
- package/src/commands/fsck/fsck-object-table.ts +363 -0
- package/src/commands/fsck/fsck-pack.ts +604 -0
- package/src/commands/fsck/index.ts +5 -0
- package/src/commands/fsck/verify-pack-command.ts +249 -0
- package/src/commands/gc-command.ts +147 -1
- package/src/commands/git-date.ts +895 -0
- package/src/commands/git-describe.ts +316 -0
- package/src/commands/git-hooks.ts +1472 -0
- package/src/commands/git-ident.ts +344 -0
- package/src/commands/hook-command.ts +247 -0
- package/src/commands/index-adder.ts +706 -0
- package/src/commands/index-host.ts +291 -0
- package/src/commands/index.ts +82 -0
- package/src/commands/init-command.ts +28 -4
- package/src/commands/local-clone.ts +183 -0
- package/src/commands/local-transport.ts +762 -0
- package/src/commands/log-command.ts +1915 -170
- package/src/commands/log-graph.ts +671 -0
- package/src/commands/log-output.ts +1359 -0
- package/src/commands/ls-remote-command.ts +101 -58
- package/src/commands/mailmap.ts +129 -0
- package/src/commands/merge-bases.ts +296 -0
- package/src/commands/merge-command.ts +1386 -491
- package/src/commands/merge-config.ts +25 -0
- package/src/commands/merge-drivers.ts +306 -0
- package/src/commands/merge-support.ts +1198 -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 +768 -0
- package/src/commands/notes-support.ts +402 -0
- package/src/commands/notes-tree.ts +602 -0
- package/src/commands/object-id-input.ts +27 -0
- package/src/commands/octopus-merge.ts +377 -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 +196 -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 +1431 -0
- package/src/commands/promisor-remote.ts +298 -0
- package/src/commands/pull-command.ts +207 -22
- package/src/commands/push-command.ts +236 -23
- package/src/commands/read-tree-command.ts +857 -0
- package/src/commands/rebase-command.ts +3808 -371
- 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 +93 -22
- package/src/commands/remote-transport.ts +383 -0
- package/src/commands/reset-command.ts +827 -103
- package/src/commands/restore-command.ts +350 -0
- package/src/commands/rev-list-command.ts +167 -0
- package/src/commands/rev-parse-command.ts +277 -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 +1379 -0
- package/src/commands/rm-command.ts +613 -67
- package/src/commands/sequencer-pick.ts +869 -0
- package/src/commands/sequencer-support.ts +869 -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 +1328 -105
- package/src/commands/status-format.ts +775 -0
- package/src/commands/status-header.ts +330 -0
- package/src/commands/strerror.ts +29 -0
- package/src/commands/submodule-config.ts +94 -0
- package/src/commands/submodule-summary-command.ts +334 -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 +194 -0
- package/src/commands/worktree-add-command.ts +458 -0
- package/src/commands/worktree-list-command.ts +208 -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 +7 -1
- 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 +1177 -118
- package/src/git.ts +523 -10
- package/src/index.ts +1 -1
- package/src/remote-config/remote-config-store.ts +242 -8
- package/src/remote-config/remote-refs.ts +22 -6
- package/src/rename/detect-renames.ts +711 -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 +12 -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 +1051 -0
- package/src/results/fetch-result.ts +15 -0
- package/src/results/index.ts +5 -0
- package/src/results/merge-result.ts +15 -1
- package/src/results/pull-result.ts +12 -3
- package/src/results/push-result.ts +43 -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 +123 -45
- 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,446 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What git's submodule.c shows of a submodule's own history: the header of a submodule's
|
|
3
|
+
* change (`Submodule <path> <a>..<b>:`, `show_submodule_header`), the commits between its
|
|
4
|
+
* two sides as `git diff --submodule=log` lists them (`show_submodule_diff_summary`), and
|
|
5
|
+
* the first-parent, left/right revision walk inside the submodule's repository that both
|
|
6
|
+
* that and `git submodule summary` (builtin/submodule--helper.c) print from.
|
|
7
|
+
*/
|
|
8
|
+
import type { ObjectId } from "@statewalker/vcs-core";
|
|
9
|
+
import { collectChunks, type WorkingCopy } from "@statewalker/vcs-working-tree";
|
|
10
|
+
|
|
11
|
+
import { InvalidConfigError } from "../errors/index.js";
|
|
12
|
+
import { GitCommand } from "../git-command.js";
|
|
13
|
+
import { RemoteConfigStore } from "../remote-config/index.js";
|
|
14
|
+
import { createIdAbbreviator, type IdAbbreviator } from "./core-config.js";
|
|
15
|
+
import { commitsBaseSource, MergeBaseGraph } from "./merge-bases.js";
|
|
16
|
+
import { formatCommitPretty } from "./pretty-format.js";
|
|
17
|
+
import type { SubmoduleDirt } from "./status-command.js";
|
|
18
|
+
import { type GitmodulesEntry, parseGitmodules } from "./submodule-config.js";
|
|
19
|
+
|
|
20
|
+
/** `--submodule=<format>` / `diff.submodule`: how a submodule's change is shown. */
|
|
21
|
+
export type SubmoduleDiffFormat = "short" | "log" | "diff";
|
|
22
|
+
|
|
23
|
+
/** A value of `--submodule` or `diff.submodule` (diff.c `parse_submodule_params`). */
|
|
24
|
+
export function parseSubmoduleDiffFormat(
|
|
25
|
+
value: string | undefined,
|
|
26
|
+
): SubmoduleDiffFormat | undefined {
|
|
27
|
+
return value === "short" || value === "log" || value === "diff" ? value : undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** `diff.submodule` as git's `git_diff_ui_config` reads it. */
|
|
31
|
+
export interface DiffSubmoduleConfig {
|
|
32
|
+
/** The last value git knows, undefined when none */
|
|
33
|
+
format?: SubmoduleDiffFormat;
|
|
34
|
+
/** `warning: Unknown value for 'diff.submodule' config variable: '<value>'`, per value */
|
|
35
|
+
warnings: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* `diff.submodule` as git reads it before any diff (`git_diff_ui_config`, whatever
|
|
40
|
+
* `--submodule` says): every value in the configuration's order, the last one it knows
|
|
41
|
+
* winning; each other value warns (`parse_submodule_params` fails, the warning of
|
|
42
|
+
* `git_diff_ui_config`). A variable without `=` fails as git 2.5x fails (`error: missing
|
|
43
|
+
* value for 'diff.submodule'`, then where it was read; git 2.43 crashes there).
|
|
44
|
+
*
|
|
45
|
+
* @throws InvalidConfigError for a variable without a value
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const { format, warnings } = readDiffSubmoduleConfig(workingCopy);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export function readDiffSubmoduleConfig(workingCopy: WorkingCopy): DiffSubmoduleConfig {
|
|
53
|
+
const key = "diff.submodule";
|
|
54
|
+
const out: DiffSubmoduleConfig = { warnings: [] };
|
|
55
|
+
if (!workingCopy.config) return out;
|
|
56
|
+
for (const { text, file, line } of RemoteConfigStore.from(workingCopy).valuesWithOrigin(key)) {
|
|
57
|
+
if (text === undefined) {
|
|
58
|
+
const where =
|
|
59
|
+
file !== undefined && line !== undefined
|
|
60
|
+
? `fatal: bad config variable '${key}' in file '${file}' at line ${line}`
|
|
61
|
+
: `fatal: unable to parse '${key}' from command-line config`;
|
|
62
|
+
throw new InvalidConfigError(key, `error: missing value for '${key}'\n${where}`);
|
|
63
|
+
}
|
|
64
|
+
const format = parseSubmoduleDiffFormat(text);
|
|
65
|
+
if (format) out.format = format;
|
|
66
|
+
else out.warnings.push(`warning: Unknown value for '${key}' config variable: '${text}'`);
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** git's null object id: the side of a submodule that is not there. */
|
|
72
|
+
export const NULL_OBJECT_ID = "0".repeat(40);
|
|
73
|
+
|
|
74
|
+
const isNull = (id: ObjectId) => /^0+$/.test(id);
|
|
75
|
+
|
|
76
|
+
/** One commit of the walk, and whether it was reached from the left side (`%m` is `<`). */
|
|
77
|
+
export interface SubmoduleWalkCommit {
|
|
78
|
+
id: ObjectId;
|
|
79
|
+
left: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Where a walk starts: a commit, marked left (`SYMMETRIC_LEFT`) or uninteresting. */
|
|
83
|
+
export interface SubmoduleWalkStart {
|
|
84
|
+
id: ObjectId;
|
|
85
|
+
left?: boolean;
|
|
86
|
+
uninteresting?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const SEEN = 1;
|
|
90
|
+
const UNINTERESTING = 2;
|
|
91
|
+
const LEFT = 4;
|
|
92
|
+
/** revision.c's SLOP: uninteresting commits looked at before the walk gives up */
|
|
93
|
+
const SLOP = 5;
|
|
94
|
+
|
|
95
|
+
/** The walk failed: a commit it had to read is missing ("revision walker failed"). */
|
|
96
|
+
export class SubmoduleWalkError extends Error {}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The repository of a submodule as the summaries read it: its commits, refs and
|
|
100
|
+
* abbreviations. Opened by {@link openSubmoduleRepository}.
|
|
101
|
+
*/
|
|
102
|
+
export class SubmoduleRepository extends GitCommand<never> {
|
|
103
|
+
private abbreviations?: IdAbbreviator;
|
|
104
|
+
/** Whether the repository is the one checked out at the path (not `modules/<name>`) */
|
|
105
|
+
populated = false;
|
|
106
|
+
|
|
107
|
+
/** Not a command: it reads for the submodule summaries. */
|
|
108
|
+
async call(): Promise<never> {
|
|
109
|
+
throw new Error("SubmoduleRepository is not callable");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** The working copy of the submodule's repository. */
|
|
113
|
+
get repository(): WorkingCopy {
|
|
114
|
+
return this.workingCopy;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** git's `lookup_commit_reference`: the commit `id` names (tags peeled), else undefined. */
|
|
118
|
+
async commitReference(id: ObjectId): Promise<ObjectId | undefined> {
|
|
119
|
+
if (isNull(id)) return undefined;
|
|
120
|
+
return this.revisionResolver()
|
|
121
|
+
.commitReference(id)
|
|
122
|
+
.catch(() => undefined);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The commit HEAD points at, undefined when there is none. */
|
|
126
|
+
async head(): Promise<ObjectId | undefined> {
|
|
127
|
+
return (await this.refsStore.resolve("HEAD").catch(() => undefined))?.objectId;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* git's `repo_get_merge_bases` of two commits, in git's order.
|
|
132
|
+
*
|
|
133
|
+
* @throws SubmoduleWalkError when a commit the walk reaches is missing (git 2.45 and later:
|
|
134
|
+
* `paint_down_to_common` fails, and the header says "(corrupt repository)")
|
|
135
|
+
*/
|
|
136
|
+
async mergeBases(one: ObjectId, two: ObjectId): Promise<ObjectId[]> {
|
|
137
|
+
const source = commitsBaseSource(this.walkCommits, async () => new Map());
|
|
138
|
+
const load = source.load;
|
|
139
|
+
source.load = async (id) => {
|
|
140
|
+
const found = await load(id);
|
|
141
|
+
if (!found) throw new SubmoduleWalkError(`could not parse commit ${id}`);
|
|
142
|
+
return found;
|
|
143
|
+
};
|
|
144
|
+
const graph = new MergeBaseGraph(source);
|
|
145
|
+
const bases = await graph.mergeBases(graph.commit(one), graph.commit(two));
|
|
146
|
+
return bases.map((n) => n.id).filter((id): id is ObjectId => id !== undefined);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** `id` abbreviated as this repository abbreviates it (`rev-parse --short`). */
|
|
150
|
+
abbreviate(id: ObjectId): Promise<string> {
|
|
151
|
+
this.abbreviations ??= createIdAbbreviator(this.workingCopy);
|
|
152
|
+
return this.abbreviations.abbreviate(id);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The commits of `git log --first-parent` from `starts` (git's `limit_list` with
|
|
157
|
+
* `first_parent_only`): newest commit date first, ties in the order queued, the commits
|
|
158
|
+
* reachable from an uninteresting start left out. Left marks run down the first parents.
|
|
159
|
+
*
|
|
160
|
+
* @throws SubmoduleWalkError when an interesting commit or its first parent is missing
|
|
161
|
+
*/
|
|
162
|
+
async walkFirstParent(starts: SubmoduleWalkStart[]): Promise<SubmoduleWalkCommit[]> {
|
|
163
|
+
const commits = this.walkCommits;
|
|
164
|
+
const flags = new Map<ObjectId, number>();
|
|
165
|
+
const parentsOf = new Map<ObjectId, ObjectId[]>();
|
|
166
|
+
const dates = new Map<ObjectId, number>();
|
|
167
|
+
const flag = (id: ObjectId) => flags.get(id) ?? 0;
|
|
168
|
+
const set = (id: ObjectId, f: number) => flags.set(id, flag(id) | f);
|
|
169
|
+
const parse = async (id: ObjectId): Promise<boolean> => {
|
|
170
|
+
if (parentsOf.has(id)) return true;
|
|
171
|
+
const commit = await commits.load(id).catch(() => undefined);
|
|
172
|
+
if (!commit) return false;
|
|
173
|
+
parentsOf.set(id, commit.parents);
|
|
174
|
+
dates.set(id, commit.committer.timestamp);
|
|
175
|
+
return true;
|
|
176
|
+
};
|
|
177
|
+
// mark_parents_uninteresting: through the commits already parsed
|
|
178
|
+
const markParentsUninteresting = (id: ObjectId) => {
|
|
179
|
+
const pending = [...(parentsOf.get(id) ?? [])];
|
|
180
|
+
while (pending.length > 0) {
|
|
181
|
+
const p = pending.pop() as ObjectId;
|
|
182
|
+
if (flag(p) & UNINTERESTING) continue;
|
|
183
|
+
set(p, UNINTERESTING);
|
|
184
|
+
pending.push(...(parentsOf.get(p) ?? []));
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
// the queue: newest first, ties in insertion order (prio_queue's counter)
|
|
188
|
+
let counter = 0;
|
|
189
|
+
const queue: { id: ObjectId; date: number; ctr: number }[] = [];
|
|
190
|
+
const put = (id: ObjectId) => {
|
|
191
|
+
const entry = { id, date: dates.get(id) ?? 0, ctr: counter++ };
|
|
192
|
+
let at = queue.length;
|
|
193
|
+
while (
|
|
194
|
+
at > 0 &&
|
|
195
|
+
(queue[at - 1].date < entry.date ||
|
|
196
|
+
(queue[at - 1].date === entry.date && queue[at - 1].ctr > entry.ctr))
|
|
197
|
+
) {
|
|
198
|
+
at--;
|
|
199
|
+
}
|
|
200
|
+
queue.splice(at, 0, entry);
|
|
201
|
+
};
|
|
202
|
+
for (const s of starts) set(s.id, (s.left ? LEFT : 0) | (s.uninteresting ? UNINTERESTING : 0));
|
|
203
|
+
// prepare_revision_walk: each start once, sorted by date (stable)
|
|
204
|
+
const initial: ObjectId[] = [];
|
|
205
|
+
for (const s of starts) {
|
|
206
|
+
if (!(await parse(s.id))) throw new SubmoduleWalkError(`bad object ${s.id}`);
|
|
207
|
+
if (flag(s.id) & UNINTERESTING) markParentsUninteresting(s.id);
|
|
208
|
+
if (flag(s.id) & SEEN) continue;
|
|
209
|
+
set(s.id, SEEN);
|
|
210
|
+
initial.push(s.id);
|
|
211
|
+
}
|
|
212
|
+
const sorted = initial
|
|
213
|
+
.map((id, i) => ({ id, i, date: dates.get(id) ?? 0 }))
|
|
214
|
+
.sort((a, b) => b.date - a.date || a.i - b.i);
|
|
215
|
+
for (const e of sorted) put(e.id);
|
|
216
|
+
const everybodyUninteresting = () => queue.every((e) => flag(e.id) & UNINTERESTING);
|
|
217
|
+
const out: ObjectId[] = [];
|
|
218
|
+
let slop = SLOP;
|
|
219
|
+
let date = Number.POSITIVE_INFINITY;
|
|
220
|
+
while (queue.length > 0) {
|
|
221
|
+
const { id } = queue.shift() as { id: ObjectId };
|
|
222
|
+
// process_parents
|
|
223
|
+
const parents = parentsOf.get(id) ?? [];
|
|
224
|
+
if (flag(id) & UNINTERESTING) {
|
|
225
|
+
for (const p of parents) {
|
|
226
|
+
set(p, UNINTERESTING);
|
|
227
|
+
if (!(await parse(p))) continue;
|
|
228
|
+
markParentsUninteresting(p);
|
|
229
|
+
if (flag(p) & SEEN) continue;
|
|
230
|
+
set(p, SEEN);
|
|
231
|
+
put(p);
|
|
232
|
+
}
|
|
233
|
+
markParentsUninteresting(id);
|
|
234
|
+
// still_interesting
|
|
235
|
+
const next = queue[0];
|
|
236
|
+
if (!next) break;
|
|
237
|
+
if (date <= next.date || !everybodyUninteresting()) slop = SLOP;
|
|
238
|
+
else slop--;
|
|
239
|
+
if (slop) continue;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
const first = parents[0];
|
|
243
|
+
if (first !== undefined) {
|
|
244
|
+
if (!(await parse(first))) throw new SubmoduleWalkError(`bad object ${first}`);
|
|
245
|
+
set(first, flag(id) & LEFT);
|
|
246
|
+
if (!(flag(first) & SEEN)) {
|
|
247
|
+
set(first, SEEN);
|
|
248
|
+
put(first);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
date = dates.get(id) ?? 0;
|
|
252
|
+
out.push(id);
|
|
253
|
+
}
|
|
254
|
+
return out
|
|
255
|
+
.filter((id) => !(flag(id) & UNINTERESTING))
|
|
256
|
+
.map((id) => ({ id, left: (flag(id) & LEFT) !== 0 }));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* The commits of `git log --first-parent <a>...<b>` (and `rev-list --count` of it): the
|
|
261
|
+
* merge bases excluded, `a`'s side marked left.
|
|
262
|
+
*/
|
|
263
|
+
async symmetricWalk(a: ObjectId, b: ObjectId): Promise<SubmoduleWalkCommit[]> {
|
|
264
|
+
const bases = await this.mergeBases(a, b);
|
|
265
|
+
return this.walkFirstParent([
|
|
266
|
+
...bases.map((id) => ({ id, uninteresting: true })),
|
|
267
|
+
{ id: a, left: true },
|
|
268
|
+
{ id: b },
|
|
269
|
+
]);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** One line of `--pretty=<format>` for a commit (`%m` its mark). */
|
|
273
|
+
async formatLine(format: string, c: SubmoduleWalkCommit): Promise<string> {
|
|
274
|
+
const commit = await this.walkCommits.load(c.id);
|
|
275
|
+
if (!commit) return "";
|
|
276
|
+
return `${await formatCommitPretty(format, commit, c.id, { mark: c.left ? "<" : ">" })}\n`;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* The text of the superproject's `.gitmodules` as git's `config_from_gitmodules` reads it:
|
|
282
|
+
* the worktree's file, else the index's blob, else HEAD's; undefined without one.
|
|
283
|
+
*/
|
|
284
|
+
export async function readGitmodulesEntries(
|
|
285
|
+
workingCopy: WorkingCopy,
|
|
286
|
+
): Promise<GitmodulesEntry[] | undefined> {
|
|
287
|
+
const reader = new GitmodulesReader(workingCopy);
|
|
288
|
+
const text = await reader.call();
|
|
289
|
+
return text === undefined ? undefined : parseGitmodules(text);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
class GitmodulesReader extends GitCommand<string | undefined> {
|
|
293
|
+
async call(): Promise<string | undefined> {
|
|
294
|
+
const decode = (bytes: Uint8Array) => new TextDecoder().decode(bytes);
|
|
295
|
+
const worktree = this.worktreeAccess;
|
|
296
|
+
try {
|
|
297
|
+
if (worktree && (await worktree.getEntry(".gitmodules"))) {
|
|
298
|
+
return decode(await collectChunks(worktree.readContent(".gitmodules")));
|
|
299
|
+
}
|
|
300
|
+
} catch {
|
|
301
|
+
// not readable: the index's
|
|
302
|
+
}
|
|
303
|
+
const blob = async (id: ObjectId) =>
|
|
304
|
+
decode(await collectChunks((await this.blobs.load(id)) ?? []));
|
|
305
|
+
const staged = await this.staging.getEntry(".gitmodules").catch(() => undefined);
|
|
306
|
+
if (staged) return blob(staged.objectId);
|
|
307
|
+
try {
|
|
308
|
+
return await blob(await this.resolveRevision("HEAD:.gitmodules"));
|
|
309
|
+
} catch {
|
|
310
|
+
return undefined;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* git's `open_submodule`: the repository of the submodule at `path` (its `.git`, else the
|
|
317
|
+
* one kept under `<gitdir>/modules/<name>` for the name `.gitmodules` gives the path);
|
|
318
|
+
* undefined when there is none.
|
|
319
|
+
*
|
|
320
|
+
* Known gaps:
|
|
321
|
+
* - A gitfile naming a repository beyond the FilesApi's root cannot be followed here, so
|
|
322
|
+
* the submodule reads as holding none and the `modules/<name>` fallback is taken, where
|
|
323
|
+
* git reads the repository the gitfile names.
|
|
324
|
+
* - When `.gitmodules` gives one path to several names, the first name is taken; git's
|
|
325
|
+
* submodule-config cache keeps the last one read (`cache_put_path` replaces the entry).
|
|
326
|
+
*/
|
|
327
|
+
export async function openSubmoduleRepository(
|
|
328
|
+
workingCopy: WorkingCopy,
|
|
329
|
+
path: string,
|
|
330
|
+
): Promise<SubmoduleRepository | undefined> {
|
|
331
|
+
const worktree = workingCopy.worktree;
|
|
332
|
+
if (!worktree?.openGitlink) return undefined;
|
|
333
|
+
let inner = await worktree.openGitlink(path).catch(() => undefined);
|
|
334
|
+
const populated = inner !== undefined;
|
|
335
|
+
if (!inner) {
|
|
336
|
+
const name = (await readGitmodulesEntries(workingCopy).catch(() => undefined))?.find(
|
|
337
|
+
(e) => e.path === path,
|
|
338
|
+
)?.name;
|
|
339
|
+
if (name !== undefined)
|
|
340
|
+
inner = await worktree.openGitlink(path, { name }).catch(() => undefined);
|
|
341
|
+
}
|
|
342
|
+
if (!inner) return undefined;
|
|
343
|
+
const sub = new SubmoduleRepository(inner);
|
|
344
|
+
sub.populated = populated;
|
|
345
|
+
return sub;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** What {@link submoduleHeader} found: the commits of both sides and their merge bases. */
|
|
349
|
+
export interface SubmoduleHeader {
|
|
350
|
+
text: string;
|
|
351
|
+
left?: ObjectId;
|
|
352
|
+
right?: ObjectId;
|
|
353
|
+
bases: ObjectId[];
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* submodule.c's `show_submodule_header`: the "contains untracked / modified content" lines
|
|
358
|
+
* of a dirty submodule, then `Submodule <path> <a>..<b>:` (`...` unless one side is an
|
|
359
|
+
* ancestor of the other, ` (rewind)` when the new side is the older), or the header with
|
|
360
|
+
* "(new submodule)", "(submodule deleted)", "(commits not present)" or "(corrupt
|
|
361
|
+
* repository)"; no header when both sides are the same commit. The ids are abbreviated as
|
|
362
|
+
* the superproject abbreviates them (`abbreviate`).
|
|
363
|
+
*/
|
|
364
|
+
export async function submoduleHeader(o: {
|
|
365
|
+
path: string;
|
|
366
|
+
one: ObjectId;
|
|
367
|
+
two: ObjectId;
|
|
368
|
+
dirt?: SubmoduleDirt;
|
|
369
|
+
sub: SubmoduleRepository | undefined;
|
|
370
|
+
abbreviate: (id: ObjectId) => Promise<string>;
|
|
371
|
+
}): Promise<SubmoduleHeader> {
|
|
372
|
+
const { path, one, two, sub } = o;
|
|
373
|
+
let text = "";
|
|
374
|
+
if (o.dirt?.untracked) text += `Submodule ${path} contains untracked content\n`;
|
|
375
|
+
if (o.dirt?.modified) text += `Submodule ${path} contains modified content\n`;
|
|
376
|
+
let message: string | undefined;
|
|
377
|
+
if (isNull(one)) message = "(new submodule)";
|
|
378
|
+
else if (isNull(two)) message = "(submodule deleted)";
|
|
379
|
+
let left: ObjectId | undefined;
|
|
380
|
+
let right: ObjectId | undefined;
|
|
381
|
+
let bases: ObjectId[] = [];
|
|
382
|
+
let fastForward = false;
|
|
383
|
+
let fastBackward = false;
|
|
384
|
+
const header = async () => {
|
|
385
|
+
let line = `Submodule ${path} ${await o.abbreviate(one)}`;
|
|
386
|
+
line += fastBackward || fastForward ? ".." : "...";
|
|
387
|
+
line += await o.abbreviate(two);
|
|
388
|
+
line += message ? ` ${message}\n` : `${fastBackward ? " (rewind)" : ""}:\n`;
|
|
389
|
+
return line;
|
|
390
|
+
};
|
|
391
|
+
if (!sub) {
|
|
392
|
+
message ??= "(commits not present)";
|
|
393
|
+
return { text: text + (await header()), bases };
|
|
394
|
+
}
|
|
395
|
+
left = await sub.commitReference(one);
|
|
396
|
+
right = await sub.commitReference(two);
|
|
397
|
+
if ((!isNull(one) && !left) || (!isNull(two) && !right)) message = "(commits not present)";
|
|
398
|
+
// repo_get_merge_bases: one side missing has none; the same commit (or none on both
|
|
399
|
+
// sides) is its own
|
|
400
|
+
try {
|
|
401
|
+
if (left === right) bases = left !== undefined ? [left] : [];
|
|
402
|
+
else if (left !== undefined && right !== undefined) bases = await sub.mergeBases(left, right);
|
|
403
|
+
} catch {
|
|
404
|
+
message = "(corrupt repository)";
|
|
405
|
+
return { text: text + (await header()), left, right, bases: [] };
|
|
406
|
+
}
|
|
407
|
+
if (left === right) fastForward = true;
|
|
408
|
+
else if (bases.length > 0) {
|
|
409
|
+
if (bases[0] === left) fastForward = true;
|
|
410
|
+
else if (bases[0] === right) fastBackward = true;
|
|
411
|
+
}
|
|
412
|
+
if (one === two) return { text, left, right, bases };
|
|
413
|
+
return { text: text + (await header()), left, right, bases };
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* submodule.c's `show_submodule_diff_summary` (`git diff --submodule=log`): the header,
|
|
418
|
+
* then the commits between the two sides, ` < subject` for those only the old side has
|
|
419
|
+
* and ` > subject` for the new side's, as a `--left-right --first-parent` walk lists them.
|
|
420
|
+
*/
|
|
421
|
+
export async function showSubmoduleDiffSummary(o: {
|
|
422
|
+
workingCopy: WorkingCopy;
|
|
423
|
+
path: string;
|
|
424
|
+
one: ObjectId;
|
|
425
|
+
two: ObjectId;
|
|
426
|
+
dirt?: SubmoduleDirt;
|
|
427
|
+
abbreviate: (id: ObjectId) => Promise<string>;
|
|
428
|
+
}): Promise<string> {
|
|
429
|
+
const sub = await openSubmoduleRepository(o.workingCopy, o.path);
|
|
430
|
+
const header = await submoduleHeader({ ...o, sub });
|
|
431
|
+
let out = header.text;
|
|
432
|
+
const { left, right } = header;
|
|
433
|
+
if (!left || !right || !sub) return out;
|
|
434
|
+
let walked: SubmoduleWalkCommit[];
|
|
435
|
+
try {
|
|
436
|
+
walked = await sub.walkFirstParent([
|
|
437
|
+
{ id: left, left: true },
|
|
438
|
+
{ id: right },
|
|
439
|
+
...header.bases.map((id) => ({ id, uninteresting: true })),
|
|
440
|
+
]);
|
|
441
|
+
} catch {
|
|
442
|
+
return `${out}(revision walker failed)\n`;
|
|
443
|
+
}
|
|
444
|
+
for (const c of walked) out += await sub.formatLine(" %m %s", c);
|
|
445
|
+
return out;
|
|
446
|
+
}
|