@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
|
@@ -1,24 +1,46 @@
|
|
|
1
1
|
import type { ObjectId } from "@statewalker/vcs-core";
|
|
2
2
|
// Import from the package root only: vcs-core ships a single runtime file
|
|
3
3
|
// (dist/index.js); its subpaths resolve for types but not at runtime.
|
|
4
|
-
import { isSymbolicRef } from "@statewalker/vcs-core";
|
|
5
4
|
import {
|
|
5
|
+
type FilesApi,
|
|
6
|
+
historyWithoutLazyFetch,
|
|
7
|
+
isSymbolicRef,
|
|
8
|
+
parseCoreAbbrev,
|
|
9
|
+
} from "@statewalker/vcs-core";
|
|
10
|
+
import { writeCommitGraph } from "@statewalker/vcs-store-files";
|
|
11
|
+
import {
|
|
12
|
+
anonymizeUrl,
|
|
6
13
|
createRepositoryFacade,
|
|
7
14
|
createTransportRefStore,
|
|
8
15
|
expandFromDestination,
|
|
16
|
+
FetchCheckError,
|
|
9
17
|
type FetchClientResult,
|
|
18
|
+
type FetchDisplayEntry,
|
|
10
19
|
type FetchHeadEntry,
|
|
11
20
|
type FetchRefUpdate,
|
|
21
|
+
fetchFromConnection,
|
|
22
|
+
fetchRefcolWidth,
|
|
23
|
+
fetchUpdateDisplay,
|
|
24
|
+
formatFetchDisplay,
|
|
12
25
|
formatFetchHead,
|
|
13
26
|
matchDestination,
|
|
14
27
|
matchSource,
|
|
28
|
+
ObjectFormatMismatchError,
|
|
15
29
|
parseRefSpec,
|
|
16
30
|
type RefSpec,
|
|
17
31
|
type TagMode,
|
|
18
|
-
|
|
32
|
+
type FetchOptions as TransportFetchOptions,
|
|
33
|
+
transportSummaryWidth,
|
|
19
34
|
} from "@statewalker/vcs-transport";
|
|
20
|
-
|
|
21
|
-
import {
|
|
35
|
+
import { parseGitBool } from "@statewalker/vcs-utils";
|
|
36
|
+
import { nullObjectIdLike } from "@statewalker/vcs-utils/hash";
|
|
37
|
+
import type { WorktreeAdmin } from "@statewalker/vcs-working-tree";
|
|
38
|
+
import {
|
|
39
|
+
FetchIntoCheckedOutBranchError,
|
|
40
|
+
InvalidArgumentError,
|
|
41
|
+
InvalidRemoteError,
|
|
42
|
+
TransportError,
|
|
43
|
+
} from "../errors/index.js";
|
|
22
44
|
import { deleteRefs, RemoteConfigStore } from "../remote-config/index.js";
|
|
23
45
|
import {
|
|
24
46
|
type FetchResult,
|
|
@@ -26,6 +48,16 @@ import {
|
|
|
26
48
|
type TrackingRefUpdate,
|
|
27
49
|
} from "../results/fetch-result.js";
|
|
28
50
|
import { TransportCommand } from "../transport-command.js";
|
|
51
|
+
import { fetchFsckOf } from "./fsck/index.js";
|
|
52
|
+
import { hostEnvironmentOf } from "./git-ident.js";
|
|
53
|
+
import {
|
|
54
|
+
hasPromisorRemote,
|
|
55
|
+
promisorOf,
|
|
56
|
+
promisorRemotes,
|
|
57
|
+
registerPartialClone,
|
|
58
|
+
} from "./promisor-remote.js";
|
|
59
|
+
import { withRemoteUploadPack } from "./remote-transport.js";
|
|
60
|
+
import { worktreeUsingBranch } from "./worktree-support.js";
|
|
29
61
|
|
|
30
62
|
/**
|
|
31
63
|
* Tag fetching option.
|
|
@@ -76,7 +108,10 @@ export enum TagOption {
|
|
|
76
108
|
*/
|
|
77
109
|
export class FetchCommand extends TransportCommand<FetchResult> {
|
|
78
110
|
private remote = "origin";
|
|
111
|
+
/** Whether the remote was named (it is then in the reflog action, as on git's command line). */
|
|
112
|
+
private remoteGiven = false;
|
|
79
113
|
private refSpecs: string[] = [];
|
|
114
|
+
private updateHeadOk = false;
|
|
80
115
|
private removeDeletedRefs?: boolean;
|
|
81
116
|
private pruneTags?: boolean;
|
|
82
117
|
private refmap?: string[];
|
|
@@ -84,15 +119,26 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
84
119
|
private tagOptionSet = false;
|
|
85
120
|
private writeFetchHead = true;
|
|
86
121
|
private appendFetchHead = false;
|
|
122
|
+
private verbose = false;
|
|
123
|
+
private porcelain = false;
|
|
87
124
|
private thin = true;
|
|
88
125
|
private depth?: number;
|
|
126
|
+
private uploadPack?: string;
|
|
89
127
|
private dryRun = false;
|
|
128
|
+
private writeCommitGraphOption?: boolean;
|
|
129
|
+
private repositoryFiles?: { files: FilesApi; gitDir?: string };
|
|
90
130
|
private forceUpdate = false;
|
|
91
|
-
private
|
|
131
|
+
private atomic = false;
|
|
132
|
+
private checkFetchedObjects?: boolean;
|
|
133
|
+
private compatibility?: "2.43" | "2.56";
|
|
92
134
|
private initialBranch?: string;
|
|
93
135
|
private shallowSince?: Date;
|
|
94
136
|
private shallowExcludes: string[] = [];
|
|
95
137
|
private unshallow = false;
|
|
138
|
+
private updateShallow = false;
|
|
139
|
+
/** `--filter=<spec>` (a string), `--no-filter` (false), or neither */
|
|
140
|
+
private filterSpec?: string | false;
|
|
141
|
+
private refetch = false;
|
|
96
142
|
|
|
97
143
|
/**
|
|
98
144
|
* Set the remote to fetch from.
|
|
@@ -105,6 +151,7 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
105
151
|
setRemote(remote: string): this {
|
|
106
152
|
this.checkCallable();
|
|
107
153
|
this.remote = remote;
|
|
154
|
+
this.remoteGiven = true;
|
|
108
155
|
return this;
|
|
109
156
|
}
|
|
110
157
|
|
|
@@ -239,6 +286,64 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
239
286
|
return this.appendFetchHead;
|
|
240
287
|
}
|
|
241
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Set whether refs already up to date are reported too (`git fetch -v`): their lines,
|
|
291
|
+
* ` = [up to date] main -> origin/main`, join {@link FetchResult.display} in
|
|
292
|
+
* git's order, and the remote column is as wide as their names need.
|
|
293
|
+
*/
|
|
294
|
+
setVerbose(verbose: boolean): this {
|
|
295
|
+
this.checkCallable();
|
|
296
|
+
this.verbose = verbose;
|
|
297
|
+
return this;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** Whether up-to-date refs are reported (`-v`). */
|
|
301
|
+
isVerbose(): boolean {
|
|
302
|
+
return this.verbose;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Set whether the ref lines are git's machine-readable ones (`git fetch --porcelain`,
|
|
307
|
+
* printed on stdout): {@link FetchResult.display} then holds `<flag> <old-id> <new-id>
|
|
308
|
+
* <local-ref>` per ref, full ids (zeros for none) and full ref names, without the
|
|
309
|
+
* `From <url>` line; `fetch.output` does not apply.
|
|
310
|
+
*/
|
|
311
|
+
setPorcelain(porcelain: boolean): this {
|
|
312
|
+
this.checkCallable();
|
|
313
|
+
this.porcelain = porcelain;
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/** Whether the ref lines are porcelain ones (`--porcelain`). */
|
|
318
|
+
isPorcelain(): boolean {
|
|
319
|
+
return this.porcelain;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Partial fetch (`git fetch --filter=<spec>`), or `false` for `--no-filter`. Unset, a
|
|
324
|
+
* fetch from a promisor remote of a partial clone uses its `remote.<name>.partialclonefilter`
|
|
325
|
+
* (git's fetch_one_setup_partial); a filter given registers the remote as a promisor remote
|
|
326
|
+
* first when it is not one with a filter (partial_clone_register:
|
|
327
|
+
* `core.repositoryformatversion = 1`, `remote.<name>.promisor`, `.partialclonefilter`). A
|
|
328
|
+
* pack fetched under a filter is kept as a promisor pack.
|
|
329
|
+
*/
|
|
330
|
+
setFilter(spec: string | false): this {
|
|
331
|
+
this.checkCallable();
|
|
332
|
+
this.filterSpec = spec;
|
|
333
|
+
return this;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* `git fetch --refetch`: everything the refspecs select is fetched again, as a fresh clone
|
|
338
|
+
* would (no local commit offered as a `have`, no tip counted as here), under the filter in
|
|
339
|
+
* use: how a partial clone changes its filter.
|
|
340
|
+
*/
|
|
341
|
+
setRefetch(refetch: boolean): this {
|
|
342
|
+
this.checkCallable();
|
|
343
|
+
this.refetch = refetch;
|
|
344
|
+
return this;
|
|
345
|
+
}
|
|
346
|
+
|
|
242
347
|
/**
|
|
243
348
|
* Set thin-pack preference.
|
|
244
349
|
*
|
|
@@ -271,6 +376,45 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
271
376
|
return this;
|
|
272
377
|
}
|
|
273
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Set the program the remote runs for upload-pack (git's `--upload-pack`, over
|
|
381
|
+
* `remote.<name>.uploadpack`): what an ssh connector runs, and what git:// names in its
|
|
382
|
+
* request line.
|
|
383
|
+
*
|
|
384
|
+
* @param uploadPack Path to git-upload-pack on the remote
|
|
385
|
+
*/
|
|
386
|
+
setUploadPack(uploadPack: string): this {
|
|
387
|
+
this.checkCallable();
|
|
388
|
+
this.uploadPack = uploadPack;
|
|
389
|
+
return this;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* `--[no-]write-commit-graph`: after the fetch, write a split commit-graph of everything the
|
|
394
|
+
* refs reach, as git does with `fetch.writeCommitGraph` (which this overrides). It needs the
|
|
395
|
+
* repository's files (`setRepositoryFiles`).
|
|
396
|
+
*/
|
|
397
|
+
setWriteCommitGraph(write: boolean): this {
|
|
398
|
+
this.checkCallable();
|
|
399
|
+
this.writeCommitGraphOption = write;
|
|
400
|
+
return this;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* The files of the repository (a files backend), where `fetch.writeCommitGraph` writes the
|
|
405
|
+
* commit-graph. Without them no graph is written.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```typescript
|
|
409
|
+
* await git.fetch().setRepositoryFiles({ files }).setWriteCommitGraph(true).call();
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
setRepositoryFiles(repository: { files: FilesApi; gitDir?: string }): this {
|
|
413
|
+
this.checkCallable();
|
|
414
|
+
this.repositoryFiles = repository;
|
|
415
|
+
return this;
|
|
416
|
+
}
|
|
417
|
+
|
|
274
418
|
/**
|
|
275
419
|
* Set dry run mode.
|
|
276
420
|
*
|
|
@@ -291,6 +435,17 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
291
435
|
return this.dryRun;
|
|
292
436
|
}
|
|
293
437
|
|
|
438
|
+
/**
|
|
439
|
+
* Let the fetch write a branch a worktree has checked out (`git fetch --update-head-ok`,
|
|
440
|
+
* which `git pull` passes). Without it a fetch whose refspecs would write such a branch
|
|
441
|
+
* fails before fetching anything (`FetchIntoCheckedOutBranchError`).
|
|
442
|
+
*/
|
|
443
|
+
setUpdateHeadOk(ok: boolean): this {
|
|
444
|
+
this.checkCallable();
|
|
445
|
+
this.updateHeadOk = ok;
|
|
446
|
+
return this;
|
|
447
|
+
}
|
|
448
|
+
|
|
294
449
|
/**
|
|
295
450
|
* Set force update mode.
|
|
296
451
|
*
|
|
@@ -304,6 +459,16 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
304
459
|
return this;
|
|
305
460
|
}
|
|
306
461
|
|
|
462
|
+
/**
|
|
463
|
+
* Update the local refs in one transaction, all or none (`git fetch --atomic`). Each ref
|
|
464
|
+
* is still logged with its own reflog message, as git's transaction logs it.
|
|
465
|
+
*/
|
|
466
|
+
setAtomic(atomic: boolean): this {
|
|
467
|
+
this.checkCallable();
|
|
468
|
+
this.atomic = atomic;
|
|
469
|
+
return this;
|
|
470
|
+
}
|
|
471
|
+
|
|
307
472
|
/**
|
|
308
473
|
* Whether force update mode is enabled.
|
|
309
474
|
*/
|
|
@@ -312,9 +477,18 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
312
477
|
}
|
|
313
478
|
|
|
314
479
|
/**
|
|
315
|
-
* Set whether to check received objects for validity.
|
|
480
|
+
* Set whether to check received objects for validity, over `fetch.fsckObjects` (else
|
|
481
|
+
* `transfer.fsckObjects`), which decide when this is not set.
|
|
482
|
+
*
|
|
483
|
+
* Checked, each received object passes fsck as git's `index-pack --strict` runs it
|
|
484
|
+
* (`fetch.fsck.<msg-id>` severities, `fetch.fsck.skipList`), and every object it names came
|
|
485
|
+
* with the pack or is here; otherwise the fetch fails with `FetchCheckError` (git's
|
|
486
|
+
* `error: object <id>: <msg-id>: <message>`, `fatal: fsck error in packed object`, `fatal:
|
|
487
|
+
* index-pack failed`), leaving no ref and no received object behind.
|
|
316
488
|
*
|
|
317
|
-
*
|
|
489
|
+
* Whatever this says, the new ref tips must be connected (git's check_connected): a
|
|
490
|
+
* remote that does not send every object they need fails the fetch (`error: <url> did not
|
|
491
|
+
* send all necessary objects`, exit 1) before any ref is written.
|
|
318
492
|
*
|
|
319
493
|
* @param check Whether to check objects
|
|
320
494
|
*/
|
|
@@ -325,10 +499,22 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
325
499
|
}
|
|
326
500
|
|
|
327
501
|
/**
|
|
328
|
-
* Whether to check received objects for validity
|
|
502
|
+
* Whether to check received objects for validity, as set with {@link setCheckFetchedObjects}
|
|
503
|
+
* (false when unset: the configuration is read when the fetch runs).
|
|
329
504
|
*/
|
|
330
505
|
isCheckFetchedObjects(): boolean {
|
|
331
|
-
return this.checkFetchedObjects;
|
|
506
|
+
return this.checkFetchedObjects ?? false;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Whose output to give where git 2.43 and 2.5x differ (2.43 prints an empty line after
|
|
511
|
+
* `error: <url> did not send all necessary objects`; fsck of a tag's `gpgsig` header).
|
|
512
|
+
* Default: the hook runner's compatibility, else 2.56.
|
|
513
|
+
*/
|
|
514
|
+
setCompatibility(version: "2.43" | "2.56"): this {
|
|
515
|
+
this.checkCallable();
|
|
516
|
+
this.compatibility = version;
|
|
517
|
+
return this;
|
|
332
518
|
}
|
|
333
519
|
|
|
334
520
|
/**
|
|
@@ -409,6 +595,18 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
409
595
|
return this;
|
|
410
596
|
}
|
|
411
597
|
|
|
598
|
+
/**
|
|
599
|
+
* `git fetch --update-shallow`: from a shallow remote, the shallow commits the fetched
|
|
600
|
+
* history needs are added to `.git/shallow`. Without it, each ref whose new history needs
|
|
601
|
+
* one is left alone, as git leaves it (`warning: rejected <ref> because shallow roots are
|
|
602
|
+
* not allowed to be updated` for one that would have been merged).
|
|
603
|
+
*/
|
|
604
|
+
setUpdateShallow(updateShallow: boolean): this {
|
|
605
|
+
this.checkCallable();
|
|
606
|
+
this.updateShallow = updateShallow;
|
|
607
|
+
return this;
|
|
608
|
+
}
|
|
609
|
+
|
|
412
610
|
/**
|
|
413
611
|
* Whether unshallow mode is enabled.
|
|
414
612
|
*/
|
|
@@ -416,6 +614,35 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
416
614
|
return this.unshallow;
|
|
417
615
|
}
|
|
418
616
|
|
|
617
|
+
/**
|
|
618
|
+
* The options as git's reflog action spells the command line (`GIT_REFLOG_ACTION` is
|
|
619
|
+
* `fetch` and its arguments), in a fixed order since our options have none:
|
|
620
|
+
* `--atomic --force --prune --prune-tags --tags --depth=<n> --unshallow --append
|
|
621
|
+
* --no-write-fetch-head --refmap=<spec>` (and their `--no-` forms where set to false).
|
|
622
|
+
*/
|
|
623
|
+
private commandLineOptions(): string[] {
|
|
624
|
+
const flag = (value: boolean | undefined, name: string) =>
|
|
625
|
+
value === true ? [`--${name}`] : value === false ? [`--no-${name}`] : [];
|
|
626
|
+
return [
|
|
627
|
+
...(this.verbose ? ["-v"] : []),
|
|
628
|
+
...(this.porcelain ? ["--porcelain"] : []),
|
|
629
|
+
...(this.atomic ? ["--atomic"] : []),
|
|
630
|
+
...(this.forceUpdate ? ["--force"] : []),
|
|
631
|
+
...flag(this.removeDeletedRefs, "prune"),
|
|
632
|
+
...flag(this.pruneTags, "prune-tags"),
|
|
633
|
+
...(this.tagOptionSet && this.tagOption === TagOption.FETCH_TAGS ? ["--tags"] : []),
|
|
634
|
+
...(this.tagOptionSet && this.tagOption === TagOption.NO_TAGS ? ["--no-tags"] : []),
|
|
635
|
+
...(this.depth !== undefined ? [`--depth=${this.depth}`] : []),
|
|
636
|
+
...(this.unshallow ? ["--unshallow"] : []),
|
|
637
|
+
...(this.appendFetchHead ? ["--append"] : []),
|
|
638
|
+
...(this.writeFetchHead ? [] : ["--no-write-fetch-head"]),
|
|
639
|
+
...(this.refmap ?? []).map((spec) => `--refmap=${spec}`),
|
|
640
|
+
...(typeof this.filterSpec === "string" ? [`--filter=${this.filterSpec}`] : []),
|
|
641
|
+
...(this.filterSpec === false ? ["--no-filter"] : []),
|
|
642
|
+
...(this.refetch ? ["--refetch"] : []),
|
|
643
|
+
];
|
|
644
|
+
}
|
|
645
|
+
|
|
419
646
|
/**
|
|
420
647
|
* Execute the fetch operation.
|
|
421
648
|
*
|
|
@@ -432,6 +659,9 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
432
659
|
this.checkCallable();
|
|
433
660
|
this.setCallable(false);
|
|
434
661
|
|
|
662
|
+
// remote_get: a remote the configuration gives no URL may come from .git/remotes/ or
|
|
663
|
+
// .git/branches/ (git 2.x); 2.5x warns that it read one
|
|
664
|
+
const legacyMessages = await this.loadLegacyRemote(this.remote);
|
|
435
665
|
// Resolve remote URL
|
|
436
666
|
const remoteUrl = await this.resolveRemoteUrl(this.remote);
|
|
437
667
|
if (!remoteUrl) {
|
|
@@ -490,71 +720,200 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
490
720
|
: (this.refmap ?? configured).filter((spec) => spec !== "");
|
|
491
721
|
// do_fetch: refs/remotes/<name>/HEAD follows the remote HEAD on a configured fetch
|
|
492
722
|
const followHead = fromConfig && configured.length > 0 ? this.followRemoteHead(store) : null;
|
|
493
|
-
const messages: string[] = [];
|
|
723
|
+
const messages: string[] = [...legacyMessages];
|
|
494
724
|
const errors: string[] = [];
|
|
495
725
|
const trackingUpdates: TrackingRefUpdate[] = [];
|
|
496
726
|
|
|
727
|
+
// transport_get: git's local transport (upload-pack of the repository at the path, in
|
|
728
|
+
// process), or the connector the transport registry names (smart HTTP by default);
|
|
729
|
+
// anything else fails in git's words. The remote is reached before FETCH_HEAD is touched
|
|
730
|
+
// (transport_get_remote_refs comes first in do_fetch)
|
|
731
|
+
const remote = await this.prepareRemote(remoteUrl);
|
|
732
|
+
|
|
497
733
|
// git truncates FETCH_HEAD when the fetch starts: a failed fetch leaves it empty
|
|
498
|
-
|
|
734
|
+
// a bare repository writes FETCH_HEAD in its git directory (no checkout to ask)
|
|
735
|
+
const checkout =
|
|
736
|
+
"checkout" in this._workingCopy
|
|
737
|
+
? this._workingCopy.checkout
|
|
738
|
+
: (this._workingCopy as Partial<Pick<WorktreeAdmin, "bareRepository">>).bareRepository;
|
|
499
739
|
const writesFetchHead = !this.dryRun && this.writeFetchHead && !!checkout?.writeFetchHead;
|
|
500
740
|
if (writesFetchHead && !this.appendFetchHead) await checkout.writeFetchHead?.("");
|
|
501
741
|
|
|
502
|
-
|
|
742
|
+
// fetch_one_setup_partial: the filter given (the remote registered as a promisor remote),
|
|
743
|
+
// else a promisor remote's own filter
|
|
744
|
+
let filter: string | undefined;
|
|
745
|
+
if (this.filterSpec !== false && !this.dryRun) {
|
|
746
|
+
if (typeof this.filterSpec === "string") {
|
|
747
|
+
filter = this.filterSpec;
|
|
748
|
+
if (viaConfig) {
|
|
749
|
+
registerPartialClone(store, this.remote, filter);
|
|
750
|
+
await store.save();
|
|
751
|
+
promisorOf(this._workingCopy)?.fetcher?.invalidate?.();
|
|
752
|
+
}
|
|
753
|
+
} else if (hasPromisorRemote(store)) {
|
|
754
|
+
filter = promisorRemotes(store).find((r) => r.name === this.remote)?.partialCloneFilter;
|
|
755
|
+
}
|
|
756
|
+
} else if (typeof this.filterSpec === "string") filter = this.filterSpec;
|
|
757
|
+
|
|
758
|
+
// fetch.fsckObjects / transfer.fsckObjects: index-pack --strict over each received pack
|
|
759
|
+
const compatibility = this.compatibility ?? this.hooks.compatibility;
|
|
760
|
+
const environment = hostEnvironmentOf(this.workingCopy);
|
|
761
|
+
const fsckWarnings: string[] = [];
|
|
762
|
+
const fsck = await fetchFsckOf(
|
|
763
|
+
{
|
|
764
|
+
value: (key) => store.value(key),
|
|
765
|
+
entries: (prefix) => store.entriesWithPrefix(prefix),
|
|
766
|
+
warnings: fsckWarnings,
|
|
767
|
+
compatibility,
|
|
768
|
+
...(environment
|
|
769
|
+
? { readFile: (path: string) => environment.readFile(path), home: environment.home }
|
|
770
|
+
: {}),
|
|
771
|
+
baseDir: await this.hostWorkingDir(),
|
|
772
|
+
},
|
|
773
|
+
this.checkFetchedObjects,
|
|
774
|
+
);
|
|
775
|
+
|
|
776
|
+
const fetchOptions: TransportFetchOptions = {
|
|
503
777
|
url: remoteUrl,
|
|
504
778
|
auth: this.credentials,
|
|
505
779
|
headers: this.headers,
|
|
506
780
|
timeout: this.timeout,
|
|
507
781
|
gzipRequests: this.gzipRequests,
|
|
508
|
-
repository: createRepositoryFacade({ history }),
|
|
782
|
+
repository: createRepositoryFacade({ history: historyWithoutLazyFetch(history) }),
|
|
509
783
|
refStore: createTransportRefStore(history.refs),
|
|
510
784
|
refspecs,
|
|
511
785
|
opportunisticRefspecs: opportunistic.length > 0 ? opportunistic : undefined,
|
|
512
|
-
// fetch.c do_fetch:
|
|
513
|
-
//
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
786
|
+
// fetch.c do_fetch: a branch a worktree has checked out is not fetched into (the
|
|
787
|
+
// whole fetch dies first, unless --update-head-ok); stale refs are pruned before
|
|
788
|
+
// anything is fetched, with command-line refspecs by those, else by the configured ones.
|
|
789
|
+
// With --atomic, prune_refs queues the deletions into the one transaction: a refused
|
|
790
|
+
// update or a failed commit leaves the stale refs too
|
|
791
|
+
beforeFetch: async (remoteRefs, refMap) => {
|
|
792
|
+
// check_not_current_branch over git's ref map: the refs the refspecs took and their
|
|
793
|
+
// opportunistic updates, not every advertised ref the configured refspecs would map
|
|
794
|
+
if (!this.updateHeadOk) await this.refuseCheckedOutBranch(refMap);
|
|
795
|
+
if (!prune) return;
|
|
796
|
+
const names = new Set(remoteRefs.filter((r) => r.oid).map((r) => r.name));
|
|
797
|
+
const pruneSpecs = (fromConfig ? configured : explicitSpecs).map((s) => parseRefSpec(s));
|
|
798
|
+
const defer = this.atomic && !this.dryRun;
|
|
799
|
+
const pruned = await this.pruneDeletedRefs(names, pruneSpecs, messages, errors, defer);
|
|
800
|
+
trackingUpdates.push(...pruned);
|
|
801
|
+
return defer ? { deletes: pruned.map((u) => u.localRef) } : undefined;
|
|
802
|
+
},
|
|
525
803
|
missingRefsOk: useConfig,
|
|
526
|
-
tags:
|
|
804
|
+
tags:
|
|
805
|
+
!this.tagOptionSet && store.followsTagsAlways(this.remote)
|
|
806
|
+
? "auto-always"
|
|
807
|
+
: toTagMode(this.effectiveTagOption()),
|
|
527
808
|
depth: this.depth,
|
|
528
809
|
deepenSince: this.shallowSince,
|
|
529
810
|
deepenNot: this.shallowExcludes.length > 0 ? this.shallowExcludes : undefined,
|
|
530
811
|
unshallow: this.unshallow || undefined,
|
|
812
|
+
updateShallow: this.updateShallow || undefined,
|
|
531
813
|
force: this.forceUpdate,
|
|
814
|
+
atomic: this.atomic || undefined,
|
|
532
815
|
dryRun: this.dryRun,
|
|
533
816
|
onProgress: this.progressMessageCallback,
|
|
534
|
-
|
|
817
|
+
// git's "fetch <args>: <what>" per ref; the action from the options, the remote and
|
|
818
|
+
// the refspecs given (git's argv)
|
|
819
|
+
reflogAction: this.reflogAction(
|
|
820
|
+
[
|
|
821
|
+
"fetch",
|
|
822
|
+
...this.commandLineOptions(),
|
|
823
|
+
...(this.remoteGiven || this.refSpecs.length > 0 ? [this.remote] : []),
|
|
824
|
+
...this.refSpecs,
|
|
825
|
+
].join(" "),
|
|
826
|
+
),
|
|
827
|
+
reflogIdent: this.reflogLine("").ident,
|
|
828
|
+
abbrev: parseCoreAbbrev(store.value("core.abbrev")) ?? -1,
|
|
829
|
+
...(fsck ? { fsckObjects: fsck } : {}),
|
|
830
|
+
...(filter ? { filter } : {}),
|
|
831
|
+
...(this.refetch ? { refetch: true } : {}),
|
|
832
|
+
};
|
|
833
|
+
// --upload-pack, else remote.<name>.uploadpack (transport_get)
|
|
834
|
+
const uploadPack = this.uploadPack ?? this.remoteProgram(this.remote, "uploadpack");
|
|
835
|
+
const sessionOptions = {
|
|
836
|
+
...this.remoteSessionOptions(),
|
|
837
|
+
...(uploadPack !== undefined ? { program: uploadPack } : {}),
|
|
838
|
+
};
|
|
839
|
+
// git's fetch runs with fetch_if_missing = 0: its walks read through the history's view
|
|
840
|
+
// without lazy fetch (the facade above), never a store-wide switch
|
|
841
|
+
const result = await withRemoteUploadPack(remote, sessionOptions, (connection) =>
|
|
842
|
+
fetchFromConnection(connection, fetchOptions),
|
|
843
|
+
).catch((error: unknown) => {
|
|
844
|
+
// git dies on a source that names no remote ref (a hidden one included)
|
|
845
|
+
const message = error instanceof Error ? error.message : "";
|
|
846
|
+
if (message.startsWith("couldn't find remote ref ")) {
|
|
847
|
+
throw new TransportError(`fatal: ${message}`, undefined, { cause: error });
|
|
848
|
+
}
|
|
849
|
+
// fetch-pack dies: the remote names objects with another hash
|
|
850
|
+
if (error instanceof ObjectFormatMismatchError) {
|
|
851
|
+
throw new TransportError(`fatal: ${message}`, undefined, { cause: error });
|
|
852
|
+
}
|
|
853
|
+
if (error instanceof FetchCheckError) {
|
|
854
|
+
// fetch-pack ran: its start-up warnings came first
|
|
855
|
+
const lines = [...fsckWarnings, ...error.lines];
|
|
856
|
+
// store_updated_refs: the ref tips' check failed; nothing is written
|
|
857
|
+
if (error.check === "refs") {
|
|
858
|
+
lines.push(`error: ${anonymizeUrl(remoteUrl)} did not send all necessary objects`);
|
|
859
|
+
if (compatibility === "2.43") lines.push("");
|
|
860
|
+
}
|
|
861
|
+
throw new FetchCheckError(error.check, lines, error.exitCode);
|
|
862
|
+
}
|
|
863
|
+
throw error;
|
|
535
864
|
});
|
|
865
|
+
// fetch-pack's start-up warnings (when it ran), then index-pack's fsck warnings
|
|
866
|
+
if (result.imports.length > 0) messages.push(...fsckWarnings);
|
|
867
|
+
messages.push(...(result.packCheckMessages ?? []));
|
|
536
868
|
|
|
537
869
|
const advertisedRefs = new Map<string, ObjectId>();
|
|
538
870
|
for (const ref of result.remoteRefs) {
|
|
539
871
|
if (ref.oid) advertisedRefs.set(ref.name, ref.oid);
|
|
540
872
|
}
|
|
541
873
|
trackingUpdates.push(...result.refUpdates.map(toTrackingRefUpdate));
|
|
874
|
+
// a failed --atomic transaction: git's error after the ref lines
|
|
875
|
+
if (result.refTransactionError !== undefined) errors.push(result.refTransactionError);
|
|
542
876
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
877
|
+
const marked = await this.fetchHeadEntries(result, {
|
|
878
|
+
given: given.length,
|
|
879
|
+
merge: mergeRefs,
|
|
880
|
+
// explicit refspecs (and the HEAD of an unconfigured remote) are all to merge;
|
|
881
|
+
// configured ones only when the first names one ref and no upstream is set
|
|
882
|
+
explicit: !useConfig,
|
|
883
|
+
firstIsExact: given.length > 0 && !parseRefSpec(given[0]).wildcard,
|
|
884
|
+
hasMerge: upstream !== undefined,
|
|
885
|
+
});
|
|
886
|
+
// store_updated_refs: a ref rejected for the shallow commits it needs is skipped, with
|
|
887
|
+
// git's warning when it is for merge
|
|
888
|
+
for (const e of marked) {
|
|
889
|
+
if (e.shallowRejected && !e.notForMerge) {
|
|
890
|
+
messages.push(
|
|
891
|
+
`warning: rejected ${e.localRef ?? e.remoteRef} because shallow roots are not allowed to be updated`,
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
const entries: FetchHeadEntry[] = marked
|
|
896
|
+
.filter((e) => !e.shallowRejected)
|
|
897
|
+
.map(({ oid, remoteRef, notForMerge }) => ({ oid, remoteRef, notForMerge }));
|
|
898
|
+
// do_fetch: a ref update refused (non-fast-forward, a tag it would clobber) jumps to the
|
|
899
|
+
// cleanup, past set_head (git 2.48+): the remote HEAD is not followed. FETCH_HEAD has its
|
|
900
|
+
// lines all the same (append_fetch_head writes each as the refs are stored), except with
|
|
901
|
+
// --atomic, where they wait for commit_fetch_head, which a refused or failed update skips:
|
|
902
|
+
// FETCH_HEAD stays as truncated. A failed --atomic transaction (the ref store refused it)
|
|
903
|
+
// jumps to the cleanup as well, past set_head; without --atomic the fetch goes on
|
|
904
|
+
const atomicFailed = this.atomic && result.refUpdates.some((u) => u.status === "rejected");
|
|
905
|
+
const refused = refusedUpdate(result) || atomicFailed;
|
|
906
|
+
if (writesFetchHead && checkout?.writeFetchHead && !atomicFailed) {
|
|
553
907
|
// after the truncation above, every fetch adds its lines
|
|
554
908
|
await checkout.writeFetchHead(formatFetchHead(entries, remoteUrl), { append: true });
|
|
555
909
|
}
|
|
910
|
+
const display = await this.displayLines(remoteUrl, trackingUpdates, result, entries, {
|
|
911
|
+
verbose: this.verbose,
|
|
912
|
+
porcelain: this.porcelain,
|
|
913
|
+
compact: !this.porcelain && store.value("fetch.output") === "compact",
|
|
914
|
+
});
|
|
556
915
|
|
|
557
|
-
if (followHead) {
|
|
916
|
+
if (followHead && !refused) {
|
|
558
917
|
// git: "way too many cases where this can go wrong ... fail silently"
|
|
559
918
|
try {
|
|
560
919
|
await this.setRemoteHead(result.remoteRefs, followHead, store, messages);
|
|
@@ -563,18 +922,173 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
563
922
|
}
|
|
564
923
|
}
|
|
565
924
|
|
|
925
|
+
// fetch.c: after the fetch (and its submodules), a split graph of what the refs reach
|
|
926
|
+
// (write_commit_graph_reachable with COMMIT_GRAPH_WRITE_SPLIT), on --write-commit-graph
|
|
927
|
+
// or fetch.writeCommitGraph
|
|
928
|
+
const commitGraphHashes = await this.writeCommitGraphAfterFetch(store, messages);
|
|
929
|
+
|
|
566
930
|
return {
|
|
567
931
|
uri: remoteUrl,
|
|
568
932
|
advertisedRefs,
|
|
569
933
|
trackingRefUpdates: trackingUpdates,
|
|
934
|
+
...(commitGraphHashes ? { commitGraph: commitGraphHashes } : {}),
|
|
570
935
|
defaultBranch: result.defaultBranch,
|
|
571
936
|
bytesReceived: result.packBytes,
|
|
572
937
|
isEmpty: result.isEmpty,
|
|
573
938
|
messages,
|
|
939
|
+
display,
|
|
574
940
|
...(errors.length > 0 ? { errors } : {}),
|
|
575
941
|
};
|
|
576
942
|
}
|
|
577
943
|
|
|
944
|
+
/**
|
|
945
|
+
* git's check_not_current_branch: the first branch of the ref map (the refs the refspecs
|
|
946
|
+
* took, then their opportunistic updates) that a worktree has checked out makes the fetch
|
|
947
|
+
* die, naming that worktree's path.
|
|
948
|
+
*/
|
|
949
|
+
private async refuseCheckedOutBranch(refMap: readonly { localRef?: string }[]): Promise<void> {
|
|
950
|
+
const worktrees = this._workingCopy.worktrees;
|
|
951
|
+
if (!worktrees) return;
|
|
952
|
+
const branches = refMap
|
|
953
|
+
.map((p) => p.localRef)
|
|
954
|
+
.filter((ref): ref is string => ref?.startsWith("refs/heads/") ?? false);
|
|
955
|
+
for (const ref of new Set(branches)) {
|
|
956
|
+
const wt = await worktreeUsingBranch(worktrees, ref);
|
|
957
|
+
if (wt) throw new FetchIntoCheckedOutBranchError(ref, wt.path);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* The lines git prints on stderr for the refs (fetch.c display_ref_update, full format):
|
|
963
|
+
* `From <url>`, the pruned refs (their summary column as wide as their own ids need), then
|
|
964
|
+
* the refs written or refused, in git's order: those to merge, the others the refspecs and
|
|
965
|
+
* tag following took, the opportunistic updates, the tags found in the fetched history;
|
|
966
|
+
* a ref fetched only into `FETCH_HEAD` as ` * branch <ref> -> FETCH_HEAD`. Refs already up
|
|
967
|
+
* to date are left out unless `verbose` (`-v`: ` = [up to date] …`). With `fetch.output`
|
|
968
|
+
* `compact`, a shared tail is written `*`; `porcelain` gives `--porcelain`'s lines (see
|
|
969
|
+
* {@link porcelainLine}).
|
|
970
|
+
*/
|
|
971
|
+
private async displayLines(
|
|
972
|
+
url: string,
|
|
973
|
+
tracking: readonly TrackingRefUpdate[],
|
|
974
|
+
result: FetchClientResult,
|
|
975
|
+
entries: readonly { remoteRef: string; notForMerge: boolean }[],
|
|
976
|
+
format: { verbose: boolean; porcelain: boolean; compact: boolean },
|
|
977
|
+
): Promise<string[]> {
|
|
978
|
+
const { verbose, porcelain, compact } = format;
|
|
979
|
+
const fetchedLocal = new Set(result.fetched.map((f) => f.localRef).filter((l) => l));
|
|
980
|
+
const backfilled = new Set(result.backfilledTags);
|
|
981
|
+
// refcol_width, once for every line: the ref map's refs written to a local ref (not the
|
|
982
|
+
// backfilled tags, not the pruned refs)
|
|
983
|
+
const refcolWidth = fetchRefcolWidth(
|
|
984
|
+
result.refUpdates
|
|
985
|
+
.filter((u) => !backfilled.has(u.localRef))
|
|
986
|
+
.map((u) => ({
|
|
987
|
+
remote: u.remoteRef,
|
|
988
|
+
local: u.localRef,
|
|
989
|
+
oldOid: u.oldOid,
|
|
990
|
+
newOid: u.newOid,
|
|
991
|
+
})),
|
|
992
|
+
{ verbose, compact },
|
|
993
|
+
);
|
|
994
|
+
// the prune's lines come first, with their own summary width (transport_summary_width of
|
|
995
|
+
// the stale refs: each one's absent old value and its value here)
|
|
996
|
+
const lines: string[] = [];
|
|
997
|
+
const pruned = tracking.filter((u) => u.status === RefUpdateStatus.DELETED);
|
|
998
|
+
if (pruned.length > 0) {
|
|
999
|
+
const ZERO_OID = this.objectFormat.nullId;
|
|
1000
|
+
const ids = pruned.flatMap((u) => [ZERO_OID, u.oldObjectId ?? ZERO_OID]);
|
|
1001
|
+
const width = transportSummaryWidth(ids, await this.idAbbreviator().lengths(ids));
|
|
1002
|
+
const prunedEntries = pruned.map((u) => ({
|
|
1003
|
+
code: "-",
|
|
1004
|
+
summary: "[deleted]",
|
|
1005
|
+
remote: "(none)",
|
|
1006
|
+
local: u.localRef,
|
|
1007
|
+
// prune_refs passes the stale ref's value as the old id, none as the new one
|
|
1008
|
+
oldOid: u.oldObjectId ?? ZERO_OID,
|
|
1009
|
+
newOid: ZERO_OID,
|
|
1010
|
+
}));
|
|
1011
|
+
if (porcelain) lines.push(...prunedEntries.map(porcelainLine));
|
|
1012
|
+
else {
|
|
1013
|
+
lines.push(
|
|
1014
|
+
...formatFetchDisplay(prunedEntries, { url, summaryWidth: width, refcolWidth, compact }),
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
const shown: FetchDisplayEntry[] = [];
|
|
1019
|
+
const toMerge = new Set(entries.filter((e) => !e.notForMerge).map((e) => e.remoteRef));
|
|
1020
|
+
const byLocal = new Map(result.refUpdates.map((u) => [u.localRef, u]));
|
|
1021
|
+
const taken = new Set<string>();
|
|
1022
|
+
const lineOf = (u: FetchRefUpdate | undefined) => {
|
|
1023
|
+
if (!u || taken.has(u.localRef)) return;
|
|
1024
|
+
taken.add(u.localRef);
|
|
1025
|
+
const entry = fetchUpdateDisplay(u, verbose);
|
|
1026
|
+
if (entry) shown.push(entry);
|
|
1027
|
+
};
|
|
1028
|
+
for (const merge of [true, false]) {
|
|
1029
|
+
for (const f of result.fetched) {
|
|
1030
|
+
if (f.shallowRejected || toMerge.has(f.remoteRef) !== merge) continue;
|
|
1031
|
+
if (f.localRef) {
|
|
1032
|
+
if (!backfilled.has(f.localRef)) lineOf(byLocal.get(f.localRef));
|
|
1033
|
+
} else if (
|
|
1034
|
+
(this.writeFetchHead || this.dryRun) &&
|
|
1035
|
+
// add_merge_config marks a ref the refspecs took already; only one they did not
|
|
1036
|
+
// take gets an entry of its own
|
|
1037
|
+
!result.fetched.some((o) => o.localRef && o.remoteRef === f.remoteRef)
|
|
1038
|
+
) {
|
|
1039
|
+
shown.push({
|
|
1040
|
+
code: "*",
|
|
1041
|
+
summary: fetchHeadKind(f.remoteRef),
|
|
1042
|
+
remote: f.remoteRef,
|
|
1043
|
+
local: "FETCH_HEAD",
|
|
1044
|
+
oldOid: this.objectFormat.nullId,
|
|
1045
|
+
newOid: f.oid,
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
for (const u of result.refUpdates) if (!fetchedLocal.has(u.localRef)) lineOf(u);
|
|
1051
|
+
for (const tag of result.backfilledTags) lineOf(byLocal.get(tag));
|
|
1052
|
+
// git 2.5x (do_fetch): a ref update refused (non-fast-forward, a tag it would clobber)
|
|
1053
|
+
// jumps to the cleanup before transport_summary_width is computed, so every line is
|
|
1054
|
+
// printed with a summary width of 0 (2.43 printed them as they come, padded)
|
|
1055
|
+
if (porcelain) return [...lines, ...shown.map(porcelainLine)];
|
|
1056
|
+
const summaryWidth = refusedUpdate(result) ? 0 : result.summaryWidth;
|
|
1057
|
+
const main = formatFetchDisplay(shown, { url, summaryWidth, refcolWidth, compact });
|
|
1058
|
+
// the URL line once, before whichever line comes first
|
|
1059
|
+
return lines.length > 0 ? [...lines, ...main.slice(1)] : main;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* git's write of the commit-graph at the end of a fetch: when `--write-commit-graph` or
|
|
1064
|
+
* `fetch.writeCommitGraph` asks and the repository's files are known, a split layer of the
|
|
1065
|
+
* commits the refs reach (merged with the layers below as `--split` merges them; existing
|
|
1066
|
+
* changed-path filters are kept). Its warnings join `messages` as git prints them. The
|
|
1067
|
+
* layer hashes of the chain written, base first; undefined when nothing was written.
|
|
1068
|
+
*/
|
|
1069
|
+
private async writeCommitGraphAfterFetch(
|
|
1070
|
+
store: RemoteConfigStore,
|
|
1071
|
+
messages: string[],
|
|
1072
|
+
): Promise<string[] | undefined> {
|
|
1073
|
+
const write =
|
|
1074
|
+
this.writeCommitGraphOption ?? configBool(store.value("fetch.writeCommitGraph")) ?? false;
|
|
1075
|
+
const repository = this.repositoryFiles;
|
|
1076
|
+
const history = this._workingCopy.history;
|
|
1077
|
+
if (!write || !repository || !history.objects) return undefined;
|
|
1078
|
+
const environment = hostEnvironmentOf(this._workingCopy);
|
|
1079
|
+
const result = await writeCommitGraph({
|
|
1080
|
+
files: repository.files,
|
|
1081
|
+
gitDir: repository.gitDir,
|
|
1082
|
+
objects: history.objects,
|
|
1083
|
+
refs: history.refs,
|
|
1084
|
+
commitGraph: history.commitGraph,
|
|
1085
|
+
split: true,
|
|
1086
|
+
...(environment ? { environment } : {}),
|
|
1087
|
+
});
|
|
1088
|
+
for (const warning of result.warnings) messages.push(`warning: ${warning}`);
|
|
1089
|
+
return result.written ? result.hashes : undefined;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
578
1092
|
/**
|
|
579
1093
|
* How `refs/remotes/<name>/HEAD` follows the remote HEAD (git 2.48+): the remote's
|
|
580
1094
|
* `remote.<name>.followRemoteHEAD`, else `fetch.followRemoteHEAD`, else `create`; an
|
|
@@ -622,7 +1136,10 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
622
1136
|
const target = baremirror ? `refs/heads/${headName}` : `refs/remotes/${remote}/${headName}`;
|
|
623
1137
|
if (!baremirror && !(await this.refsStore.resolve(target))?.objectId) return;
|
|
624
1138
|
const previous = await this.refsStore.get(name);
|
|
625
|
-
|
|
1139
|
+
// refs_update_symref_extended(..., "fetch", ...): logged with the literal "fetch"
|
|
1140
|
+
if (!createOnly || !previous) {
|
|
1141
|
+
await this.refsStore.setSymbolic(name, target, this.reflogLine("fetch"));
|
|
1142
|
+
}
|
|
626
1143
|
if (follow.mode !== "warn" || follow.noWarnBranch === headName || !previous) return;
|
|
627
1144
|
// warn_set_head
|
|
628
1145
|
const prefix = `refs/remotes/${remote}/`;
|
|
@@ -695,12 +1212,16 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
695
1212
|
firstIsExact: boolean;
|
|
696
1213
|
hasMerge: boolean;
|
|
697
1214
|
},
|
|
698
|
-
): Promise<FetchHeadEntry
|
|
1215
|
+
): Promise<Array<FetchHeadEntry & { localRef?: string; shallowRejected?: boolean }>> {
|
|
699
1216
|
const mergeSpec = (index: number | undefined) =>
|
|
700
1217
|
index !== undefined && index >= marks.given && index < marks.given + marks.merge.length
|
|
701
1218
|
? index - marks.given
|
|
702
1219
|
: undefined;
|
|
703
|
-
const entries: (FetchHeadEntry & {
|
|
1220
|
+
const entries: (FetchHeadEntry & {
|
|
1221
|
+
refspec?: number;
|
|
1222
|
+
localRef?: string;
|
|
1223
|
+
shallowRejected?: boolean;
|
|
1224
|
+
})[] = [];
|
|
704
1225
|
for (const fetched of result.fetched) {
|
|
705
1226
|
if (mergeSpec(fetched.refspec) !== undefined) continue;
|
|
706
1227
|
const fromGiven = fetched.refspec !== undefined && fetched.refspec < marks.given;
|
|
@@ -709,6 +1230,8 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
709
1230
|
remoteRef: fetched.remoteRef,
|
|
710
1231
|
notForMerge: !(marks.explicit && fromGiven),
|
|
711
1232
|
refspec: fetched.refspec,
|
|
1233
|
+
localRef: fetched.localRef,
|
|
1234
|
+
...(fetched.shallowRejected ? { shallowRejected: true } : {}),
|
|
712
1235
|
});
|
|
713
1236
|
}
|
|
714
1237
|
if (!marks.explicit) {
|
|
@@ -732,7 +1255,13 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
732
1255
|
for (const fetched of result.fetched) {
|
|
733
1256
|
const k = mergeSpec(fetched.refspec);
|
|
734
1257
|
if (k === undefined || matched.has(k)) continue;
|
|
735
|
-
extra.push({
|
|
1258
|
+
extra.push({
|
|
1259
|
+
oid: fetched.oid,
|
|
1260
|
+
remoteRef: fetched.remoteRef,
|
|
1261
|
+
notForMerge: false,
|
|
1262
|
+
localRef: fetched.localRef,
|
|
1263
|
+
...(fetched.shallowRejected ? { shallowRejected: true } : {}),
|
|
1264
|
+
});
|
|
736
1265
|
}
|
|
737
1266
|
const tagsAt = entries.findIndex((e) => e.refspec === undefined || e.refspec >= marks.given);
|
|
738
1267
|
entries.splice(tagsAt < 0 ? entries.length : tagsAt, 0, ...extra);
|
|
@@ -740,35 +1269,36 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
740
1269
|
for (const entry of entries) {
|
|
741
1270
|
if (!entry.notForMerge && !(await this.peelsToCommit(entry.oid))) entry.notForMerge = true;
|
|
742
1271
|
}
|
|
743
|
-
return entries.map(({ oid, remoteRef, notForMerge }) => ({
|
|
1272
|
+
return entries.map(({ oid, remoteRef, notForMerge, localRef, shallowRejected }) => ({
|
|
1273
|
+
oid,
|
|
1274
|
+
remoteRef,
|
|
1275
|
+
notForMerge,
|
|
1276
|
+
...(localRef !== undefined ? { localRef } : {}),
|
|
1277
|
+
...(shallowRejected ? { shallowRejected } : {}),
|
|
1278
|
+
}));
|
|
744
1279
|
}
|
|
745
1280
|
|
|
746
1281
|
/** Whether `id` is a commit, or a tag (chain) of one (git's lookup_commit_reference_gently). */
|
|
747
1282
|
private async peelsToCommit(id: ObjectId): Promise<boolean> {
|
|
748
|
-
|
|
1283
|
+
// parse_object reads through replace refs
|
|
1284
|
+
const commits = this.commits;
|
|
1285
|
+
const tags = this.tagsStore;
|
|
749
1286
|
let current: ObjectId | undefined = id;
|
|
750
1287
|
for (let i = 0; current && i < 16; i++) {
|
|
751
|
-
if (await
|
|
752
|
-
if (!(await
|
|
753
|
-
current = await
|
|
1288
|
+
if (await commits.has(current)) return true;
|
|
1289
|
+
if (!tags || !(await tags.has(current))) return false;
|
|
1290
|
+
current = await tags.getTarget(current);
|
|
754
1291
|
}
|
|
755
1292
|
return false;
|
|
756
1293
|
}
|
|
757
1294
|
|
|
758
1295
|
/**
|
|
759
|
-
* Resolve remote name to URL
|
|
760
|
-
*
|
|
761
|
-
*
|
|
762
|
-
* configuration. An unconfigured name is passed through unchanged, so a URL
|
|
763
|
-
* given straight to {@link setRemote} still works.
|
|
1296
|
+
* Resolve remote name to URL, as git's `remote_get`: a remote whose configuration gives it
|
|
1297
|
+
* a URL uses that (`remote.<name>.url`); anything else is a URL or path itself. Either is
|
|
1298
|
+
* rewritten by `url.<base>.insteadOf`.
|
|
764
1299
|
*/
|
|
765
1300
|
private async resolveRemoteUrl(remote: string): Promise<string | undefined> {
|
|
766
|
-
|
|
767
|
-
if (remote.includes("://") || remote.includes("@")) {
|
|
768
|
-
return remote;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
return RemoteConfigStore.from(this.workingCopy).urlFor(remote) ?? remote;
|
|
1301
|
+
return RemoteConfigStore.from(this.workingCopy).remoteUrlOf(remote);
|
|
772
1302
|
}
|
|
773
1303
|
|
|
774
1304
|
/**
|
|
@@ -776,7 +1306,8 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
776
1306
|
* refspecs map from remote refs (all of the matching refspecs: overlapping ones count
|
|
777
1307
|
* together), none of which the remote has, unless a negative refspec excludes it or it is
|
|
778
1308
|
* a symbolic ref. They are deleted (reflogs too) in one batch, logged `fetch: prune`, and
|
|
779
|
-
* reported as deleted; a dry run reports them only
|
|
1309
|
+
* reported as deleted; a dry run reports them only, `defer` leaves the deletion to the
|
|
1310
|
+
* --atomic transaction. The symbolic refs left dangling are
|
|
780
1311
|
* named in `messages` as git does. A refused delete does not stop the fetch: as in git
|
|
781
1312
|
* (which then exits 1), the error goes into `errors` and nothing is reported deleted.
|
|
782
1313
|
*/
|
|
@@ -785,6 +1316,8 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
785
1316
|
specs: RefSpec[],
|
|
786
1317
|
messages: string[],
|
|
787
1318
|
errors: string[],
|
|
1319
|
+
/** Leave the deletion to the caller (the --atomic transaction) */
|
|
1320
|
+
defer = false,
|
|
788
1321
|
): Promise<TrackingRefUpdate[]> {
|
|
789
1322
|
const negative = specs.filter((s) => s.negative && s.source);
|
|
790
1323
|
const mapping = specs.filter((s) => !s.negative && s.source && s.destination);
|
|
@@ -808,12 +1341,13 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
808
1341
|
if (stale.length === 0) return [];
|
|
809
1342
|
// refs_warn_dangling_symrefs: listed before the deletion, as the targets go
|
|
810
1343
|
const dangling = await this.danglingSymrefs(new Set(stale.map((r) => r.name)));
|
|
811
|
-
if (!this.dryRun) {
|
|
1344
|
+
if (!this.dryRun && !defer) {
|
|
812
1345
|
try {
|
|
813
1346
|
await deleteRefs(
|
|
814
1347
|
this.refsStore,
|
|
815
1348
|
stale.map((r) => r.name),
|
|
816
1349
|
"fetch: prune",
|
|
1350
|
+
{ legacy: this.hooks.compatibility === "2.43" },
|
|
817
1351
|
);
|
|
818
1352
|
} catch (error) {
|
|
819
1353
|
errors.push(error instanceof Error ? error.message : String(error));
|
|
@@ -854,6 +1388,13 @@ export class FetchCommand extends TransportCommand<FetchResult> {
|
|
|
854
1388
|
}
|
|
855
1389
|
}
|
|
856
1390
|
|
|
1391
|
+
/** fetch.c's kind of a ref fetched into `FETCH_HEAD` only: `branch`, `tag`, … (`branch` else). */
|
|
1392
|
+
function fetchHeadKind(name: string): string {
|
|
1393
|
+
if (name.startsWith("refs/tags/")) return "tag";
|
|
1394
|
+
if (name.startsWith("refs/remotes/")) return "remote-tracking branch";
|
|
1395
|
+
return "branch";
|
|
1396
|
+
}
|
|
1397
|
+
|
|
857
1398
|
/** The transport's tag mode for a {@link TagOption}. */
|
|
858
1399
|
export function toTagMode(option: TagOption): TagMode {
|
|
859
1400
|
switch (option) {
|
|
@@ -919,13 +1460,7 @@ function parseFollowRemoteHead(
|
|
|
919
1460
|
}
|
|
920
1461
|
|
|
921
1462
|
/** A git boolean config value; undefined when unset or not a boolean. */
|
|
922
|
-
|
|
923
|
-
if (value === undefined) return undefined;
|
|
924
|
-
const v = value.trim().toLowerCase();
|
|
925
|
-
if (v === "true" || v === "yes" || v === "on" || v === "1") return true;
|
|
926
|
-
if (v === "false" || v === "no" || v === "off" || v === "0" || v === "") return false;
|
|
927
|
-
return undefined;
|
|
928
|
-
}
|
|
1463
|
+
const configBool = (value: string | undefined): boolean | undefined => parseGitBool(value);
|
|
929
1464
|
|
|
930
1465
|
/** git's refname_match: `ref` (`main`, `heads/main`, `refs/heads/main`) names `fullName`. */
|
|
931
1466
|
function refNameMatches(ref: string, fullName: string): boolean {
|
|
@@ -938,3 +1473,22 @@ function refNameMatches(ref: string, fullName: string): boolean {
|
|
|
938
1473
|
`refs/remotes/${ref}/HEAD`,
|
|
939
1474
|
].includes(fullName);
|
|
940
1475
|
}
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* Whether a ref update was refused as git's update_local_ref refuses one (a non-fast-forward,
|
|
1479
|
+
* a tag it would clobber), not by the ref store: git 2.5x's do_fetch then goes to its
|
|
1480
|
+
* cleanup.
|
|
1481
|
+
*/
|
|
1482
|
+
function refusedUpdate(result: FetchClientResult): boolean {
|
|
1483
|
+
return result.refUpdates.some((u) => u.status === "rejected" && u.storeError === undefined);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
/**
|
|
1487
|
+
* A ref line of `git fetch --porcelain` (display_ref_update's porcelain format): the flag,
|
|
1488
|
+
* the old and new ids in full (zeros for none), the local ref's full name.
|
|
1489
|
+
*/
|
|
1490
|
+
function porcelainLine(entry: FetchDisplayEntry): string {
|
|
1491
|
+
// zeros of the width of the entry's other id (the repository's format)
|
|
1492
|
+
const zero = nullObjectIdLike(entry.oldOid ?? entry.newOid);
|
|
1493
|
+
return `${entry.code} ${entry.oldOid ?? zero} ${entry.newOid ?? zero} ${entry.local}`;
|
|
1494
|
+
}
|