@statewalker/vcs-commands 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/add-command.d.ts +70 -0
- package/dist/commands/add-command.d.ts.map +1 -1
- package/dist/commands/add-patch/add-patch.d.ts +7 -0
- package/dist/commands/add-patch/add-patch.d.ts.map +1 -1
- package/dist/commands/add-patch/patch-backend.d.ts.map +1 -1
- package/dist/commands/am/am-command.d.ts +102 -1
- package/dist/commands/am/am-command.d.ts.map +1 -1
- package/dist/commands/am/index.d.ts +1 -0
- package/dist/commands/am/index.d.ts.map +1 -1
- package/dist/commands/am/mailsplit.d.ts +88 -0
- package/dist/commands/am/mailsplit.d.ts.map +1 -0
- package/dist/commands/apply/apply-command.d.ts +2 -0
- package/dist/commands/apply/apply-command.d.ts.map +1 -1
- package/dist/commands/apply/apply-engine.d.ts.map +1 -1
- package/dist/commands/apply/apply-parse.d.ts +7 -0
- package/dist/commands/apply/apply-parse.d.ts.map +1 -1
- package/dist/commands/apply/index.d.ts +1 -1
- package/dist/commands/apply/index.d.ts.map +1 -1
- package/dist/commands/bisect/bisect-command.d.ts +2 -0
- package/dist/commands/bisect/bisect-command.d.ts.map +1 -1
- package/dist/commands/blame-command.d.ts +303 -8
- package/dist/commands/blame-command.d.ts.map +1 -1
- package/dist/commands/blame-ignore.d.ts +48 -0
- package/dist/commands/blame-ignore.d.ts.map +1 -0
- package/dist/commands/branch-command.d.ts +148 -18
- package/dist/commands/branch-command.d.ts.map +1 -1
- package/dist/commands/branch-info-command.d.ts +55 -0
- package/dist/commands/branch-info-command.d.ts.map +1 -0
- package/dist/commands/branch-tracking.d.ts +106 -17
- package/dist/commands/branch-tracking.d.ts.map +1 -1
- package/dist/commands/branch-upstream-command.d.ts +83 -0
- package/dist/commands/branch-upstream-command.d.ts.map +1 -0
- package/dist/commands/check-mailmap-command.d.ts +49 -0
- package/dist/commands/check-mailmap-command.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts +26 -3
- package/dist/commands/checkout-command.d.ts.map +1 -1
- package/dist/commands/checkout-paths.d.ts +4 -0
- package/dist/commands/checkout-paths.d.ts.map +1 -1
- package/dist/commands/cherry-command.d.ts +61 -0
- package/dist/commands/cherry-command.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +82 -1
- package/dist/commands/cherry-pick-command.d.ts.map +1 -1
- package/dist/commands/clean-command.d.ts +44 -0
- package/dist/commands/clean-command.d.ts.map +1 -1
- package/dist/commands/clean-interactive.d.ts +56 -0
- package/dist/commands/clean-interactive.d.ts.map +1 -0
- package/dist/commands/clone-command.d.ts +116 -2
- package/dist/commands/clone-command.d.ts.map +1 -1
- package/dist/commands/commit-command.d.ts +239 -5
- package/dist/commands/commit-command.d.ts.map +1 -1
- package/dist/commands/commit-reuse.d.ts +33 -0
- package/dist/commands/commit-reuse.d.ts.map +1 -0
- package/dist/commands/config-command.d.ts +236 -0
- package/dist/commands/config-command.d.ts.map +1 -0
- package/dist/commands/config-value-types.d.ts +91 -0
- package/dist/commands/config-value-types.d.ts.map +1 -0
- package/dist/commands/core-config.d.ts +20 -0
- package/dist/commands/core-config.d.ts.map +1 -1
- package/dist/commands/describe-command.d.ts +71 -64
- package/dist/commands/describe-command.d.ts.map +1 -1
- package/dist/commands/diff-color-config.d.ts +73 -0
- package/dist/commands/diff-color-config.d.ts.map +1 -0
- package/dist/commands/diff-command.d.ts +369 -10
- package/dist/commands/diff-command.d.ts.map +1 -1
- package/dist/commands/fetch-command.d.ts +80 -0
- package/dist/commands/fetch-command.d.ts.map +1 -1
- package/dist/commands/fetch-multiple-command.d.ts +193 -0
- package/dist/commands/fetch-multiple-command.d.ts.map +1 -0
- package/dist/commands/fmt-merge-msg-command.d.ts +124 -0
- package/dist/commands/fmt-merge-msg-command.d.ts.map +1 -0
- package/dist/commands/fork-point.d.ts +38 -0
- package/dist/commands/fork-point.d.ts.map +1 -0
- package/dist/commands/format-patch-command.d.ts +69 -3
- package/dist/commands/format-patch-command.d.ts.map +1 -1
- package/dist/commands/fsck/fetch-fsck.d.ts +51 -0
- package/dist/commands/fsck/fetch-fsck.d.ts.map +1 -1
- package/dist/commands/gc-command.d.ts +8 -0
- package/dist/commands/gc-command.d.ts.map +1 -1
- package/dist/commands/git-describe.d.ts +81 -4
- package/dist/commands/git-describe.d.ts.map +1 -1
- package/dist/commands/git-hooks.d.ts +50 -1
- package/dist/commands/git-hooks.d.ts.map +1 -1
- package/dist/commands/grep/grep-command.d.ts +210 -0
- package/dist/commands/grep/grep-command.d.ts.map +1 -0
- package/dist/commands/grep/grep-engine.d.ts +218 -0
- package/dist/commands/grep/grep-engine.d.ts.map +1 -0
- package/dist/commands/grep/index.d.ts +3 -0
- package/dist/commands/grep/index.d.ts.map +1 -0
- package/dist/commands/index-adder.d.ts +13 -2
- package/dist/commands/index-adder.d.ts.map +1 -1
- package/dist/commands/index.d.ts +38 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +5 -3
- package/dist/commands/init-command.d.ts +89 -0
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/interpret-trailers-command.d.ts +90 -0
- package/dist/commands/interpret-trailers-command.d.ts.map +1 -0
- package/dist/commands/line-log.d.ts +161 -0
- package/dist/commands/line-log.d.ts.map +1 -0
- package/dist/commands/local-transport.d.ts +36 -5
- package/dist/commands/local-transport.d.ts.map +1 -1
- package/dist/commands/log-command.d.ts +527 -13
- package/dist/commands/log-command.d.ts.map +1 -1
- package/dist/commands/log-graph.d.ts +30 -3
- package/dist/commands/log-graph.d.ts.map +1 -1
- package/dist/commands/log-output.d.ts +199 -6
- package/dist/commands/log-output.d.ts.map +1 -1
- package/dist/commands/ls-remote-command.d.ts +2 -0
- package/dist/commands/ls-remote-command.d.ts.map +1 -1
- package/dist/commands/mailmap.d.ts +53 -0
- package/dist/commands/mailmap.d.ts.map +1 -1
- package/dist/commands/merge-base-command.d.ts +60 -0
- package/dist/commands/merge-base-command.d.ts.map +1 -0
- package/dist/commands/merge-bases.d.ts +23 -0
- package/dist/commands/merge-bases.d.ts.map +1 -1
- package/dist/commands/merge-command.d.ts +147 -10
- package/dist/commands/merge-command.d.ts.map +1 -1
- package/dist/commands/merge-drivers.d.ts +2 -0
- package/dist/commands/merge-drivers.d.ts.map +1 -1
- package/dist/commands/merge-strategy-options.d.ts +69 -0
- package/dist/commands/merge-strategy-options.d.ts.map +1 -0
- package/dist/commands/merge-support.d.ts +10 -0
- package/dist/commands/merge-support.d.ts.map +1 -1
- package/dist/commands/message-cleanup.d.ts +2 -0
- package/dist/commands/message-cleanup.d.ts.map +1 -1
- package/dist/commands/mv-command.d.ts +4 -0
- package/dist/commands/mv-command.d.ts.map +1 -1
- package/dist/commands/name-rev-command.d.ts +65 -0
- package/dist/commands/name-rev-command.d.ts.map +1 -0
- package/dist/commands/name-rev.d.ts +136 -0
- package/dist/commands/name-rev.d.ts.map +1 -0
- package/dist/commands/notes-command.d.ts.map +1 -1
- package/dist/commands/octopus-merge.d.ts +26 -1
- package/dist/commands/octopus-merge.d.ts.map +1 -1
- package/dist/commands/ort-merge.d.ts +16 -0
- package/dist/commands/ort-merge.d.ts.map +1 -1
- package/dist/commands/ort-recursive.d.ts.map +1 -1
- package/dist/commands/patch-id.d.ts +58 -0
- package/dist/commands/patch-id.d.ts.map +1 -1
- package/dist/commands/pathspec-file.d.ts +39 -0
- package/dist/commands/pathspec-file.d.ts.map +1 -0
- package/dist/commands/pathspec.d.ts +3 -0
- package/dist/commands/pathspec.d.ts.map +1 -1
- package/dist/commands/pretty-format.d.ts +43 -3
- package/dist/commands/pretty-format.d.ts.map +1 -1
- package/dist/commands/promisor-remote.d.ts.map +1 -1
- package/dist/commands/pull-command.d.ts +186 -32
- package/dist/commands/pull-command.d.ts.map +1 -1
- package/dist/commands/push-command.d.ts +225 -9
- package/dist/commands/push-command.d.ts.map +1 -1
- package/dist/commands/range-diff/index.d.ts +4 -0
- package/dist/commands/range-diff/index.d.ts.map +1 -0
- package/dist/commands/range-diff/linear-assignment.d.ts +27 -0
- package/dist/commands/range-diff/linear-assignment.d.ts.map +1 -0
- package/dist/commands/range-diff/range-diff-command.d.ts +121 -0
- package/dist/commands/range-diff/range-diff-command.d.ts.map +1 -0
- package/dist/commands/range-diff/range-diff.d.ts +106 -0
- package/dist/commands/range-diff/range-diff.d.ts.map +1 -0
- package/dist/commands/read-tree-command.d.ts +20 -0
- package/dist/commands/read-tree-command.d.ts.map +1 -1
- package/dist/commands/rebase-command.d.ts +189 -8
- package/dist/commands/rebase-command.d.ts.map +1 -1
- package/dist/commands/ref-filter/for-each-ref-command.d.ts +121 -0
- package/dist/commands/ref-filter/for-each-ref-command.d.ts.map +1 -0
- package/dist/commands/ref-filter/index.d.ts +8 -0
- package/dist/commands/ref-filter/index.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-atoms.d.ts +88 -0
- package/dist/commands/ref-filter/ref-atoms.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-filter.d.ts +178 -0
- package/dist/commands/ref-filter/ref-filter.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-format.d.ts +222 -0
- package/dist/commands/ref-filter/ref-format.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-listing-command.d.ts +56 -0
- package/dist/commands/ref-filter/ref-listing-command.d.ts.map +1 -0
- package/dist/commands/ref-filter/ref-quote.d.ts +20 -0
- package/dist/commands/ref-filter/ref-quote.d.ts.map +1 -0
- package/dist/commands/ref-filter/version-compare.d.ts +20 -0
- package/dist/commands/ref-filter/version-compare.d.ts.map +1 -0
- package/dist/commands/reflog-command.d.ts +120 -0
- package/dist/commands/reflog-command.d.ts.map +1 -1
- package/dist/commands/reflog-walk.d.ts +72 -0
- package/dist/commands/reflog-walk.d.ts.map +1 -0
- package/dist/commands/remerge-diff.d.ts +59 -0
- package/dist/commands/remerge-diff.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +179 -29
- package/dist/commands/remote-command.d.ts.map +1 -1
- package/dist/commands/remote-show-command.d.ts +204 -0
- package/dist/commands/remote-show-command.d.ts.map +1 -0
- package/dist/commands/remote-transport.d.ts +7 -1
- package/dist/commands/remote-transport.d.ts.map +1 -1
- package/dist/commands/reset-command.d.ts +21 -4
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/restore-command.d.ts +9 -3
- package/dist/commands/restore-command.d.ts.map +1 -1
- package/dist/commands/rev-filter/commit-filter.d.ts +95 -0
- package/dist/commands/rev-filter/commit-filter.d.ts.map +1 -0
- package/dist/commands/rev-filter/commit-grep.d.ts +91 -0
- package/dist/commands/rev-filter/commit-grep.d.ts.map +1 -0
- package/dist/commands/rev-filter/index.d.ts +3 -0
- package/dist/commands/rev-filter/index.d.ts.map +1 -0
- package/dist/commands/rev-list-command.d.ts +226 -2
- package/dist/commands/rev-list-command.d.ts.map +1 -1
- package/dist/commands/revert-command.d.ts +54 -1
- package/dist/commands/revert-command.d.ts.map +1 -1
- package/dist/commands/revision-range.d.ts +34 -1
- package/dist/commands/revision-range.d.ts.map +1 -1
- package/dist/commands/revision-resolver.d.ts +15 -0
- package/dist/commands/revision-resolver.d.ts.map +1 -1
- package/dist/commands/rm-command.d.ts +70 -2
- package/dist/commands/rm-command.d.ts.map +1 -1
- package/dist/commands/sequencer-pick.d.ts +186 -5
- package/dist/commands/sequencer-pick.d.ts.map +1 -1
- package/dist/commands/sequencer-support.d.ts +12 -1
- package/dist/commands/sequencer-support.d.ts.map +1 -1
- package/dist/commands/serve-repository.d.ts +7 -0
- package/dist/commands/serve-repository.d.ts.map +1 -1
- package/dist/commands/shortlog-command.d.ts +109 -0
- package/dist/commands/shortlog-command.d.ts.map +1 -0
- package/dist/commands/shortlog.d.ts +151 -0
- package/dist/commands/shortlog.d.ts.map +1 -0
- package/dist/commands/show-command.d.ts +130 -0
- package/dist/commands/show-command.d.ts.map +1 -0
- package/dist/commands/show-commit.d.ts +11 -0
- package/dist/commands/show-commit.d.ts.map +1 -0
- package/dist/commands/signature-check.d.ts +164 -0
- package/dist/commands/signature-check.d.ts.map +1 -0
- package/dist/commands/signing.d.ts +160 -0
- package/dist/commands/signing.d.ts.map +1 -0
- package/dist/commands/sparse-checkout-command.d.ts.map +1 -1
- package/dist/commands/sparse-index-view.d.ts +45 -0
- package/dist/commands/sparse-index-view.d.ts.map +1 -0
- package/dist/commands/ssh-signer.d.ts +29 -0
- package/dist/commands/ssh-signer.d.ts.map +1 -0
- package/dist/commands/ssh-verifier.d.ts +42 -0
- package/dist/commands/ssh-verifier.d.ts.map +1 -0
- package/dist/commands/stash-apply-command.d.ts +5 -0
- package/dist/commands/stash-apply-command.d.ts.map +1 -1
- package/dist/commands/stash-branch-command.d.ts +34 -0
- package/dist/commands/stash-branch-command.d.ts.map +1 -0
- package/dist/commands/stash-create-command.d.ts +17 -0
- package/dist/commands/stash-create-command.d.ts.map +1 -1
- package/dist/commands/stash-info.d.ts +93 -0
- package/dist/commands/stash-info.d.ts.map +1 -0
- package/dist/commands/stash-list-command.d.ts +16 -0
- package/dist/commands/stash-list-command.d.ts.map +1 -1
- package/dist/commands/stash-pop-command.d.ts +39 -0
- package/dist/commands/stash-pop-command.d.ts.map +1 -0
- package/dist/commands/stash-show-command.d.ts +48 -0
- package/dist/commands/stash-show-command.d.ts.map +1 -0
- package/dist/commands/stash-store-command.d.ts +29 -0
- package/dist/commands/stash-store-command.d.ts.map +1 -0
- package/dist/commands/stash-working-tree.d.ts.map +1 -1
- package/dist/commands/status-command.d.ts +31 -2
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/status-header.d.ts +5 -0
- package/dist/commands/status-header.d.ts.map +1 -1
- package/dist/commands/submodule-add-command.d.ts +89 -0
- package/dist/commands/submodule-add-command.d.ts.map +1 -0
- package/dist/commands/submodule-auth.d.ts +90 -0
- package/dist/commands/submodule-auth.d.ts.map +1 -0
- package/dist/commands/submodule-commands.d.ts +463 -0
- package/dist/commands/submodule-commands.d.ts.map +1 -0
- package/dist/commands/submodule-fetch.d.ts +149 -0
- package/dist/commands/submodule-fetch.d.ts.map +1 -0
- package/dist/commands/submodule-model.d.ts +296 -0
- package/dist/commands/submodule-model.d.ts.map +1 -0
- package/dist/commands/submodule-unpack.d.ts +120 -0
- package/dist/commands/submodule-unpack.d.ts.map +1 -0
- package/dist/commands/submodule-update-command.d.ts +206 -0
- package/dist/commands/submodule-update-command.d.ts.map +1 -0
- package/dist/commands/subtree-shift.d.ts +27 -0
- package/dist/commands/subtree-shift.d.ts.map +1 -0
- package/dist/commands/switch-command.d.ts +3 -0
- package/dist/commands/switch-command.d.ts.map +1 -1
- package/dist/commands/tag-command.d.ts +259 -10
- package/dist/commands/tag-command.d.ts.map +1 -1
- package/dist/commands/trailers.d.ts +218 -17
- package/dist/commands/trailers.d.ts.map +1 -1
- package/dist/commands/tree-restore.d.ts +7 -0
- package/dist/commands/tree-restore.d.ts.map +1 -1
- package/dist/commands/verify-command.d.ts +92 -0
- package/dist/commands/verify-command.d.ts.map +1 -0
- package/dist/commands/worktree-add-command.d.ts +79 -7
- package/dist/commands/worktree-add-command.d.ts.map +1 -1
- package/dist/commands/worktree-overwrite-checks.d.ts +2 -0
- package/dist/commands/worktree-overwrite-checks.d.ts.map +1 -1
- package/dist/commands/worktree-path-rules.d.ts +66 -0
- package/dist/commands/worktree-path-rules.d.ts.map +1 -0
- package/dist/commands/worktree-remove-command.d.ts +10 -3
- package/dist/commands/worktree-remove-command.d.ts.map +1 -1
- package/dist/commands/worktree-repair-command.d.ts +15 -2
- package/dist/commands/worktree-repair-command.d.ts.map +1 -1
- package/dist/commands/worktree-support.d.ts +5 -0
- package/dist/commands/worktree-support.d.ts.map +1 -1
- package/dist/{commands-DIJ91NnD.js → commands-CNvli5bl.js} +49442 -54941
- package/dist/errors/checkout-errors.d.ts +19 -0
- package/dist/errors/checkout-errors.d.ts.map +1 -1
- package/dist/errors/command-errors.d.ts +25 -0
- package/dist/errors/command-errors.d.ts.map +1 -1
- package/dist/errors/index.js +85 -3
- package/dist/errors/ref-errors.d.ts +19 -0
- package/dist/errors/ref-errors.d.ts.map +1 -1
- package/dist/errors/worktree-errors.d.ts +6 -1
- package/dist/errors/worktree-errors.d.ts.map +1 -1
- package/dist/fsck-CPeDh9fh.js +5138 -0
- package/dist/git-command.d.ts +58 -2
- package/dist/git-command.d.ts.map +1 -1
- package/dist/git.d.ts +363 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/guarded-transport-command.d.ts +82 -0
- package/dist/guarded-transport-command.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/remote-config/index.d.ts +1 -1
- package/dist/remote-config/index.d.ts.map +1 -1
- package/dist/remote-config/remote-config-store.d.ts +55 -0
- package/dist/remote-config/remote-config-store.d.ts.map +1 -1
- package/dist/remote-transport-CCmBadm-.js +1606 -0
- package/dist/rename/detect-renames.d.ts +20 -0
- package/dist/rename/detect-renames.d.ts.map +1 -1
- package/dist/rename/diffcore-break.d.ts +51 -0
- package/dist/rename/diffcore-break.d.ts.map +1 -0
- package/dist/rename/index.d.ts +1 -0
- package/dist/rename/index.d.ts.map +1 -1
- package/dist/results/blame-format.d.ts +62 -1
- package/dist/results/blame-format.d.ts.map +1 -1
- package/dist/results/clone-result.d.ts +9 -0
- package/dist/results/clone-result.d.ts.map +1 -1
- package/dist/results/combined-diff.d.ts +3 -0
- package/dist/results/combined-diff.d.ts.map +1 -1
- package/dist/results/diff-check.d.ts +38 -0
- package/dist/results/diff-check.d.ts.map +1 -0
- package/dist/results/diff-color.d.ts +135 -0
- package/dist/results/diff-color.d.ts.map +1 -0
- package/dist/results/diff-dirstat.d.ts +36 -0
- package/dist/results/diff-dirstat.d.ts.map +1 -0
- package/dist/results/diff-entry.d.ts +10 -0
- package/dist/results/diff-entry.d.ts.map +1 -1
- package/dist/results/diff-formatter.d.ts.map +1 -1
- package/dist/results/diff-output.d.ts +103 -1
- package/dist/results/diff-output.d.ts.map +1 -1
- package/dist/results/diff-pickaxe.d.ts +67 -0
- package/dist/results/diff-pickaxe.d.ts.map +1 -0
- package/dist/results/diff-words.d.ts +55 -0
- package/dist/results/diff-words.d.ts.map +1 -0
- package/dist/results/fetch-result.d.ts +12 -1
- package/dist/results/fetch-result.d.ts.map +1 -1
- package/dist/results/index.d.ts +6 -0
- package/dist/results/index.d.ts.map +1 -1
- package/dist/results/index.js +2 -2
- package/dist/results/init-result.d.ts +8 -1
- package/dist/results/init-result.d.ts.map +1 -1
- package/dist/results/line-range-hunks.d.ts +27 -0
- package/dist/results/line-range-hunks.d.ts.map +1 -0
- package/dist/results/merge-result.d.ts +8 -1
- package/dist/results/merge-result.d.ts.map +1 -1
- package/dist/results/pull-result.d.ts +11 -0
- package/dist/results/pull-result.d.ts.map +1 -1
- package/dist/results/push-result.d.ts +12 -0
- package/dist/results/push-result.d.ts.map +1 -1
- package/dist/results/rebase-result.d.ts +2 -0
- package/dist/results/rebase-result.d.ts.map +1 -1
- package/dist/results/stash-result.d.ts +6 -0
- package/dist/results/stash-result.d.ts.map +1 -1
- package/dist/results/status-result.d.ts +1 -1
- package/dist/results/status-result.d.ts.map +1 -1
- package/dist/results-BDuEgdLU.js +46847 -0
- package/dist/transport-command.d.ts +14 -0
- package/dist/transport-command.d.ts.map +1 -1
- package/dist/whitespace/index.d.ts +2 -0
- package/dist/whitespace/index.d.ts.map +1 -0
- package/dist/whitespace/whitespace-rule.d.ts +94 -0
- package/dist/whitespace/whitespace-rule.d.ts.map +1 -0
- package/package.json +12 -12
- package/src/commands/add-command.ts +293 -17
- package/src/commands/add-patch/add-patch.ts +8 -0
- package/src/commands/add-patch/patch-backend.ts +20 -2
- package/src/commands/am/am-command.ts +400 -46
- package/src/commands/am/index.ts +1 -0
- package/src/commands/am/mailsplit.ts +326 -0
- package/src/commands/apply/apply-command.ts +58 -15
- package/src/commands/apply/apply-engine.ts +1 -1
- package/src/commands/apply/apply-parse.ts +17 -8
- package/src/commands/apply/index.ts +8 -1
- package/src/commands/bisect/bisect-command.ts +18 -5
- package/src/commands/blame-command.ts +1450 -51
- package/src/commands/blame-ignore.ts +307 -0
- package/src/commands/branch-command.ts +528 -53
- package/src/commands/branch-info-command.ts +150 -0
- package/src/commands/branch-tracking.ts +335 -60
- package/src/commands/branch-upstream-command.ts +218 -0
- package/src/commands/check-mailmap-command.ts +129 -0
- package/src/commands/checkout-command.ts +166 -55
- package/src/commands/checkout-paths.ts +28 -0
- package/src/commands/cherry-command.ts +187 -0
- package/src/commands/cherry-pick-command.ts +185 -1
- package/src/commands/clean-command.ts +126 -15
- package/src/commands/clean-interactive.ts +522 -0
- package/src/commands/clone-command.ts +598 -45
- package/src/commands/commit-command.ts +925 -74
- package/src/commands/commit-reuse.ts +94 -0
- package/src/commands/config-command.ts +1256 -0
- package/src/commands/config-value-types.ts +358 -0
- package/src/commands/core-config.ts +40 -0
- package/src/commands/describe-command.ts +341 -254
- package/src/commands/diff-color-config.ts +274 -0
- package/src/commands/diff-command.ts +1619 -99
- package/src/commands/fetch-command.ts +495 -14
- package/src/commands/fetch-multiple-command.ts +665 -0
- package/src/commands/fmt-merge-msg-command.ts +715 -0
- package/src/commands/fork-point.ts +63 -0
- package/src/commands/format-patch-command.ts +496 -116
- package/src/commands/fsck/fetch-fsck.ts +172 -18
- package/src/commands/gc-command.ts +31 -1
- package/src/commands/git-describe.ts +460 -201
- package/src/commands/git-hooks.ts +123 -3
- package/src/commands/grep/grep-command.ts +1077 -0
- package/src/commands/grep/grep-engine.ts +1024 -0
- package/src/commands/grep/index.ts +2 -0
- package/src/commands/index-adder.ts +46 -7
- package/src/commands/index.ts +43 -0
- package/src/commands/init-command.ts +603 -49
- package/src/commands/interpret-trailers-command.ts +256 -0
- package/src/commands/line-log.ts +931 -0
- package/src/commands/local-transport.ts +109 -10
- package/src/commands/log-command.ts +2599 -326
- package/src/commands/log-graph.ts +129 -29
- package/src/commands/log-output.ts +449 -27
- package/src/commands/ls-remote-command.ts +5 -0
- package/src/commands/mailmap.ts +155 -0
- package/src/commands/merge-base-command.ts +170 -0
- package/src/commands/merge-bases.ts +63 -8
- package/src/commands/merge-command.ts +601 -95
- package/src/commands/merge-drivers.ts +3 -0
- package/src/commands/merge-strategy-options.ts +224 -0
- package/src/commands/merge-support.ts +115 -22
- package/src/commands/message-cleanup.ts +1 -1
- package/src/commands/mv-command.ts +6 -3
- package/src/commands/name-rev-command.ts +184 -0
- package/src/commands/name-rev.ts +762 -0
- package/src/commands/notes-command.ts +11 -1
- package/src/commands/octopus-merge.ts +35 -11
- package/src/commands/ort-merge.ts +41 -7
- package/src/commands/ort-recursive.ts +40 -2
- package/src/commands/patch-id.ts +109 -0
- package/src/commands/pathspec-file.ts +72 -0
- package/src/commands/pathspec.ts +14 -2
- package/src/commands/pretty-format.ts +103 -19
- package/src/commands/promisor-remote.ts +10 -1
- package/src/commands/pull-command.ts +734 -221
- package/src/commands/push-command.ts +1035 -68
- package/src/commands/range-diff/index.ts +3 -0
- package/src/commands/range-diff/linear-assignment.ts +203 -0
- package/src/commands/range-diff/range-diff-command.ts +433 -0
- package/src/commands/range-diff/range-diff.ts +617 -0
- package/src/commands/read-tree-command.ts +102 -4
- package/src/commands/rebase-command.ts +1074 -194
- package/src/commands/ref-filter/for-each-ref-command.ts +298 -0
- package/src/commands/ref-filter/index.ts +7 -0
- package/src/commands/ref-filter/ref-atoms.ts +581 -0
- package/src/commands/ref-filter/ref-filter.ts +651 -0
- package/src/commands/ref-filter/ref-format.ts +1070 -0
- package/src/commands/ref-filter/ref-listing-command.ts +421 -0
- package/src/commands/ref-filter/ref-quote.ts +69 -0
- package/src/commands/ref-filter/version-compare.ts +177 -0
- package/src/commands/reflog-command.ts +492 -2
- package/src/commands/reflog-walk.ts +234 -0
- package/src/commands/remerge-diff.ts +241 -0
- package/src/commands/remote-command.ts +537 -69
- package/src/commands/remote-show-command.ts +836 -0
- package/src/commands/remote-transport.ts +9 -1
- package/src/commands/reset-command.ts +114 -34
- package/src/commands/restore-command.ts +27 -41
- package/src/commands/rev-filter/commit-filter.ts +159 -0
- package/src/commands/rev-filter/commit-grep.ts +444 -0
- package/src/commands/rev-filter/index.ts +2 -0
- package/src/commands/rev-list-command.ts +578 -15
- package/src/commands/revert-command.ts +123 -1
- package/src/commands/revision-range.ts +207 -5
- package/src/commands/revision-resolver.ts +23 -8
- package/src/commands/rm-command.ts +282 -21
- package/src/commands/sequencer-pick.ts +818 -111
- package/src/commands/sequencer-support.ts +184 -4
- package/src/commands/serve-repository.ts +18 -3
- package/src/commands/shortlog-command.ts +354 -0
- package/src/commands/shortlog.ts +361 -0
- package/src/commands/show-command.ts +491 -0
- package/src/commands/show-commit.ts +24 -0
- package/src/commands/signature-check.ts +657 -0
- package/src/commands/signing.ts +385 -0
- package/src/commands/sparse-checkout-command.ts +2 -9
- package/src/commands/sparse-checkout-support.ts +2 -2
- package/src/commands/sparse-index-view.ts +135 -0
- package/src/commands/ssh-signer.ts +199 -0
- package/src/commands/ssh-verifier.ts +523 -0
- package/src/commands/stash-apply-command.ts +16 -4
- package/src/commands/stash-branch-command.ts +88 -0
- package/src/commands/stash-create-command.ts +28 -0
- package/src/commands/stash-info.ts +243 -0
- package/src/commands/stash-list-command.ts +33 -0
- package/src/commands/stash-pop-command.ts +83 -0
- package/src/commands/stash-show-command.ts +141 -0
- package/src/commands/stash-store-command.ts +82 -0
- package/src/commands/stash-working-tree.ts +2 -2
- package/src/commands/status-command.ts +120 -27
- package/src/commands/status-format.ts +1 -1
- package/src/commands/status-header.ts +41 -7
- package/src/commands/submodule-add-command.ts +509 -0
- package/src/commands/submodule-auth.ts +276 -0
- package/src/commands/submodule-commands.ts +1835 -0
- package/src/commands/submodule-fetch.ts +789 -0
- package/src/commands/submodule-model.ts +938 -0
- package/src/commands/submodule-unpack.ts +265 -0
- package/src/commands/submodule-update-command.ts +1126 -0
- package/src/commands/subtree-shift.ts +215 -0
- package/src/commands/switch-command.ts +12 -1
- package/src/commands/tag-command.ts +876 -64
- package/src/commands/trailers.ts +837 -100
- package/src/commands/tree-restore.ts +44 -11
- package/src/commands/verify-command.ts +235 -0
- package/src/commands/worktree-add-command.ts +268 -24
- package/src/commands/worktree-overwrite-checks.ts +5 -0
- package/src/commands/worktree-path-rules.ts +183 -0
- package/src/commands/worktree-remove-command.ts +39 -5
- package/src/commands/worktree-repair-command.ts +52 -5
- package/src/commands/worktree-support.ts +22 -1
- package/src/errors/checkout-errors.ts +29 -0
- package/src/errors/command-errors.ts +37 -1
- package/src/errors/ref-errors.ts +23 -0
- package/src/errors/worktree-errors.ts +8 -1
- package/src/git-command.ts +153 -2
- package/src/git.ts +550 -1
- package/src/guarded-transport-command.ts +171 -0
- package/src/index.ts +1 -0
- package/src/remote-config/index.ts +2 -0
- package/src/remote-config/remote-config-store.ts +101 -0
- package/src/rename/detect-renames.ts +42 -8
- package/src/rename/diffcore-break.ts +166 -0
- package/src/rename/index.ts +1 -0
- package/src/results/blame-format.ts +268 -43
- package/src/results/clone-result.ts +6 -0
- package/src/results/combined-diff.ts +38 -18
- package/src/results/diff-check.ts +185 -0
- package/src/results/diff-color.ts +868 -0
- package/src/results/diff-dirstat.ts +117 -0
- package/src/results/diff-entry.ts +12 -0
- package/src/results/diff-formatter.ts +1 -0
- package/src/results/diff-output.ts +322 -32
- package/src/results/diff-pickaxe.ts +304 -0
- package/src/results/diff-words.ts +395 -0
- package/src/results/fetch-result.ts +12 -1
- package/src/results/index.ts +6 -0
- package/src/results/init-result.ts +10 -1
- package/src/results/line-range-hunks.ts +126 -0
- package/src/results/merge-result.ts +9 -0
- package/src/results/pull-result.ts +7 -0
- package/src/results/push-result.ts +12 -0
- package/src/results/rebase-result.ts +3 -0
- package/src/results/stash-result.ts +7 -0
- package/src/results/status-result.ts +2 -2
- package/src/transport-command.ts +34 -3
- package/src/whitespace/index.ts +1 -0
- package/src/{commands/apply/whitespace.ts → whitespace/whitespace-rule.ts} +173 -23
- package/dist/commands/apply/whitespace.d.ts +0 -58
- package/dist/commands/apply/whitespace.d.ts.map +0 -1
- package/dist/git-command-BGiOJ8Zk.js +0 -7246
- package/dist/results-WVlBhVb1.js +0 -2935
|
@@ -3,37 +3,64 @@ import { parseGitBool } from "@statewalker/vcs-utils";
|
|
|
3
3
|
import { type Checkout, isIndexUnborn } from "@statewalker/vcs-working-tree";
|
|
4
4
|
|
|
5
5
|
import { GitApiError, NoHeadError } from "../errors/index.js";
|
|
6
|
+
import { GuardedTransportCommand } from "../guarded-transport-command.js";
|
|
6
7
|
import { RemoteConfigStore } from "../remote-config/index.js";
|
|
7
|
-
import {
|
|
8
|
+
import type { FetchResult } from "../results/fetch-result.js";
|
|
9
|
+
import {
|
|
10
|
+
FastForwardMode,
|
|
11
|
+
isMergeSuccessful,
|
|
12
|
+
type MergeResult,
|
|
13
|
+
type MergeStrategy,
|
|
14
|
+
} from "../results/merge-result.js";
|
|
8
15
|
import type { PullResult } from "../results/pull-result.js";
|
|
9
16
|
import { isRebaseSuccessful, RebaseStatus } from "../results/rebase-result.js";
|
|
10
|
-
import {
|
|
17
|
+
import type { CommitEditor } from "./commit-command.js";
|
|
11
18
|
import { FetchCommand, TagOption } from "./fetch-command.js";
|
|
19
|
+
import { FetchMultipleCommand } from "./fetch-multiple-command.js";
|
|
12
20
|
import { commitsBaseSource, MergeBaseGraph } from "./merge-bases.js";
|
|
13
21
|
import { MergeCommand } from "./merge-command.js";
|
|
14
22
|
import { configValue } from "./merge-config.js";
|
|
23
|
+
import { OperationState, readIndex } from "./merge-support.js";
|
|
24
|
+
import { type CleanupMode, parseCleanupMode } from "./message-cleanup.js";
|
|
15
25
|
import { RebaseCommand } from "./rebase-command.js";
|
|
26
|
+
import { SubmoduleCommandError, type SubmoduleCommandResult } from "./submodule-commands.js";
|
|
27
|
+
import { type FetchRecurseSubmodules, submoduleTouchesInRange } from "./submodule-fetch.js";
|
|
28
|
+
import { SubmoduleUpdateCommand } from "./submodule-update-command.js";
|
|
29
|
+
|
|
30
|
+
/** One `FETCH_HEAD` entry to merge (pull.c's get_merge_heads). */
|
|
31
|
+
interface MergeHead {
|
|
32
|
+
objectId: ObjectId;
|
|
33
|
+
description: string;
|
|
34
|
+
}
|
|
16
35
|
|
|
17
36
|
/**
|
|
18
37
|
* Pull changes from a remote repository.
|
|
19
38
|
*
|
|
20
|
-
* Equivalent to `git pull`
|
|
39
|
+
* Equivalent to `git pull`: git's fetch (`git fetch [<remote> [<refspec>...]]`, the
|
|
40
|
+
* configured refspecs when none is given), then the `FETCH_HEAD` entries marked for merge
|
|
41
|
+
* merged into the current branch (`git merge FETCH_HEAD`), rebased onto (`--rebase`,
|
|
42
|
+
* `pull.rebase`), or branched off on an unborn branch (pull.c's `pull_into_void`). The
|
|
43
|
+
* options pull passes to git's merge, rebase and fetch are passed on the same way.
|
|
21
44
|
*
|
|
22
|
-
*
|
|
45
|
+
* Credentials and headers follow `GuardedTransportCommand`'s rule: {@link setCredentials} and
|
|
46
|
+
* {@link setHeaders} go only to the origins named with `addCredentialOrigin`, else to the
|
|
47
|
+
* default remote's origin (`branch.<name>.remote`, a name or a URL) while every remote the
|
|
48
|
+
* pull reaches has it, or to the URL given to {@link setRemote} when it names no configured
|
|
49
|
+
* remote; per-URL providers
|
|
50
|
+
* (`setCredentialsForUrl`, `setHeadersForUrl`) answer for their URL's origin; a redirect to
|
|
51
|
+
* another origin carries none. `--all` runs `FetchMultipleCommand` (git's fetch_multiple).
|
|
23
52
|
*
|
|
24
53
|
* @example
|
|
25
54
|
* ```typescript
|
|
26
|
-
* // Pull
|
|
55
|
+
* // Pull the current branch's upstream (branch.<name>.remote / .merge)
|
|
27
56
|
* const result = await git.pull().call();
|
|
28
57
|
*
|
|
29
|
-
* //
|
|
58
|
+
* // git pull --no-rebase --squash upstream main
|
|
30
59
|
* const result = await git.pull()
|
|
31
60
|
* .setRemote("upstream")
|
|
32
|
-
* .
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* const result = await git.pull()
|
|
36
|
-
* .setRemoteBranchName("develop")
|
|
61
|
+
* .setRemoteBranchName("main")
|
|
62
|
+
* .setRebase(false)
|
|
63
|
+
* .setSquash(true)
|
|
37
64
|
* .call();
|
|
38
65
|
*
|
|
39
66
|
* // Pull with rebase (`git pull --rebase`; without the option, pull.rebase decides)
|
|
@@ -42,19 +69,57 @@ import { RebaseCommand } from "./rebase-command.js";
|
|
|
42
69
|
* .call();
|
|
43
70
|
* ```
|
|
44
71
|
*/
|
|
45
|
-
export class PullCommand extends
|
|
72
|
+
export class PullCommand extends GuardedTransportCommand<PullResult> {
|
|
46
73
|
private remote = "origin";
|
|
47
74
|
/** Whether the remote was named (it is then in the reflog action). */
|
|
48
75
|
private remoteGiven = false;
|
|
49
|
-
|
|
76
|
+
/** The refspecs after the remote (`git pull <remote> <refspec>...`) */
|
|
77
|
+
private refSpecs: string[] = [];
|
|
50
78
|
/** `--rebase` / `--no-rebase`; undefined: branch.<name>.rebase, then pull.rebase */
|
|
51
79
|
private rebase?: boolean;
|
|
80
|
+
/** `--verify-signatures` / `--no-verify-signatures`, passed to the merge */
|
|
81
|
+
private verifySignatures?: boolean;
|
|
52
82
|
/** `--autostash` / `--no-autostash`; undefined: pull.autoStash, then rebase.autoStash */
|
|
53
83
|
private autoStash?: boolean;
|
|
54
84
|
private strategy?: MergeStrategy;
|
|
85
|
+
private strategyOptions: string[] = [];
|
|
55
86
|
private fastForwardMode?: FastForwardMode;
|
|
56
87
|
private tagOption?: TagOption;
|
|
57
88
|
private repositoryFiles?: { files: FilesApi; gitDir?: string };
|
|
89
|
+
// options passed to git-merge
|
|
90
|
+
private squash?: boolean;
|
|
91
|
+
private commit?: boolean;
|
|
92
|
+
private edit?: boolean;
|
|
93
|
+
private editor?: CommitEditor;
|
|
94
|
+
private log?: boolean | number;
|
|
95
|
+
private signoff?: boolean;
|
|
96
|
+
private cleanupMode?: CleanupMode;
|
|
97
|
+
private cleanupArg?: string;
|
|
98
|
+
private noVerify?: boolean;
|
|
99
|
+
private allowUnrelatedHistories = false;
|
|
100
|
+
// options passed to git-fetch
|
|
101
|
+
private all = false;
|
|
102
|
+
private prune?: boolean;
|
|
103
|
+
private depth?: number;
|
|
104
|
+
private deepen?: number;
|
|
105
|
+
private unshallow = false;
|
|
106
|
+
private force = false;
|
|
107
|
+
private compatibility?: "2.43" | "2.56";
|
|
108
|
+
private dryRun = false;
|
|
109
|
+
private recurseSubmodules?: FetchRecurseSubmodules;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* `--verify-signatures` (true) / `--no-verify-signatures` (false), passed to the merge as
|
|
113
|
+
* git's pull passes it (see `MergeCommand.setVerifySignatures`; undefined: the merge's
|
|
114
|
+
* `merge.verifySignatures`). Pulling into an unborn branch checks the commit whichever of
|
|
115
|
+
* the two is given (pull.c's `pull_into_void`); a rebasing pull ignores
|
|
116
|
+
* `--verify-signatures` with git's warning.
|
|
117
|
+
*/
|
|
118
|
+
setVerifySignatures(verify: boolean | undefined): this {
|
|
119
|
+
this.checkCallable();
|
|
120
|
+
this.verifySignatures = verify;
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
58
123
|
|
|
59
124
|
/**
|
|
60
125
|
* The files of the repository, for the fetch to write the commit-graph
|
|
@@ -67,9 +132,8 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
67
132
|
}
|
|
68
133
|
|
|
69
134
|
/**
|
|
70
|
-
* Set the remote to pull from
|
|
71
|
-
*
|
|
72
|
-
* Default is "origin".
|
|
135
|
+
* Set the remote to pull from: a configured remote's name, a path or a URL (git's
|
|
136
|
+
* `<repository>`). Default: the current branch's `branch.<name>.remote`, else `origin`.
|
|
73
137
|
*
|
|
74
138
|
* @param remote Remote name
|
|
75
139
|
*/
|
|
@@ -88,28 +152,41 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
88
152
|
}
|
|
89
153
|
|
|
90
154
|
/**
|
|
91
|
-
* Set the remote branch to pull.
|
|
155
|
+
* Set the remote branch to pull (one refspec, `git pull <remote> <branch>`).
|
|
92
156
|
*
|
|
93
|
-
* If not set,
|
|
157
|
+
* If not set, the remote's configured refspecs are fetched and the current branch's
|
|
158
|
+
* `branch.<name>.merge` is merged.
|
|
94
159
|
*
|
|
95
160
|
* @param branch Remote branch name
|
|
96
161
|
*/
|
|
97
162
|
setRemoteBranchName(branch: string): this {
|
|
98
163
|
this.checkCallable();
|
|
99
|
-
this.
|
|
164
|
+
this.refSpecs = [branch];
|
|
100
165
|
return this;
|
|
101
166
|
}
|
|
102
167
|
|
|
103
168
|
/**
|
|
104
|
-
* Get the remote branch name.
|
|
169
|
+
* Get the remote branch name (the first refspec).
|
|
105
170
|
*/
|
|
106
171
|
getRemoteBranchName(): string | undefined {
|
|
107
|
-
return this.
|
|
172
|
+
return this.refSpecs[0];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The refspecs to fetch (`git pull <remote> <refspec>...`): what they fetch is merged, two
|
|
177
|
+
* or more heads as an octopus.
|
|
178
|
+
*/
|
|
179
|
+
setRefSpecs(...refSpecs: string[]): this {
|
|
180
|
+
this.checkCallable();
|
|
181
|
+
this.refSpecs = [...refSpecs];
|
|
182
|
+
return this;
|
|
108
183
|
}
|
|
109
184
|
|
|
110
185
|
/**
|
|
111
186
|
* Set whether to use rebase instead of merge (`--rebase` / `--no-rebase`). Without it the
|
|
112
|
-
* configuration decides, as in git: `branch.<name>.rebase`, else `pull.rebase`, else merge
|
|
187
|
+
* configuration decides, as in git: `branch.<name>.rebase`, else `pull.rebase`, else merge
|
|
188
|
+
* (a pull that cannot fast-forward then refuses unless `pull.ff` or a fast-forward mode
|
|
189
|
+
* is given: git's "Need to specify how to reconcile divergent branches.").
|
|
113
190
|
* Only this option puts `--rebase` in the reflog lines (git's are the command line's).
|
|
114
191
|
*
|
|
115
192
|
* @param rebase Whether to use rebase
|
|
@@ -140,7 +217,7 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
140
217
|
}
|
|
141
218
|
|
|
142
219
|
/**
|
|
143
|
-
* Set the merge strategy.
|
|
220
|
+
* Set the merge strategy (`-s <strategy>`, passed to the merge or the rebase).
|
|
144
221
|
*
|
|
145
222
|
* @param strategy Merge strategy
|
|
146
223
|
*/
|
|
@@ -151,7 +228,19 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
151
228
|
}
|
|
152
229
|
|
|
153
230
|
/**
|
|
154
|
-
*
|
|
231
|
+
* `-X <option>` for each option (passed to the merge or the rebase, see
|
|
232
|
+
* `MergeCommand.setStrategyOptions`).
|
|
233
|
+
*/
|
|
234
|
+
setStrategyOptions(options: readonly string[]): this {
|
|
235
|
+
this.checkCallable();
|
|
236
|
+
this.strategyOptions = [...options];
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Set the fast-forward mode (`--ff`, `--no-ff`, `--ff-only`; default `pull.ff`). With
|
|
242
|
+
* `--ff-only` a pull whose branches diverged dies before merging or rebasing (git's
|
|
243
|
+
* `die_ff_impossible`), and one that can fast-forward merges even when a rebase is asked.
|
|
155
244
|
*
|
|
156
245
|
* @param mode Fast-forward mode
|
|
157
246
|
*/
|
|
@@ -169,7 +258,7 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
169
258
|
}
|
|
170
259
|
|
|
171
260
|
/**
|
|
172
|
-
* Set the specification of annotated tag behavior during fetch.
|
|
261
|
+
* Set the specification of annotated tag behavior during fetch (`--tags`, `--no-tags`).
|
|
173
262
|
*
|
|
174
263
|
* @param tagOption Tag option
|
|
175
264
|
*/
|
|
@@ -186,12 +275,169 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
186
275
|
return this.tagOption;
|
|
187
276
|
}
|
|
188
277
|
|
|
278
|
+
/** `--squash` / `--no-squash`, passed to the merge (see `MergeCommand.setSquash`). */
|
|
279
|
+
setSquash(squash: boolean): this {
|
|
280
|
+
this.checkCallable();
|
|
281
|
+
this.squash = squash;
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** `--commit` / `--no-commit`, passed to the merge (see `MergeCommand.setCommit`). */
|
|
286
|
+
setCommit(commit: boolean): this {
|
|
287
|
+
this.checkCallable();
|
|
288
|
+
this.commit = commit;
|
|
289
|
+
return this;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* `--edit` / `--no-edit`, passed to the merge: with `--edit` the merge commit's message
|
|
294
|
+
* goes through the editor ({@link setEditor}; see `MergeCommand.setEdit`). Without either
|
|
295
|
+
* the merge does not edit (git's default without a terminal).
|
|
296
|
+
*/
|
|
297
|
+
setEdit(edit: boolean): this {
|
|
298
|
+
this.checkCallable();
|
|
299
|
+
this.edit = edit;
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** The editor `--edit` runs over MERGE_MSG (git's `GIT_EDITOR`; see `CommitCommand.setEditor`). */
|
|
304
|
+
setEditor(editor: CommitEditor): this {
|
|
305
|
+
this.checkCallable();
|
|
306
|
+
this.editor = editor;
|
|
307
|
+
return this;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* `--log[=<n>]` / `--no-log`, passed to the merge (see `MergeCommand.setLog`): true is
|
|
312
|
+
* `--log`, a number `--log=<n>`, false `--no-log`.
|
|
313
|
+
*/
|
|
314
|
+
setLog(log: boolean | number): this {
|
|
315
|
+
this.checkCallable();
|
|
316
|
+
this.log = log;
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* `--signoff` / `--no-signoff`, passed to the merge, or to the rebase of a rebasing pull.
|
|
322
|
+
*/
|
|
323
|
+
setSignoff(signoff: boolean): this {
|
|
324
|
+
this.checkCallable();
|
|
325
|
+
this.signoff = signoff;
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* `--cleanup=<mode>`, passed to the merge. A mode git does not know dies before the fetch
|
|
331
|
+
* (`Invalid cleanup mode <mode>`).
|
|
332
|
+
*/
|
|
333
|
+
setCleanupMode(mode: CleanupMode | string): this {
|
|
334
|
+
this.checkCallable();
|
|
335
|
+
this.cleanupArg = mode;
|
|
336
|
+
return this;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** `--no-verify` (true) / `--verify` (false), passed to the merge. */
|
|
340
|
+
setNoVerify(noVerify: boolean): this {
|
|
341
|
+
this.checkCallable();
|
|
342
|
+
this.noVerify = noVerify;
|
|
343
|
+
return this;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** `--allow-unrelated-histories`, passed to the merge. */
|
|
347
|
+
setAllowUnrelatedHistories(allow: boolean): this {
|
|
348
|
+
this.checkCallable();
|
|
349
|
+
this.allowUnrelatedHistories = allow;
|
|
350
|
+
return this;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* `--all`: fetch every remote (but those with `remote.<name>.skipDefaultUpdate`), each
|
|
355
|
+
* appending to FETCH_HEAD as git's `fetch --all` does, then merge what the current
|
|
356
|
+
* branch's upstream marked for merge. Takes no remote or refspec.
|
|
357
|
+
*/
|
|
358
|
+
setAll(all: boolean): this {
|
|
359
|
+
this.checkCallable();
|
|
360
|
+
this.all = all;
|
|
361
|
+
return this;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** `--prune` / `--no-prune`, passed to the fetch (`FetchCommand.setRemoveDeletedRefs`). */
|
|
365
|
+
setPrune(prune: boolean): this {
|
|
366
|
+
this.checkCallable();
|
|
367
|
+
this.prune = prune;
|
|
368
|
+
return this;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** `--depth=<n>`, passed to the fetch. */
|
|
372
|
+
setDepth(depth: number): this {
|
|
373
|
+
this.checkCallable();
|
|
374
|
+
this.depth = depth;
|
|
375
|
+
return this;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/** `--deepen=<n>`, passed to the fetch (`FetchCommand.setDeepen`). */
|
|
379
|
+
setDeepen(deepen: number): this {
|
|
380
|
+
this.checkCallable();
|
|
381
|
+
this.deepen = deepen;
|
|
382
|
+
return this;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** `--unshallow`, passed to the fetch. */
|
|
386
|
+
setUnshallow(unshallow: boolean): this {
|
|
387
|
+
this.checkCallable();
|
|
388
|
+
this.unshallow = unshallow;
|
|
389
|
+
return this;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* The git version whose advice text the refusals follow (2.43: `hint: ` before an empty
|
|
394
|
+
* line, `git config advice.<name> false`); default the hooks' compatibility.
|
|
395
|
+
*/
|
|
396
|
+
setCompatibility(version: "2.43" | "2.56"): this {
|
|
397
|
+
this.checkCallable();
|
|
398
|
+
this.compatibility = version;
|
|
399
|
+
return this;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** `--force`, passed to the fetch (`FetchCommand.setForceUpdate`). */
|
|
403
|
+
setForce(force: boolean): this {
|
|
404
|
+
this.checkCallable();
|
|
405
|
+
this.force = force;
|
|
406
|
+
return this;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* `--dry-run`: the fetch only shows what it would do (`FetchCommand.setDryRun`), and
|
|
411
|
+
* nothing is merged or rebased.
|
|
412
|
+
*/
|
|
413
|
+
setDryRun(dryRun: boolean): this {
|
|
414
|
+
this.checkCallable();
|
|
415
|
+
this.dryRun = dryRun;
|
|
416
|
+
return this;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* `--recurse-submodules[=yes|on-demand|no]` / `--no-recurse-submodules` (true is `yes`,
|
|
421
|
+
* false `no`): passed to the fetch (`FetchCommand.setRecurseSubmodules`), and, unless
|
|
422
|
+
* `no`, once the merge or rebase succeeded the submodules are updated as `git submodule
|
|
423
|
+
* update --recursive --checkout` (`--rebase` for a rebasing pull) does, its output in
|
|
424
|
+
* {@link PullResult.submodules}. Unset, `submodule.recurse` decides (the fetch reads its
|
|
425
|
+
* own configuration). A rebasing pull that would recurse refuses local commits that
|
|
426
|
+
* record submodule changes (`cannot rebase with locally recorded submodule modifications`).
|
|
427
|
+
*/
|
|
428
|
+
setRecurseSubmodules(recurse: boolean | FetchRecurseSubmodules): this {
|
|
429
|
+
this.checkCallable();
|
|
430
|
+
this.recurseSubmodules = recurse === true ? "yes" : recurse === false ? "no" : recurse;
|
|
431
|
+
return this;
|
|
432
|
+
}
|
|
433
|
+
|
|
189
434
|
/**
|
|
190
435
|
* Execute the pull operation.
|
|
191
436
|
*
|
|
192
437
|
* @returns Pull result with fetch and merge results
|
|
193
|
-
* @throws NoHeadError if HEAD is
|
|
194
|
-
* @throws
|
|
438
|
+
* @throws NoHeadError if HEAD is detached and no refspec is given
|
|
439
|
+
* @throws GitApiError with git's stderr where git's pull dies (exit 128, or 1 when nothing
|
|
440
|
+
* fetched is to be merged)
|
|
195
441
|
*/
|
|
196
442
|
async call(): Promise<PullResult> {
|
|
197
443
|
this.checkCallable();
|
|
@@ -203,53 +449,74 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
203
449
|
|
|
204
450
|
// Get current branch
|
|
205
451
|
const currentBranch = await this.getCurrentBranch();
|
|
206
|
-
if (!currentBranch) {
|
|
452
|
+
if (!currentBranch && this.refSpecs.length === 0) {
|
|
207
453
|
throw new NoHeadError("Cannot pull with detached HEAD");
|
|
208
454
|
}
|
|
455
|
+
const localBranchName = currentBranch?.replace(/^refs\/heads\//, "");
|
|
209
456
|
|
|
210
|
-
// Extract branch name from full ref
|
|
211
|
-
const localBranchName = currentBranch.replace("refs/heads/", "");
|
|
212
|
-
|
|
213
|
-
// Determine remote branch
|
|
214
|
-
const remoteBranch = this.remoteBranchName || localBranchName;
|
|
215
|
-
|
|
216
|
-
// a remote read from .git/remotes/ or .git/branches/ (git 2.x) is pulled as pull.c does:
|
|
217
|
-
// `git fetch <remote> [<branch>]` with the remote's own refspecs, then the FETCH_HEAD
|
|
218
|
-
// entries marked for merge
|
|
219
|
-
await this.loadLegacyRemote(this.remote);
|
|
220
457
|
const store = RemoteConfigStore.from(this._workingCopy);
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
458
|
+
if (!this.remoteGiven && localBranchName !== undefined) {
|
|
459
|
+
// git fetch without a repository: the branch's remote, else origin
|
|
460
|
+
this.remote = store.remoteForBranch(localBranchName);
|
|
461
|
+
}
|
|
462
|
+
if (this.all && (this.remoteGiven || this.refSpecs.length > 0)) {
|
|
463
|
+
throw new GitApiError("fatal: fetch --all does not take a repository argument", {
|
|
464
|
+
exitCode: 128,
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
// get_cleanup_mode: an unknown mode dies before anything is fetched
|
|
468
|
+
if (this.cleanupArg !== undefined) {
|
|
469
|
+
let mode: CleanupMode;
|
|
470
|
+
try {
|
|
471
|
+
mode = parseCleanupMode(this.cleanupArg);
|
|
472
|
+
} catch {
|
|
473
|
+
throw new GitApiError(`fatal: Invalid cleanup mode ${this.cleanupArg}`, { exitCode: 128 });
|
|
474
|
+
}
|
|
475
|
+
this.cleanupMode = mode;
|
|
476
|
+
}
|
|
230
477
|
|
|
231
478
|
// git's GIT_REFLOG_ACTION for everything the pull writes: "pull" and its command-line
|
|
232
479
|
// arguments (a rebase or autostash the configuration asks for is not among them)
|
|
233
|
-
const action = this.reflogAction(
|
|
234
|
-
[
|
|
235
|
-
"pull",
|
|
236
|
-
...(this.rebase === true ? ["--rebase"] : this.rebase === false ? ["--no-rebase"] : []),
|
|
237
|
-
...(this.autoStash === true
|
|
238
|
-
? ["--autostash"]
|
|
239
|
-
: this.autoStash === false
|
|
240
|
-
? ["--no-autostash"]
|
|
241
|
-
: []),
|
|
242
|
-
...(this.fastForwardMode ? [`--${this.fastForwardMode}`] : []),
|
|
243
|
-
...(this.strategy ? [`--strategy=${this.strategy}`] : []),
|
|
244
|
-
...(this.tagOption === TagOption.FETCH_TAGS ? ["--tags"] : []),
|
|
245
|
-
...(this.tagOption === TagOption.NO_TAGS ? ["--no-tags"] : []),
|
|
246
|
-
...(this.remoteGiven || this.remoteBranchName ? [this.remote] : []),
|
|
247
|
-
...(this.remoteBranchName ? [this.remoteBranchName] : []),
|
|
248
|
-
].join(" "),
|
|
249
|
-
);
|
|
480
|
+
const action = this.reflogAction(this.commandLine().join(" "));
|
|
250
481
|
|
|
482
|
+
// pull.ff, unless a fast-forward mode is given; an explicit --rebase / --no-rebase turns
|
|
483
|
+
// pull.ff=only into --ff
|
|
484
|
+
let ff = this.fastForwardMode;
|
|
485
|
+
if (ff === undefined) {
|
|
486
|
+
ff = this.configFastForward();
|
|
487
|
+
if (this.rebase !== undefined && ff === FastForwardMode.FF_ONLY) ff = FastForwardMode.FF;
|
|
488
|
+
}
|
|
251
489
|
// git's pull.c: the option, else the configuration
|
|
252
|
-
const
|
|
490
|
+
const configured =
|
|
491
|
+
localBranchName !== undefined ? this.configRebase(localBranchName) : undefined;
|
|
492
|
+
let rebase = this.rebase ?? configured ?? false;
|
|
493
|
+
const rebaseUnspecified = this.rebase === undefined && configured === undefined;
|
|
494
|
+
|
|
495
|
+
// an index with unmerged entries, or a merge in progress, dies before the fetch
|
|
496
|
+
const { unmerged } = await readIndex(this.staging);
|
|
497
|
+
if (unmerged.length > 0) {
|
|
498
|
+
throw new GitApiError(
|
|
499
|
+
[
|
|
500
|
+
"error: Pulling is not possible because you have unmerged files.",
|
|
501
|
+
"hint: Fix them up in the work tree, and then use 'git add/rm <file>'",
|
|
502
|
+
"hint: as appropriate to mark resolution and make a commit.",
|
|
503
|
+
"fatal: Exiting because of an unresolved conflict.",
|
|
504
|
+
].join("\n"),
|
|
505
|
+
{ exitCode: 128 },
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
const checkout = (this._workingCopy as { checkout?: Checkout }).checkout;
|
|
509
|
+
if (await this.mergeInProgress()) {
|
|
510
|
+
throw new GitApiError(
|
|
511
|
+
[
|
|
512
|
+
"error: You have not concluded your merge (MERGE_HEAD exists).",
|
|
513
|
+
"hint: Please, commit your changes before merging.",
|
|
514
|
+
"fatal: Exiting because of unfinished merge.",
|
|
515
|
+
].join("\n"),
|
|
516
|
+
{ exitCode: 128 },
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
|
|
253
520
|
const pullAutoStash = this.autoStash ?? parseGitBool(this.config("pull.autoStash"));
|
|
254
521
|
const autoStash = rebase
|
|
255
522
|
? (pullAutoStash ?? parseGitBool(this.config("rebase.autoStash")) ?? false)
|
|
@@ -283,171 +550,361 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
283
550
|
}
|
|
284
551
|
}
|
|
285
552
|
|
|
286
|
-
//
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
if (this.repositoryFiles) {
|
|
314
|
-
fetchCommand.setRepositoryFiles(this.repositoryFiles);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const fetchResult = await fetchCommand.call();
|
|
318
|
-
|
|
319
|
-
let warnings: string[] = [];
|
|
320
|
-
let mergeTarget: { objectId: ObjectId; description?: string } | undefined;
|
|
321
|
-
if (legacy) {
|
|
322
|
-
if (fetchResult.isEmpty) {
|
|
323
|
-
return { fetchResult, successful: true, rebaseUsed: false, fetchedFrom: this.remote };
|
|
553
|
+
// a remote read from .git/remotes/ or .git/branches/ (git 2.x) is fetched with its own
|
|
554
|
+
// refspecs, as any other: `git fetch <remote> [<refspec>...]`
|
|
555
|
+
const fetchResults: FetchResult[] = [];
|
|
556
|
+
// remote_get(NULL): the branch's remote (a name, or a URL or path git allows there too)
|
|
557
|
+
const defaultRemoteUrl = store.remoteUrlOf(store.remoteForBranch(localBranchName));
|
|
558
|
+
if (this.all) {
|
|
559
|
+
// fetch --all: builtin/fetch.c's fetch_multiple (every remote fetched, a failure
|
|
560
|
+
// reported once all ran, skipDefaultUpdate / skipFetchAll honoured)
|
|
561
|
+
const multiple = new FetchMultipleCommand(this._workingCopy)
|
|
562
|
+
.setAll(true)
|
|
563
|
+
.setUpdateHeadOk(true)
|
|
564
|
+
.setEnvReflogAction(action);
|
|
565
|
+
if (this.prune !== undefined) multiple.setPrune(this.prune);
|
|
566
|
+
if (this.tagOption !== undefined) multiple.setTagOpt(this.tagOption);
|
|
567
|
+
if (this.dryRun) multiple.setDryRun(true);
|
|
568
|
+
if (this.force) multiple.setForceUpdate(true);
|
|
569
|
+
if (this.recurseSubmodules !== undefined)
|
|
570
|
+
multiple.setRecurseSubmodules(this.recurseSubmodules);
|
|
571
|
+
// credentials and headers: decided from every URL the fetch reaches, handed down
|
|
572
|
+
this.resolveAuth(await multiple.plannedUrls(), defaultRemoteUrl);
|
|
573
|
+
this.configureChild(multiple);
|
|
574
|
+
const fetched = await multiple.call();
|
|
575
|
+
for (const entry of fetched.fetches) if (entry.result) fetchResults.push(entry.result);
|
|
576
|
+
if (fetched.exitCode !== 0) {
|
|
577
|
+
// run_fetch failed: pull returns its status before merging anything
|
|
578
|
+
throw new GitApiError(fetched.stderr.replace(/\n$/, ""), { exitCode: fetched.exitCode });
|
|
324
579
|
}
|
|
325
|
-
|
|
326
|
-
mergeTarget = await this.mergeHeadFromFetchHead(localBranchName);
|
|
580
|
+
if (fetched.remotes.length === 1) this.remote = fetched.remotes[0] as string;
|
|
327
581
|
} else {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
// Get the remote tracking ref to merge
|
|
338
|
-
const resolved = await this.refsStore.resolve(trackingRef);
|
|
339
|
-
if (resolved?.objectId) mergeTarget = { objectId: resolved.objectId };
|
|
582
|
+
await this.loadLegacyRemote(this.remote);
|
|
583
|
+
// a URL the caller names (no configured remote) is the one this fetch is for: its
|
|
584
|
+
// origin is trusted, as FetchCommand trusts the URL it is given
|
|
585
|
+
const url = store.remoteUrlOf(this.remote);
|
|
586
|
+
const named = this.remoteGiven && !store.isConfigured(this.remote);
|
|
587
|
+
this.resolveAuth([url], named ? url : defaultRemoteUrl);
|
|
588
|
+
fetchResults.push(await this.fetchCommand(this.remote, this.refSpecs, action).call());
|
|
340
589
|
}
|
|
590
|
+
const fetchResult = fetchResults[fetchResults.length - 1];
|
|
591
|
+
const fetched = {
|
|
592
|
+
fetchResult,
|
|
593
|
+
...(fetchResults.length > 1 ? { fetchResults } : {}),
|
|
594
|
+
fetchedFrom: this.remote,
|
|
595
|
+
};
|
|
341
596
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const trackingRefResolved = mergeTarget;
|
|
352
|
-
// pull.c's warning() when the fetch moved the checked-out branch
|
|
353
|
-
const shown = warnings.length > 0 ? { warnings } : {};
|
|
597
|
+
// --dry-run: nothing more once fetched
|
|
598
|
+
if (this.dryRun) return { ...fetched, successful: true, rebaseUsed: false };
|
|
599
|
+
|
|
600
|
+
let warnings = await this.fastForwardMovedHead(origHead);
|
|
601
|
+
const shown = () => (warnings.length > 0 ? { warnings } : {});
|
|
602
|
+
|
|
603
|
+
const { heads, text: fetchHead } = await this.mergeHeadsFromFetchHead(checkout);
|
|
604
|
+
if (heads.length === 0) this.dieNoMergeCandidates(localBranchName, rebase);
|
|
605
|
+
const mergeIds = heads.map((h) => h.objectId);
|
|
354
606
|
|
|
355
607
|
// pull_into_void: an unborn branch (rebasing or not) branches off what was fetched, a
|
|
356
608
|
// two-way switch from the empty tree keeping the staged changes it does not overwrite
|
|
357
|
-
|
|
358
|
-
|
|
609
|
+
if (origHead === undefined) {
|
|
610
|
+
if (heads.length > 1) {
|
|
611
|
+
throw new GitApiError("fatal: Cannot merge multiple branches into empty head.", {
|
|
612
|
+
exitCode: 128,
|
|
613
|
+
});
|
|
614
|
+
}
|
|
359
615
|
const mergeResult = await new MergeCommand(this._workingCopy)
|
|
360
616
|
.shareHooksOf(this)
|
|
361
|
-
.
|
|
617
|
+
.setVerifySignatures(this.verifySignatures)
|
|
618
|
+
.callIntoVoid(mergeIds[0] as ObjectId);
|
|
362
619
|
return {
|
|
363
|
-
|
|
620
|
+
...fetched,
|
|
364
621
|
mergeResult,
|
|
365
622
|
successful: isMergeSuccessful(mergeResult.status),
|
|
366
623
|
rebaseUsed: false,
|
|
367
|
-
|
|
368
|
-
...shown,
|
|
624
|
+
...shown(),
|
|
369
625
|
};
|
|
370
626
|
}
|
|
627
|
+
if (heads.length > 1) {
|
|
628
|
+
if (rebase) {
|
|
629
|
+
throw new GitApiError("fatal: Cannot rebase onto multiple branches.", { exitCode: 128 });
|
|
630
|
+
}
|
|
631
|
+
if (ff === FastForwardMode.FF_ONLY) {
|
|
632
|
+
throw new GitApiError("fatal: Cannot fast-forward to multiple branches.", {
|
|
633
|
+
exitCode: 128,
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
371
637
|
|
|
372
|
-
// `git pull --rebase`: the branch rebased onto what was fetched
|
|
373
|
-
// (one that only fast-forwards is a `merge --ff-only --autostash`, as git's pull runs it)
|
|
374
|
-
const headId = (await this.refsStore.resolve("HEAD"))?.objectId;
|
|
375
638
|
const canFastForward =
|
|
639
|
+
heads.length === 1 && (await this.isAncestor(origHead, mergeIds[0] as ObjectId));
|
|
640
|
+
let upToDate = true;
|
|
641
|
+
if (!canFastForward) {
|
|
642
|
+
for (const id of mergeIds) {
|
|
643
|
+
if (!(await this.isAncestor(id, origHead))) {
|
|
644
|
+
upToDate = false;
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
const divergent = !canFastForward && !upToDate;
|
|
650
|
+
// ff-only takes precedence over rebase
|
|
651
|
+
if (ff === FastForwardMode.FF_ONLY) {
|
|
652
|
+
if (divergent) {
|
|
653
|
+
throw new GitApiError(
|
|
654
|
+
this.advice(
|
|
655
|
+
[
|
|
656
|
+
"Diverging branches can't be fast-forwarded, you need to either:",
|
|
657
|
+
"",
|
|
658
|
+
"\tgit merge --no-ff",
|
|
659
|
+
"",
|
|
660
|
+
"or:",
|
|
661
|
+
"",
|
|
662
|
+
"\tgit rebase",
|
|
663
|
+
],
|
|
664
|
+
"diverging",
|
|
665
|
+
"Not possible to fast-forward, aborting.",
|
|
666
|
+
),
|
|
667
|
+
{ exitCode: 128 },
|
|
668
|
+
);
|
|
669
|
+
}
|
|
670
|
+
rebase = false;
|
|
671
|
+
}
|
|
672
|
+
// no way to reconcile divergent branches given: git's advice, then it dies
|
|
673
|
+
if (ff === undefined && rebaseUnspecified && divergent) {
|
|
674
|
+
throw new GitApiError(
|
|
675
|
+
this.advice(
|
|
676
|
+
[
|
|
677
|
+
"You have divergent branches and need to specify how to reconcile them.",
|
|
678
|
+
"You can do so by running one of the following commands sometime before",
|
|
679
|
+
"your next pull:",
|
|
680
|
+
"",
|
|
681
|
+
" git config pull.rebase false # merge",
|
|
682
|
+
" git config pull.rebase true # rebase",
|
|
683
|
+
" git config pull.ff only # fast-forward only",
|
|
684
|
+
"",
|
|
685
|
+
'You can replace "git config" with "git config --global" to set a default',
|
|
686
|
+
"preference for all repositories. You can also pass --rebase, --no-rebase,",
|
|
687
|
+
"or --ff-only on the command line to override the configured default per",
|
|
688
|
+
"invocation.",
|
|
689
|
+
],
|
|
690
|
+
undefined,
|
|
691
|
+
"Need to specify how to reconcile divergent branches.",
|
|
692
|
+
),
|
|
693
|
+
{ exitCode: 128 },
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// pull.c: recurse_submodules from the command line, else submodule.recurse
|
|
698
|
+
const recurse = this.recurseSubmodules ?? this.configRecurseSubmodules();
|
|
699
|
+
const updatesSubmodules = recurse === "yes" || recurse === "on-demand";
|
|
700
|
+
if (
|
|
376
701
|
rebase &&
|
|
377
|
-
|
|
378
|
-
(await this.
|
|
702
|
+
updatesSubmodules &&
|
|
703
|
+
(await submoduleTouchesInRange(this._workingCopy, mergeIds[0] as ObjectId, origHead)) > 0
|
|
704
|
+
) {
|
|
705
|
+
throw new GitApiError("fatal: cannot rebase with locally recorded submodule modifications", {
|
|
706
|
+
exitCode: 128,
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
// rebase_submodules / update_submodules once the merge or rebase succeeded
|
|
710
|
+
const withSubmodules = async (result: PullResult): Promise<PullResult> => {
|
|
711
|
+
if (!updatesSubmodules || !result.successful) return result;
|
|
712
|
+
const submodules = await this.updateSubmodules(rebase ? "rebase" : "checkout");
|
|
713
|
+
return { ...result, submodules, successful: submodules.exitCode === 0 };
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
// `git pull --rebase`: the branch rebased onto what was fetched
|
|
717
|
+
// (one that only fast-forwards is a `merge --ff-only`, as git's pull runs it)
|
|
379
718
|
if (rebase && !canFastForward) {
|
|
380
|
-
|
|
719
|
+
// run_rebase
|
|
720
|
+
if (this.verifySignatures === true) {
|
|
721
|
+
warnings = [...warnings, "warning: ignoring --verify-signatures for rebase"];
|
|
722
|
+
}
|
|
723
|
+
const rebaseCommand = new RebaseCommand(this._workingCopy)
|
|
381
724
|
.shareHooksOf(this)
|
|
382
|
-
.setUpstream(
|
|
725
|
+
.setUpstream(mergeIds[0] as ObjectId)
|
|
383
726
|
.setReflogAction(action)
|
|
384
|
-
.setAutoStash(autoStash === true)
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
727
|
+
.setAutoStash(autoStash === true);
|
|
728
|
+
if (this.strategy) rebaseCommand.setStrategy(this.strategy);
|
|
729
|
+
if (this.strategyOptions.length > 0) rebaseCommand.setStrategyOptions(this.strategyOptions);
|
|
730
|
+
if (this.signoff !== undefined) rebaseCommand.setSignoff(this.signoff);
|
|
731
|
+
const rebaseResult = await rebaseCommand.call();
|
|
732
|
+
return withSubmodules({
|
|
733
|
+
...fetched,
|
|
388
734
|
rebaseResult,
|
|
389
735
|
successful: isRebaseSuccessful(rebaseResult.status),
|
|
390
736
|
rebaseUsed: true,
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
};
|
|
737
|
+
...shown(),
|
|
738
|
+
});
|
|
394
739
|
}
|
|
395
740
|
|
|
396
|
-
//
|
|
741
|
+
// run_merge: `git merge [<options>] FETCH_HEAD`
|
|
397
742
|
const mergeCommand = new MergeCommand(this._workingCopy).shareHooksOf(this);
|
|
398
|
-
mergeCommand.include(
|
|
399
|
-
// git
|
|
400
|
-
|
|
401
|
-
configValue(this._workingCopy, `remote.${this.remote}.url`) ??
|
|
402
|
-
store.remoteUrls(this.remote)[0] ??
|
|
403
|
-
this.remote
|
|
404
|
-
)
|
|
405
|
-
.replace(/\/+$/, "")
|
|
406
|
-
.replace(/\.git$/, "");
|
|
407
|
-
const into =
|
|
408
|
-
localBranchName === "main" || localBranchName === "master" ? "" : ` into ${localBranchName}`;
|
|
409
|
-
mergeCommand.setMessage(
|
|
410
|
-
mergeTarget.description
|
|
411
|
-
? `Merge ${mergeTarget.description}${into}`
|
|
412
|
-
: `Merge branch '${remoteBranch}' of ${url}${into}`,
|
|
413
|
-
);
|
|
743
|
+
for (const id of mergeIds) mergeCommand.include(id);
|
|
744
|
+
// git merges FETCH_HEAD: fmt-merge-msg describes the heads from its lines
|
|
745
|
+
mergeCommand.setMergeNames(fetchHead);
|
|
414
746
|
mergeCommand.setReflogAction(action);
|
|
415
|
-
|
|
747
|
+
const mergeFf = rebase ? FastForwardMode.FF_ONLY : ff;
|
|
748
|
+
if (mergeFf !== undefined) mergeCommand.setFastForwardMode(mergeFf);
|
|
749
|
+
if (this.verifySignatures !== undefined)
|
|
750
|
+
mergeCommand.setVerifySignatures(this.verifySignatures);
|
|
416
751
|
// run_merge passes --autostash / --no-autostash only when pull has one to give
|
|
417
752
|
if (autoStash !== undefined) mergeCommand.setAutoStash(autoStash);
|
|
753
|
+
if (this.strategy) mergeCommand.setStrategy(this.strategy);
|
|
754
|
+
if (this.strategyOptions.length > 0) mergeCommand.setStrategyOptions(this.strategyOptions);
|
|
755
|
+
if (this.squash !== undefined) mergeCommand.setSquash(this.squash);
|
|
756
|
+
if (this.commit !== undefined) mergeCommand.setCommit(this.commit);
|
|
757
|
+
if (this.edit !== undefined) mergeCommand.setEdit(this.edit);
|
|
758
|
+
if (this.editor) mergeCommand.setEditor(this.editor);
|
|
759
|
+
if (this.log !== undefined) mergeCommand.setLog(this.log);
|
|
760
|
+
if (this.signoff !== undefined) mergeCommand.setSignoff(this.signoff);
|
|
761
|
+
if (this.cleanupMode !== undefined) mergeCommand.setCleanupMode(this.cleanupMode);
|
|
762
|
+
if (this.noVerify !== undefined) mergeCommand.setNoVerify(this.noVerify);
|
|
763
|
+
if (this.allowUnrelatedHistories) mergeCommand.setAllowUnrelatedHistories(true);
|
|
418
764
|
|
|
419
|
-
|
|
420
|
-
mergeCommand.setStrategy(this.strategy);
|
|
421
|
-
}
|
|
422
|
-
if (this.fastForwardMode && !canFastForward) {
|
|
423
|
-
mergeCommand.setFastForwardMode(this.fastForwardMode);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
const mergeResult = await mergeCommand.call();
|
|
765
|
+
const mergeResult: MergeResult = await mergeCommand.call();
|
|
427
766
|
const successful = isMergeSuccessful(mergeResult.status);
|
|
428
767
|
|
|
429
|
-
if (
|
|
768
|
+
if (rebase) {
|
|
430
769
|
// a rebasing pull still reports a rebase: the fast-forward it made instead
|
|
431
|
-
return {
|
|
432
|
-
|
|
770
|
+
return withSubmodules({
|
|
771
|
+
...fetched,
|
|
433
772
|
mergeResult,
|
|
434
773
|
rebaseResult: successful
|
|
435
774
|
? { status: RebaseStatus.FAST_FORWARD, newHead: mergeResult.newHead }
|
|
436
775
|
: { status: RebaseStatus.FAILED, message: mergeResult.message },
|
|
437
776
|
successful,
|
|
438
777
|
rebaseUsed: true,
|
|
439
|
-
|
|
440
|
-
|
|
778
|
+
...shown(),
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
return withSubmodules({ ...fetched, mergeResult, successful, rebaseUsed: false, ...shown() });
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/** pull.c's `submodule.recurse`: a boolean (on or off), undefined when unset. */
|
|
785
|
+
private configRecurseSubmodules(): FetchRecurseSubmodules | undefined {
|
|
786
|
+
const values = RemoteConfigStore.from(this._workingCopy).valuesWithOrigin("submodule.recurse");
|
|
787
|
+
if (values.length === 0) return undefined;
|
|
788
|
+
const text = values[values.length - 1]?.text;
|
|
789
|
+
const bool = text === undefined ? true : parseGitBool(text);
|
|
790
|
+
if (bool === undefined) {
|
|
791
|
+
throw new GitApiError(`fatal: bad boolean config value '${text}' for 'submodule.recurse'`, {
|
|
792
|
+
exitCode: 128,
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
return bool ? "yes" : "no";
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/** `git submodule update --recursive --checkout|--rebase`: its output and exit status. */
|
|
799
|
+
private async updateSubmodules(mode: "checkout" | "rebase"): Promise<SubmoduleCommandResult> {
|
|
800
|
+
const update = new SubmoduleUpdateCommand(this._workingCopy)
|
|
801
|
+
.setRecursive(true)
|
|
802
|
+
.setMode(mode)
|
|
803
|
+
.setCompatibility(this.compatibility ?? this.hooks.compatibility);
|
|
804
|
+
update.shareHooksOf(this);
|
|
805
|
+
// the guarded transports: credentials and headers only where this pull's rule allows
|
|
806
|
+
update.setTransports(this.getTransports());
|
|
807
|
+
if (this.timeout !== undefined) update.setTimeout(this.timeout);
|
|
808
|
+
try {
|
|
809
|
+
return await update.call();
|
|
810
|
+
} catch (error) {
|
|
811
|
+
if (!(error instanceof SubmoduleCommandError)) throw error;
|
|
812
|
+
return {
|
|
813
|
+
stdout: error.result.stdout,
|
|
814
|
+
stderr: `${error.result.stderr}${error.message}\n`,
|
|
815
|
+
exitCode: error.exitCode,
|
|
441
816
|
};
|
|
442
817
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* git's advise() lines (`hint:`, 2.43's `hint: ` before an empty line), the
|
|
822
|
+
* `advise_if_enabled` hint naming `advice.<name>` when given, then the `fatal:` line.
|
|
823
|
+
*/
|
|
824
|
+
private advice(lines: string[], name: string | undefined, fatal: string): string {
|
|
825
|
+
const v243 = (this.compatibility ?? this.hooks.compatibility) === "2.43";
|
|
826
|
+
const out = lines.map((l) => (l === "" ? (v243 ? "hint: " : "hint:") : `hint: ${l}`));
|
|
827
|
+
if (name !== undefined) {
|
|
828
|
+
out.push(
|
|
829
|
+
v243 ? "hint: " : "hint:",
|
|
830
|
+
`hint: Disable this message with "git config${v243 ? "" : " set"} advice.${name} false"`,
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
out.push(`fatal: ${fatal}`);
|
|
834
|
+
return out.join("\n");
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* The pull's command line as git's reflog action spells it (`pull` and its arguments), in
|
|
839
|
+
* a fixed order since our options have none.
|
|
840
|
+
*/
|
|
841
|
+
private commandLine(): string[] {
|
|
842
|
+
const flag = (value: boolean | undefined, name: string) =>
|
|
843
|
+
value === true ? [`--${name}`] : value === false ? [`--no-${name}`] : [];
|
|
844
|
+
return [
|
|
845
|
+
"pull",
|
|
846
|
+
...flag(this.rebase, "rebase"),
|
|
847
|
+
...flag(this.autoStash, "autostash"),
|
|
848
|
+
...(this.log === undefined
|
|
849
|
+
? []
|
|
850
|
+
: typeof this.log === "number"
|
|
851
|
+
? [`--log=${this.log}`]
|
|
852
|
+
: flag(this.log, "log")),
|
|
853
|
+
...flag(this.signoff, "signoff"),
|
|
854
|
+
...flag(this.squash, "squash"),
|
|
855
|
+
...flag(this.commit, "commit"),
|
|
856
|
+
...flag(this.edit, "edit"),
|
|
857
|
+
...(this.cleanupArg !== undefined ? [`--cleanup=${this.cleanupArg}`] : []),
|
|
858
|
+
...(this.fastForwardMode ? [`--${this.fastForwardMode}`] : []),
|
|
859
|
+
...(this.noVerify === true ? ["--no-verify"] : this.noVerify === false ? ["--verify"] : []),
|
|
860
|
+
...flag(this.verifySignatures, "verify-signatures"),
|
|
861
|
+
...(this.strategy ? [`--strategy=${this.strategy}`] : []),
|
|
862
|
+
...this.strategyOptions.map((o) => `--strategy-option=${o}`),
|
|
863
|
+
...(this.allowUnrelatedHistories ? ["--allow-unrelated-histories"] : []),
|
|
864
|
+
...(this.all ? ["--all"] : []),
|
|
865
|
+
...(this.force ? ["--force"] : []),
|
|
866
|
+
...(this.dryRun ? ["--dry-run"] : []),
|
|
867
|
+
...(this.tagOption === TagOption.FETCH_TAGS ? ["--tags"] : []),
|
|
868
|
+
...(this.tagOption === TagOption.NO_TAGS ? ["--no-tags"] : []),
|
|
869
|
+
...flag(this.prune, "prune"),
|
|
870
|
+
...(this.depth !== undefined ? [`--depth=${this.depth}`] : []),
|
|
871
|
+
...(this.deepen !== undefined ? [`--deepen=${this.deepen}`] : []),
|
|
872
|
+
...(this.unshallow ? ["--unshallow"] : []),
|
|
873
|
+
...(this.remoteGiven || this.refSpecs.length > 0 ? [this.remote] : []),
|
|
874
|
+
...this.refSpecs,
|
|
875
|
+
];
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* run_fetch: `git fetch [<options>] <remote> [<refspec>...]` with the pull's options, over
|
|
880
|
+
* the guarded transports (the credentials and headers go only where they are for).
|
|
881
|
+
*/
|
|
882
|
+
private fetchCommand(remote: string, refSpecs: string[], action: string): FetchCommand {
|
|
883
|
+
const fetchCommand = this.configureChild(new FetchCommand(this._workingCopy));
|
|
884
|
+
fetchCommand.setRemote(remote);
|
|
885
|
+
fetchCommand.setRefSpecs(...refSpecs);
|
|
886
|
+
// git pull fetches with --update-head-ok
|
|
887
|
+
fetchCommand.setUpdateHeadOk(true);
|
|
888
|
+
fetchCommand.setReflogAction(action);
|
|
889
|
+
if (this.tagOption) fetchCommand.setTagOpt(this.tagOption);
|
|
890
|
+
if (this.prune !== undefined) fetchCommand.setRemoveDeletedRefs(this.prune);
|
|
891
|
+
if (this.depth !== undefined) fetchCommand.setDepth(this.depth);
|
|
892
|
+
if (this.deepen !== undefined) fetchCommand.setDeepen(this.deepen);
|
|
893
|
+
if (this.unshallow) fetchCommand.setUnshallow(true);
|
|
894
|
+
if (this.force) fetchCommand.setForceUpdate(true);
|
|
895
|
+
if (this.dryRun) fetchCommand.setDryRun(true);
|
|
896
|
+
if (this.repositoryFiles) fetchCommand.setRepositoryFiles(this.repositoryFiles);
|
|
897
|
+
if (this.recurseSubmodules !== undefined) {
|
|
898
|
+
fetchCommand.setRecurseSubmodules(this.recurseSubmodules);
|
|
899
|
+
}
|
|
900
|
+
return fetchCommand;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/** Whether MERGE_HEAD exists (pull.c's `file_exists(git_path_merge_head())`). */
|
|
904
|
+
private async mergeInProgress(): Promise<boolean> {
|
|
905
|
+
const state = new OperationState(this._workingCopy.checkout, this.refsStore);
|
|
906
|
+
if ((await state.read("MERGE_HEAD")) !== undefined) return true;
|
|
907
|
+
return (await state.ref("MERGE_HEAD")) !== undefined;
|
|
451
908
|
}
|
|
452
909
|
|
|
453
910
|
/**
|
|
@@ -486,66 +943,122 @@ export class PullCommand extends TransportCommand<PullResult> {
|
|
|
486
943
|
}
|
|
487
944
|
|
|
488
945
|
/**
|
|
489
|
-
* pull.c's `get_merge_heads`: the
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
* @throws GitApiError with `die_no_merge_candidates`' lines (exit 1) when there is none
|
|
946
|
+
* pull.c's `get_merge_heads`: the FETCH_HEAD entries not marked `not-for-merge`, with the
|
|
947
|
+
* file's text (what `git merge FETCH_HEAD` gives fmt-merge-msg).
|
|
493
948
|
*/
|
|
494
|
-
private async
|
|
495
|
-
|
|
496
|
-
): Promise<{
|
|
497
|
-
const checkout = (this._workingCopy as { checkout?: Checkout }).checkout;
|
|
949
|
+
private async mergeHeadsFromFetchHead(
|
|
950
|
+
checkout: Checkout | undefined,
|
|
951
|
+
): Promise<{ heads: MergeHead[]; text: string }> {
|
|
498
952
|
const text = (await checkout?.readFetchHead?.()) ?? "";
|
|
953
|
+
const heads: MergeHead[] = [];
|
|
499
954
|
for (const line of text.split("\n")) {
|
|
500
955
|
const m = /^([0-9a-f]{40,64})\t([^\t]*)\t(.*)$/.exec(line);
|
|
501
956
|
if (!m || m[2] === "not-for-merge") continue;
|
|
502
|
-
|
|
957
|
+
heads.push({ objectId: m[1] as ObjectId, description: m[3] as string });
|
|
503
958
|
}
|
|
959
|
+
return { heads, text };
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* pull.c's `die_no_merge_candidates`: why nothing fetched is to be merged.
|
|
964
|
+
*
|
|
965
|
+
* @throws GitApiError with git's lines (exit 1)
|
|
966
|
+
*/
|
|
967
|
+
private dieNoMergeCandidates(branch: string | undefined, rebase: boolean): never {
|
|
504
968
|
const store = RemoteConfigStore.from(this._workingCopy);
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
"
|
|
969
|
+
const branchRemote = branch !== undefined ? store.value(`branch.${branch}.remote`) : undefined;
|
|
970
|
+
const which = rebase
|
|
971
|
+
? "Please specify which branch you want to rebase against."
|
|
972
|
+
: "Please specify which branch you want to merge with.";
|
|
973
|
+
let lines: string[];
|
|
974
|
+
if (this.refSpecs.length > 0) {
|
|
975
|
+
lines = [
|
|
976
|
+
rebase
|
|
977
|
+
? "There is no candidate for rebasing against among the refs that you just fetched."
|
|
978
|
+
: "There are no candidates for merging among the refs that you just fetched.",
|
|
979
|
+
"Generally this means that you provided a wildcard refspec which had no",
|
|
980
|
+
"matches on the remote end.",
|
|
981
|
+
];
|
|
982
|
+
} else if (this.remoteGiven && branch !== undefined && branchRemote !== this.remote) {
|
|
983
|
+
lines = [
|
|
984
|
+
`You asked to pull from the remote '${this.remote}', but did not specify`,
|
|
985
|
+
"a branch. Because this is not the default configured remote",
|
|
986
|
+
"for your current branch, you must specify a branch on the command line.",
|
|
987
|
+
];
|
|
988
|
+
} else if (branch === undefined) {
|
|
989
|
+
lines = [
|
|
990
|
+
"You are not currently on a branch.",
|
|
991
|
+
which,
|
|
992
|
+
"See git-pull(1) for details.",
|
|
993
|
+
"",
|
|
994
|
+
" git pull <remote> <branch>",
|
|
995
|
+
"",
|
|
996
|
+
];
|
|
997
|
+
} else if (store.values(`branch.${branch}.merge`).length === 0) {
|
|
998
|
+
const remotes = store.configuredNames();
|
|
999
|
+
const remoteName = remotes.length === 1 ? remotes[0] : "<remote>";
|
|
1000
|
+
lines = [
|
|
1001
|
+
"There is no tracking information for the current branch.",
|
|
1002
|
+
which,
|
|
1003
|
+
"See git-pull(1) for details.",
|
|
1004
|
+
"",
|
|
1005
|
+
" git pull <remote> <branch>",
|
|
1006
|
+
"",
|
|
1007
|
+
"If you wish to set tracking information for this branch you can do so with:",
|
|
1008
|
+
"",
|
|
1009
|
+
` git branch --set-upstream-to=${remoteName}/<branch> ${branch}`,
|
|
1010
|
+
"",
|
|
1011
|
+
];
|
|
516
1012
|
} else {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
1013
|
+
const merge = store.values(`branch.${branch}.merge`)[0] ?? "";
|
|
1014
|
+
lines = [
|
|
1015
|
+
`Your configuration specifies to merge with the ref '${merge}'`,
|
|
1016
|
+
"from the remote, but no such ref was fetched.",
|
|
1017
|
+
];
|
|
520
1018
|
}
|
|
521
|
-
throw new GitApiError(
|
|
1019
|
+
throw new GitApiError(lines.join("\n"), { exitCode: 1 });
|
|
522
1020
|
}
|
|
523
1021
|
|
|
524
1022
|
private config(key: string): string | undefined {
|
|
525
1023
|
return configValue(this._workingCopy, key);
|
|
526
1024
|
}
|
|
527
1025
|
|
|
1026
|
+
/**
|
|
1027
|
+
* git's config_get_ff: `pull.ff` (false `--no-ff`, true `--ff`, `only` `--ff-only`).
|
|
1028
|
+
*
|
|
1029
|
+
* @throws GitApiError for any other value (`invalid value for 'pull.ff'`)
|
|
1030
|
+
*/
|
|
1031
|
+
private configFastForward(): FastForwardMode | undefined {
|
|
1032
|
+
const value = this.config("pull.ff");
|
|
1033
|
+
if (value === undefined) return undefined;
|
|
1034
|
+
const bool = parseGitBool(value);
|
|
1035
|
+
if (bool === true) return FastForwardMode.FF;
|
|
1036
|
+
if (bool === false) return FastForwardMode.NO_FF;
|
|
1037
|
+
if (value === "only") return FastForwardMode.FF_ONLY;
|
|
1038
|
+
throw new GitApiError(`fatal: invalid value for 'pull.ff': '${value}'`, { exitCode: 128 });
|
|
1039
|
+
}
|
|
1040
|
+
|
|
528
1041
|
/**
|
|
529
1042
|
* git's config_get_rebase: `branch.<name>.rebase`, else `pull.rebase`; any value other
|
|
530
|
-
* than false (`true`, `merges`, `interactive`) rebases.
|
|
1043
|
+
* than false (`true`, `merges`, `interactive`) rebases. Undefined when neither is set.
|
|
531
1044
|
*/
|
|
532
|
-
private configRebase(branch: string): boolean {
|
|
1045
|
+
private configRebase(branch: string): boolean | undefined {
|
|
533
1046
|
for (const key of [`branch.${branch}.rebase`, "pull.rebase"]) {
|
|
534
1047
|
const value = this.config(key);
|
|
535
1048
|
if (value === undefined) continue;
|
|
536
1049
|
return parseGitBool(value) ?? true;
|
|
537
1050
|
}
|
|
538
|
-
return
|
|
1051
|
+
return undefined;
|
|
539
1052
|
}
|
|
540
1053
|
|
|
541
1054
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
1055
|
+
* Whether `ancestor` is an ancestor of `commit` (git's repo_is_descendant_of), by git's
|
|
1056
|
+
* date-ordered paint walk, which stops once the sides meet.
|
|
544
1057
|
*/
|
|
545
|
-
private async
|
|
546
|
-
if (
|
|
1058
|
+
private async isAncestor(ancestor: string, commit: string): Promise<boolean> {
|
|
1059
|
+
if (ancestor === commit) return true;
|
|
547
1060
|
const graph = new MergeBaseGraph(commitsBaseSource(this.commits, async () => new Map()));
|
|
548
|
-
const bases = await graph.mergeBases(graph.commit(
|
|
549
|
-
return bases.some((b) => b.id ===
|
|
1061
|
+
const bases = await graph.mergeBases(graph.commit(ancestor), graph.commit(commit));
|
|
1062
|
+
return bases.some((b) => b.id === ancestor);
|
|
550
1063
|
}
|
|
551
1064
|
}
|