git-chopstick-core 0.1.1 → 0.1.3
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 +324 -32
- package/dist/git/add.d.ts +9 -0
- package/dist/git/add.js +11 -0
- package/dist/git/add.js.map +1 -0
- package/dist/git/apply.d.ts +33 -0
- package/dist/git/apply.js +103 -0
- package/dist/git/apply.js.map +1 -0
- package/dist/git/authentication.d.ts +5 -0
- package/dist/git/authentication.js +19 -0
- package/dist/git/authentication.js.map +1 -0
- package/dist/git/branch.d.ts +43 -0
- package/dist/git/branch.js +150 -0
- package/dist/git/branch.js.map +1 -0
- package/dist/git/checkout-index.d.ts +19 -0
- package/{src/git/checkout-index.ts → dist/git/checkout-index.js} +11 -22
- package/dist/git/checkout-index.js.map +1 -0
- package/dist/git/checkout.d.ts +46 -0
- package/dist/git/checkout.js +126 -0
- package/dist/git/checkout.js.map +1 -0
- package/dist/git/cherry-pick.d.ts +82 -0
- package/dist/git/cherry-pick.js +371 -0
- package/dist/git/cherry-pick.js.map +1 -0
- package/dist/git/clean.d.ts +5 -0
- package/dist/git/clean.js +8 -0
- package/dist/git/clean.js.map +1 -0
- package/dist/git/clone.d.ts +22 -0
- package/dist/git/clone.js +58 -0
- package/dist/git/clone.js.map +1 -0
- package/dist/git/coerce-to-buffer.d.ts +1 -0
- package/dist/git/coerce-to-buffer.js +2 -0
- package/dist/git/coerce-to-buffer.js.map +1 -0
- package/dist/git/coerce-to-string.d.ts +1 -0
- package/dist/git/coerce-to-string.js +2 -0
- package/dist/git/coerce-to-string.js.map +1 -0
- package/dist/git/commit.d.ts +25 -0
- package/dist/git/commit.js +99 -0
- package/dist/git/commit.js.map +1 -0
- package/dist/git/config.d.ts +98 -0
- package/dist/git/config.js +249 -0
- package/dist/git/config.js.map +1 -0
- package/dist/git/core.d.ts +167 -0
- package/dist/git/core.js +368 -0
- package/dist/git/core.js.map +1 -0
- package/dist/git/create-tail-stream.d.ts +4 -0
- package/dist/git/create-tail-stream.js +30 -0
- package/dist/git/create-tail-stream.js.map +1 -0
- package/dist/git/credential.d.ts +5 -0
- package/dist/git/credential.js +64 -0
- package/dist/git/credential.js.map +1 -0
- package/dist/git/description.d.ts +5 -0
- package/dist/git/description.js +24 -0
- package/dist/git/description.js.map +1 -0
- package/dist/git/diff-check.d.ts +7 -0
- package/dist/git/diff-check.js +17 -0
- package/dist/git/diff-check.js.map +1 -0
- package/dist/git/diff-index.d.ts +31 -0
- package/dist/git/diff-index.js +76 -0
- package/dist/git/diff-index.js.map +1 -0
- package/dist/git/diff.d.ts +81 -0
- package/dist/git/diff.js +611 -0
- package/dist/git/diff.js.map +1 -0
- package/dist/git/environment.d.ts +51 -0
- package/dist/git/environment.js +97 -0
- package/dist/git/environment.js.map +1 -0
- package/dist/git/exec.d.ts +109 -0
- package/dist/git/exec.js +224 -0
- package/dist/git/exec.js.map +1 -0
- package/dist/git/fetch.d.ts +25 -0
- package/dist/git/fetch.js +100 -0
- package/dist/git/fetch.js.map +1 -0
- package/dist/git/for-each-ref.d.ts +13 -0
- package/dist/git/for-each-ref.js +114 -0
- package/dist/git/for-each-ref.js.map +1 -0
- package/dist/git/format-patch.d.ts +10 -0
- package/dist/git/format-patch.js +16 -0
- package/dist/git/format-patch.js.map +1 -0
- package/dist/git/git-delimiter-parser.d.ts +38 -0
- package/dist/git/git-delimiter-parser.js +79 -0
- package/dist/git/git-delimiter-parser.js.map +1 -0
- package/dist/git/gitignore.d.ts +26 -0
- package/dist/git/gitignore.js +124 -0
- package/dist/git/gitignore.js.map +1 -0
- package/dist/git/index.d.ts +46 -0
- package/dist/git/index.js +47 -0
- package/dist/git/index.js.map +1 -0
- package/dist/git/init.d.ts +2 -0
- package/dist/git/init.js +7 -0
- package/dist/git/init.js.map +1 -0
- package/{src/git/interpret-trailers.ts → dist/git/interpret-trailers.d.ts} +9 -97
- package/dist/git/interpret-trailers.js +130 -0
- package/dist/git/interpret-trailers.js.map +1 -0
- package/dist/git/lfs.d.ts +25 -0
- package/dist/git/lfs.js +73 -0
- package/dist/git/lfs.js.map +1 -0
- package/dist/git/log.d.ts +56 -0
- package/dist/git/log.js +258 -0
- package/dist/git/log.js.map +1 -0
- package/dist/git/merge-tree.d.ts +13 -0
- package/dist/git/merge-tree.js +24 -0
- package/dist/git/merge-tree.js.map +1 -0
- package/dist/git/merge.d.ts +50 -0
- package/dist/git/merge.js +111 -0
- package/dist/git/merge.js.map +1 -0
- package/dist/git/multi-operation-terminal-output.d.ts +20 -0
- package/dist/git/multi-operation-terminal-output.js +56 -0
- package/dist/git/multi-operation-terminal-output.js.map +1 -0
- package/dist/git/pull.d.ts +24 -0
- package/dist/git/pull.js +91 -0
- package/dist/git/pull.js.map +1 -0
- package/{src/git/push-terminal-chunk.ts → dist/git/push-terminal-chunk.d.ts} +1 -23
- package/dist/git/push-terminal-chunk.js +36 -0
- package/dist/git/push-terminal-chunk.js.map +1 -0
- package/dist/git/push.d.ts +42 -0
- package/dist/git/push.js +80 -0
- package/dist/git/push.js.map +1 -0
- package/dist/git/rebase.d.ts +119 -0
- package/dist/git/rebase.js +415 -0
- package/dist/git/rebase.js.map +1 -0
- package/dist/git/reflog.d.ts +14 -0
- package/dist/git/reflog.js +88 -0
- package/dist/git/reflog.js.map +1 -0
- package/dist/git/refs.d.ts +26 -0
- package/dist/git/refs.js +53 -0
- package/dist/git/refs.js.map +1 -0
- package/dist/git/remote.d.ts +31 -0
- package/dist/git/remote.js +81 -0
- package/dist/git/remote.js.map +1 -0
- package/dist/git/reorder.d.ts +23 -0
- package/dist/git/reorder.js +111 -0
- package/dist/git/reorder.js.map +1 -0
- package/dist/git/reset.d.ts +41 -0
- package/dist/git/reset.js +86 -0
- package/dist/git/reset.js.map +1 -0
- package/dist/git/rev-list.d.ts +67 -0
- package/dist/git/rev-list.js +157 -0
- package/dist/git/rev-list.js.map +1 -0
- package/dist/git/rev-parse.d.ts +24 -0
- package/dist/git/rev-parse.js +65 -0
- package/dist/git/rev-parse.js.map +1 -0
- package/dist/git/revert.d.ts +12 -0
- package/dist/git/revert.js +30 -0
- package/dist/git/revert.js.map +1 -0
- package/dist/git/rm.d.ts +12 -0
- package/dist/git/rm.js +22 -0
- package/dist/git/rm.js.map +1 -0
- package/dist/git/show.d.ts +42 -0
- package/{src/git/show.ts → dist/git/show.js} +17 -46
- package/dist/git/show.js.map +1 -0
- package/dist/git/spawn.d.ts +18 -0
- package/dist/git/spawn.js +16 -0
- package/dist/git/spawn.js.map +1 -0
- package/dist/git/squash.d.ts +28 -0
- package/dist/git/squash.js +127 -0
- package/dist/git/squash.js.map +1 -0
- package/dist/git/stage.d.ts +21 -0
- package/dist/git/stage.js +72 -0
- package/dist/git/stage.js.map +1 -0
- package/dist/git/stash.d.ts +53 -0
- package/dist/git/stash.js +204 -0
- package/dist/git/stash.js.map +1 -0
- package/dist/git/status.d.ts +39 -0
- package/dist/git/status.js +293 -0
- package/dist/git/status.js.map +1 -0
- package/dist/git/submodule.d.ts +20 -0
- package/dist/git/submodule.js +153 -0
- package/dist/git/submodule.js.map +1 -0
- package/dist/git/tag.d.ts +32 -0
- package/dist/git/tag.js +101 -0
- package/dist/git/tag.js.map +1 -0
- package/dist/git/update-index.d.ts +11 -0
- package/dist/git/update-index.js +99 -0
- package/dist/git/update-index.js.map +1 -0
- package/dist/git/update-ref.d.ts +23 -0
- package/{src/git/update-ref.ts → dist/git/update-ref.js} +10 -28
- package/dist/git/update-ref.js.map +1 -0
- package/dist/git/var.d.ts +18 -0
- package/{src/git/var.ts → dist/git/var.js} +16 -25
- package/dist/git/var.js.map +1 -0
- package/dist/git/worktree-include.d.ts +42 -0
- package/dist/git/worktree-include.js +109 -0
- package/dist/git/worktree-include.js.map +1 -0
- package/dist/git/worktree.d.ts +25 -0
- package/dist/git/worktree.js +139 -0
- package/dist/git/worktree.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api.d.ts +2 -0
- package/dist/lib/api.js +7 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/diff-parser.d.ts +20 -0
- package/dist/lib/diff-parser.js +184 -0
- package/dist/lib/diff-parser.js.map +1 -0
- package/dist/lib/directory-exists.d.ts +1 -0
- package/dist/lib/directory-exists.js +11 -0
- package/dist/lib/directory-exists.js.map +1 -0
- package/dist/lib/errno-exception.d.ts +6 -0
- package/dist/lib/errno-exception.js +6 -0
- package/dist/lib/errno-exception.js.map +1 -0
- package/dist/lib/fatal-error.d.ts +4 -0
- package/dist/lib/fatal-error.js +18 -0
- package/dist/lib/fatal-error.js.map +1 -0
- package/dist/lib/feature-flag.d.ts +14 -0
- package/dist/lib/feature-flag.js +25 -0
- package/dist/lib/feature-flag.js.map +1 -0
- package/dist/lib/file-system.d.ts +1 -0
- package/dist/lib/file-system.js +7 -0
- package/dist/lib/file-system.js.map +1 -0
- package/dist/lib/get-old-path.d.ts +2 -0
- package/dist/lib/get-old-path.js +9 -0
- package/dist/lib/get-old-path.js.map +1 -0
- package/dist/lib/git/environment.d.ts +3 -0
- package/dist/lib/git/environment.js +7 -0
- package/dist/lib/git/environment.js.map +1 -0
- package/dist/lib/git-perf.d.ts +1 -0
- package/dist/lib/git-perf.js +4 -0
- package/dist/lib/git-perf.js.map +1 -0
- package/dist/lib/helpers/default-branch.d.ts +1 -0
- package/dist/lib/helpers/default-branch.js +4 -0
- package/dist/lib/helpers/default-branch.js.map +1 -0
- package/dist/lib/helpers/path.d.ts +1 -0
- package/dist/lib/helpers/path.js +5 -0
- package/dist/lib/helpers/path.js.map +1 -0
- package/dist/lib/hooks/with-hooks-env.d.ts +3 -0
- package/dist/lib/hooks/with-hooks-env.js +4 -0
- package/dist/lib/hooks/with-hooks-env.js.map +1 -0
- package/dist/lib/merge.d.ts +1 -0
- package/dist/lib/merge.js +4 -0
- package/dist/lib/merge.js.map +1 -0
- package/dist/lib/noop.d.ts +1 -0
- package/dist/lib/noop.js +2 -0
- package/dist/lib/noop.js.map +1 -0
- package/dist/lib/patch-formatter.d.ts +5 -0
- package/dist/lib/patch-formatter.js +7 -0
- package/dist/lib/patch-formatter.js.map +1 -0
- package/dist/lib/path-exists.d.ts +1 -0
- package/dist/lib/path-exists.js +3 -0
- package/dist/lib/path-exists.js.map +1 -0
- package/dist/lib/progress/from-process.d.ts +2 -0
- package/dist/lib/progress/from-process.js +4 -0
- package/dist/lib/progress/from-process.js.map +1 -0
- package/dist/lib/progress/index.d.ts +49 -0
- package/dist/lib/progress/index.js +32 -0
- package/dist/lib/progress/index.js.map +1 -0
- package/dist/lib/progress/revert.d.ts +8 -0
- package/dist/lib/progress/revert.js +15 -0
- package/dist/lib/progress/revert.js.map +1 -0
- package/dist/lib/rebase.d.ts +1 -0
- package/dist/lib/rebase.js +4 -0
- package/dist/lib/rebase.js.map +1 -0
- package/dist/lib/remove-remote-prefix.d.ts +1 -0
- package/dist/lib/remove-remote-prefix.js +5 -0
- package/dist/lib/remove-remote-prefix.js.map +1 -0
- package/dist/lib/resolve-git-proxy.d.ts +1 -0
- package/dist/lib/resolve-git-proxy.js +4 -0
- package/dist/lib/resolve-git-proxy.js.map +1 -0
- package/dist/lib/round.d.ts +1 -0
- package/dist/lib/round.js +5 -0
- package/dist/lib/round.js.map +1 -0
- package/dist/lib/split-buffer.d.ts +1 -0
- package/dist/lib/split-buffer.js +15 -0
- package/dist/lib/split-buffer.js.map +1 -0
- package/dist/lib/status-parser.d.ts +19 -0
- package/dist/lib/status-parser.js +125 -0
- package/dist/lib/status-parser.js.map +1 -0
- package/dist/lib/stores/helpers/find-default-remote.d.ts +1 -0
- package/dist/lib/stores/helpers/find-default-remote.js +4 -0
- package/dist/lib/stores/helpers/find-default-remote.js.map +1 -0
- package/dist/lib/trampoline/trampoline-environment.d.ts +1 -0
- package/dist/lib/trampoline/trampoline-environment.js +4 -0
- package/dist/lib/trampoline/trampoline-environment.js.map +1 -0
- package/dist/models/branch.d.ts +44 -0
- package/dist/models/branch.js +59 -0
- package/dist/models/branch.js.map +1 -0
- package/dist/models/cherry-pick.d.ts +11 -0
- package/dist/models/cherry-pick.js +2 -0
- package/dist/models/cherry-pick.js.map +1 -0
- package/dist/models/clone-options.d.ts +6 -0
- package/dist/models/clone-options.js +2 -0
- package/dist/models/clone-options.js.map +1 -0
- package/dist/models/commit-identity.d.ts +9 -0
- package/dist/models/commit-identity.js +34 -0
- package/dist/models/commit-identity.js.map +1 -0
- package/dist/models/commit.d.ts +30 -0
- package/dist/models/commit.js +32 -0
- package/dist/models/commit.js.map +1 -0
- package/dist/models/computed-action.d.ts +6 -0
- package/dist/models/computed-action.js +8 -0
- package/dist/models/computed-action.js.map +1 -0
- package/dist/models/diff/diff-data.d.ts +53 -0
- package/dist/models/diff/diff-data.js +19 -0
- package/dist/models/diff/diff-data.js.map +1 -0
- package/dist/models/diff/diff-line.d.ts +18 -0
- package/dist/models/diff/diff-line.js +33 -0
- package/dist/models/diff/diff-line.js.map +1 -0
- package/dist/models/diff/diff-selection.d.ts +22 -0
- package/dist/models/diff/diff-selection.js +127 -0
- package/dist/models/diff/diff-selection.js.map +1 -0
- package/dist/models/diff/image-diff.d.ts +6 -0
- package/dist/models/diff/image-diff.js +8 -0
- package/dist/models/diff/image-diff.js.map +1 -0
- package/dist/models/diff/image.d.ts +7 -0
- package/dist/models/diff/image.js +13 -0
- package/dist/models/diff/image.js.map +1 -0
- package/dist/models/diff/index.d.ts +6 -0
- package/dist/models/diff/index.js +7 -0
- package/dist/models/diff/index.js.map +1 -0
- package/dist/models/diff/raw-diff.d.ts +32 -0
- package/dist/models/diff/raw-diff.js +38 -0
- package/dist/models/diff/raw-diff.js.map +1 -0
- package/dist/models/git-author.d.ts +7 -0
- package/dist/models/git-author.js +18 -0
- package/dist/models/git-author.js.map +1 -0
- package/dist/models/index.d.ts +21 -0
- package/dist/models/index.js +20 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/manual-conflict-resolution.d.ts +4 -0
- package/dist/models/manual-conflict-resolution.js +6 -0
- package/dist/models/manual-conflict-resolution.js.map +1 -0
- package/dist/models/merge.d.ts +6 -0
- package/dist/models/merge.js +2 -0
- package/dist/models/merge.js.map +1 -0
- package/dist/models/multi-commit-operation.d.ts +6 -0
- package/dist/models/multi-commit-operation.js +8 -0
- package/dist/models/multi-commit-operation.js.map +1 -0
- package/dist/models/progress.d.ts +41 -0
- package/dist/models/progress.js +7 -0
- package/dist/models/progress.js.map +1 -0
- package/dist/models/rebase.d.ts +17 -0
- package/dist/models/rebase.js +8 -0
- package/dist/models/rebase.js.map +1 -0
- package/dist/models/remote.d.ts +5 -0
- package/dist/models/remote.js +8 -0
- package/dist/models/remote.js.map +1 -0
- package/dist/models/repository.d.ts +7 -0
- package/dist/models/repository.js +15 -0
- package/dist/models/repository.js.map +1 -0
- package/dist/models/stash-entry.d.ts +20 -0
- package/dist/models/stash-entry.js +7 -0
- package/dist/models/stash-entry.js.map +1 -0
- package/dist/models/status.d.ts +166 -0
- package/dist/models/status.js +135 -0
- package/dist/models/status.js.map +1 -0
- package/dist/models/submodule.d.ts +12 -0
- package/dist/models/submodule.js +2 -0
- package/dist/models/submodule.js.map +1 -0
- package/dist/models/worktree.d.ts +10 -0
- package/dist/models/worktree.js +2 -0
- package/dist/models/worktree.js.map +1 -0
- package/package.json +44 -5
- package/examples/get-status.ts +0 -84
- package/src/git/add.ts +0 -16
- package/src/git/apply.ts +0 -154
- package/src/git/authentication.ts +0 -19
- package/src/git/branch.ts +0 -206
- package/src/git/checkout.ts +0 -235
- package/src/git/cherry-pick.ts +0 -504
- package/src/git/clean.ts +0 -9
- package/src/git/clone.ts +0 -86
- package/src/git/coerce-to-buffer.ts +0 -4
- package/src/git/coerce-to-string.ts +0 -4
- package/src/git/commit.ts +0 -136
- package/src/git/config.ts +0 -392
- package/src/git/core.ts +0 -625
- package/src/git/create-tail-stream.ts +0 -36
- package/src/git/credential.ts +0 -83
- package/src/git/description.ts +0 -33
- package/src/git/diff-check.ts +0 -27
- package/src/git/diff-index.ts +0 -116
- package/src/git/diff.ts +0 -880
- package/src/git/environment.ts +0 -116
- package/src/git/exec.ts +0 -285
- package/src/git/fetch.ts +0 -141
- package/src/git/for-each-ref.ts +0 -160
- package/src/git/format-patch.ts +0 -17
- package/src/git/git-delimiter-parser.ts +0 -95
- package/src/git/gitignore.ts +0 -157
- package/src/git/index.ts +0 -36
- package/src/git/init.ts +0 -11
- package/src/git/lfs.ts +0 -100
- package/src/git/log.ts +0 -376
- package/src/git/merge-tree.ts +0 -42
- package/src/git/merge.ts +0 -154
- package/src/git/multi-operation-terminal-output.ts +0 -68
- package/src/git/pull.ts +0 -130
- package/src/git/push.ts +0 -119
- package/src/git/rebase.ts +0 -627
- package/src/git/reflog.ts +0 -127
- package/src/git/refs.ts +0 -63
- package/src/git/remote.ts +0 -143
- package/src/git/reorder.ts +0 -153
- package/src/git/reset.ts +0 -101
- package/src/git/rev-list.ts +0 -201
- package/src/git/rev-parse.ts +0 -92
- package/src/git/revert.ts +0 -55
- package/src/git/rm.ts +0 -31
- package/src/git/spawn.ts +0 -38
- package/src/git/squash.ts +0 -173
- package/src/git/stage.ts +0 -97
- package/src/git/stash.ts +0 -302
- package/src/git/status.ts +0 -502
- package/src/git/submodule.ts +0 -212
- package/src/git/tag.ts +0 -134
- package/src/git/update-index.ts +0 -169
- package/src/git/worktree-include.ts +0 -146
- package/src/git/worktree.ts +0 -219
- package/src/index.ts +0 -23
- package/src/lib/api.ts +0 -7
- package/src/lib/diff-parser.ts +0 -249
- package/src/lib/directory-exists.ts +0 -10
- package/src/lib/errno-exception.ts +0 -12
- package/src/lib/fatal-error.ts +0 -23
- package/src/lib/feature-flag.ts +0 -29
- package/src/lib/file-system.ts +0 -7
- package/src/lib/get-old-path.ts +0 -11
- package/src/lib/git/environment.ts +0 -14
- package/src/lib/git-perf.ts +0 -3
- package/src/lib/helpers/default-branch.ts +0 -3
- package/src/lib/helpers/path.ts +0 -5
- package/src/lib/hooks/with-hooks-env.ts +0 -7
- package/src/lib/merge.ts +0 -3
- package/src/lib/noop.ts +0 -1
- package/src/lib/patch-formatter.ts +0 -18
- package/src/lib/path-exists.ts +0 -7
- package/src/lib/progress/from-process.ts +0 -10
- package/src/lib/progress/index.ts +0 -43
- package/src/lib/progress/revert.ts +0 -17
- package/src/lib/rebase.ts +0 -3
- package/src/lib/remove-remote-prefix.ts +0 -4
- package/src/lib/resolve-git-proxy.ts +0 -3
- package/src/lib/round.ts +0 -4
- package/src/lib/split-buffer.ts +0 -14
- package/src/lib/status-parser.ts +0 -188
- package/src/lib/stores/helpers/find-default-remote.ts +0 -3
- package/src/lib/trampoline/trampoline-environment.ts +0 -8
- package/src/models/branch.ts +0 -78
- package/src/models/cherry-pick.ts +0 -12
- package/src/models/clone-options.ts +0 -6
- package/src/models/commit-identity.ts +0 -35
- package/src/models/commit.ts +0 -44
- package/src/models/computed-action.ts +0 -6
- package/src/models/diff/diff-data.ts +0 -78
- package/src/models/diff/diff-line.ts +0 -36
- package/src/models/diff/diff-selection.ts +0 -165
- package/src/models/diff/image-diff.ts +0 -6
- package/src/models/diff/image.ts +0 -8
- package/src/models/diff/index.ts +0 -6
- package/src/models/diff/raw-diff.ts +0 -41
- package/src/models/git-author.ts +0 -16
- package/src/models/manual-conflict-resolution.ts +0 -4
- package/src/models/merge.ts +0 -6
- package/src/models/multi-commit-operation.ts +0 -6
- package/src/models/progress.ts +0 -67
- package/src/models/rebase.ts +0 -20
- package/src/models/remote.ts +0 -10
- package/src/models/repository.ts +0 -16
- package/src/models/stash-entry.ts +0 -25
- package/src/models/status.ts +0 -275
- package/src/models/submodule.ts +0 -13
- package/src/models/worktree.ts +0 -11
- package/tsconfig.json +0 -17
package/dist/git/core.js
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { exec, GitError as DugiteError, parseError, parseBadConfigValueErrorInfo, ExecError, } from './exec.js';
|
|
2
|
+
import { assertNever } from '../lib/fatal-error.js';
|
|
3
|
+
import * as GitPerf from '../lib/git-perf.js';
|
|
4
|
+
import * as Path from 'path';
|
|
5
|
+
import { isErrnoException } from '../lib/errno-exception.js';
|
|
6
|
+
import { withTrampolineEnv } from '../lib/trampoline/trampoline-environment.js';
|
|
7
|
+
import { kStringMaxLength } from 'buffer';
|
|
8
|
+
import { withHooksEnv } from '../lib/hooks/with-hooks-env.js';
|
|
9
|
+
import { coerceToString } from './coerce-to-string.js';
|
|
10
|
+
import { pushTerminalChunk } from './push-terminal-chunk.js';
|
|
11
|
+
export const isMaxBufferExceededError = (error) => {
|
|
12
|
+
return (error instanceof ExecError &&
|
|
13
|
+
error.code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER');
|
|
14
|
+
};
|
|
15
|
+
export class GitError extends Error {
|
|
16
|
+
/** The result from the failed command. */
|
|
17
|
+
result;
|
|
18
|
+
/** The args for the failed command. */
|
|
19
|
+
args;
|
|
20
|
+
/**
|
|
21
|
+
* Whether or not the error message is just the raw output of the git command.
|
|
22
|
+
*/
|
|
23
|
+
isRawMessage;
|
|
24
|
+
constructor(result, args, terminalOutput) {
|
|
25
|
+
let rawMessage = true;
|
|
26
|
+
let message;
|
|
27
|
+
if (result.gitErrorDescription) {
|
|
28
|
+
message = `${result.path}: ${result.gitErrorDescription}`;
|
|
29
|
+
rawMessage = false;
|
|
30
|
+
}
|
|
31
|
+
else if (terminalOutput.length > 0) {
|
|
32
|
+
message = terminalOutput;
|
|
33
|
+
}
|
|
34
|
+
else if (result.stderr.length) {
|
|
35
|
+
message = coerceToString(result.stderr);
|
|
36
|
+
}
|
|
37
|
+
else if (result.stdout.length) {
|
|
38
|
+
message = coerceToString(result.stdout);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
message = `Unknown error (exit code ${result.exitCode})`;
|
|
42
|
+
rawMessage = false;
|
|
43
|
+
}
|
|
44
|
+
super(message);
|
|
45
|
+
this.name = 'GitError';
|
|
46
|
+
this.result = result;
|
|
47
|
+
this.args = args;
|
|
48
|
+
this.isRawMessage = rawMessage;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export const isGitError = (e, parsedError) => {
|
|
52
|
+
return (e instanceof GitError &&
|
|
53
|
+
(parsedError === undefined || e.result.gitError === parsedError));
|
|
54
|
+
};
|
|
55
|
+
export async function git(args, path, name, options) {
|
|
56
|
+
const defaultOptions = {
|
|
57
|
+
successExitCodes: new Set([0]),
|
|
58
|
+
expectedErrors: new Set(),
|
|
59
|
+
maxBuffer: options?.encoding === 'buffer' ? Infinity : kStringMaxLength,
|
|
60
|
+
};
|
|
61
|
+
const opts = { ...defaultOptions, ...options };
|
|
62
|
+
// The combined contents of stdout and stderr with some light processing
|
|
63
|
+
// applied to remove redundant lines caused by Git's use of `\r` to "erase"
|
|
64
|
+
// the current line while writing progress output. See createTerminalOutput.
|
|
65
|
+
//
|
|
66
|
+
// Note: The output is capped at a maximum of 256kb and the sole intent of
|
|
67
|
+
// this property is to provide "terminal-like" output to the user when a Git
|
|
68
|
+
// command fails.
|
|
69
|
+
const terminalChunks = [];
|
|
70
|
+
const terminalCapacity = 256 * 1024;
|
|
71
|
+
// Keep at most 256kb of combined stderr and stdout output. This is used
|
|
72
|
+
// to provide more context in error messages.
|
|
73
|
+
opts.processCallback = (process) => {
|
|
74
|
+
options?.onTerminalOutputAvailable?.(function (cb) {
|
|
75
|
+
terminalChunks.forEach(chunk => cb(chunk));
|
|
76
|
+
process.stdout?.on('data', cb);
|
|
77
|
+
process.stderr?.on('data', cb);
|
|
78
|
+
return {
|
|
79
|
+
unsubscribe: () => {
|
|
80
|
+
process.stdout?.off('data', cb);
|
|
81
|
+
process.stderr?.off('data', cb);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
const push = (chunk) => {
|
|
86
|
+
pushTerminalChunk(terminalChunks, terminalCapacity, chunk);
|
|
87
|
+
};
|
|
88
|
+
process.stdout?.on('data', push);
|
|
89
|
+
process.stderr?.on('data', push);
|
|
90
|
+
options?.processCallback?.(process);
|
|
91
|
+
};
|
|
92
|
+
return withHooksEnv(hooksEnv => withTrampolineEnv(async (env) => {
|
|
93
|
+
const commandName = `${name}: git ${args.join(' ')}`;
|
|
94
|
+
const result = await GitPerf.measure(commandName, () => exec(args, path, {
|
|
95
|
+
...opts,
|
|
96
|
+
env: {
|
|
97
|
+
// Explicitly set TERM to 'dumb' so that if Desktop was launched
|
|
98
|
+
// from a terminal or if the system environment variables
|
|
99
|
+
// have TERM set Git won't consider us as a smart terminal.
|
|
100
|
+
// See https://github.com/git/git/blob/a7312d1a2/editor.c#L11-L15
|
|
101
|
+
TERM: 'dumb',
|
|
102
|
+
...opts.env,
|
|
103
|
+
...hooksEnv,
|
|
104
|
+
...env,
|
|
105
|
+
},
|
|
106
|
+
})).catch(err => {
|
|
107
|
+
// If this is an exception thrown by Node.js (as opposed to
|
|
108
|
+
// dugite) let's keep the salient details but include the name of
|
|
109
|
+
// the operation.
|
|
110
|
+
if (isErrnoException(err)) {
|
|
111
|
+
throw new Error(`Failed to execute ${name}: ${err.code}`);
|
|
112
|
+
}
|
|
113
|
+
if (isMaxBufferExceededError(err)) {
|
|
114
|
+
throw new ExecError(`${err.message} for ${name}`, err.stdout, err.stderr,
|
|
115
|
+
// Dugite stores the original Node error in the cause property, by
|
|
116
|
+
// passing that along we ensure that all we're doing here is
|
|
117
|
+
// changing the error message (and capping the stack but that's
|
|
118
|
+
// okay since we know exactly where this error is coming from).
|
|
119
|
+
// The null coalescing here is a safety net in case dugite's
|
|
120
|
+
// behavior changes from underneath us.
|
|
121
|
+
err.cause ?? err);
|
|
122
|
+
}
|
|
123
|
+
throw err;
|
|
124
|
+
});
|
|
125
|
+
const exitCode = result.exitCode;
|
|
126
|
+
let gitError = null;
|
|
127
|
+
const acceptableExitCode = opts.successExitCodes
|
|
128
|
+
? opts.successExitCodes.has(exitCode)
|
|
129
|
+
: false;
|
|
130
|
+
if (!acceptableExitCode) {
|
|
131
|
+
gitError = parseError(coerceToString(result.stderr));
|
|
132
|
+
if (gitError === null) {
|
|
133
|
+
gitError = parseError(coerceToString(result.stdout));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const gitErrorDescription = gitError !== null
|
|
137
|
+
? getDescriptionForError(gitError, coerceToString(result.stderr))
|
|
138
|
+
: null;
|
|
139
|
+
const isBufferOp = options?.encoding === 'buffer';
|
|
140
|
+
const gitResult = {
|
|
141
|
+
...result,
|
|
142
|
+
stdout: isBufferOp ? result.stdout : coerceToString(result.stdout),
|
|
143
|
+
stderr: isBufferOp ? result.stderr : coerceToString(result.stderr),
|
|
144
|
+
gitError,
|
|
145
|
+
gitErrorDescription,
|
|
146
|
+
path,
|
|
147
|
+
};
|
|
148
|
+
let acceptableError = true;
|
|
149
|
+
if (gitError !== null && opts.expectedErrors) {
|
|
150
|
+
acceptableError = opts.expectedErrors.has(gitError);
|
|
151
|
+
}
|
|
152
|
+
if ((gitError !== null && acceptableError) || acceptableExitCode) {
|
|
153
|
+
return gitResult;
|
|
154
|
+
}
|
|
155
|
+
// The caller should either handle this error, or expect that exit code.
|
|
156
|
+
const errorMessage = new Array();
|
|
157
|
+
errorMessage.push(`\`git ${args.join(' ')}\` exited with an unexpected code: ${exitCode}.`);
|
|
158
|
+
const terminalOutput = terminalChunks.join('');
|
|
159
|
+
if (terminalOutput.length > 0) {
|
|
160
|
+
// Leave even less of the combined output in the log
|
|
161
|
+
errorMessage.push(terminalOutput.slice(-1024));
|
|
162
|
+
}
|
|
163
|
+
if (gitError !== null) {
|
|
164
|
+
errorMessage.push(`(The error was parsed as ${gitError}: ${gitErrorDescription})`);
|
|
165
|
+
}
|
|
166
|
+
console.error(errorMessage.join('\n'));
|
|
167
|
+
const coercedResult = {
|
|
168
|
+
...gitResult,
|
|
169
|
+
stdout: coerceToString(gitResult.stdout),
|
|
170
|
+
stderr: coerceToString(gitResult.stderr),
|
|
171
|
+
};
|
|
172
|
+
throw new GitError(coercedResult, args, terminalOutput);
|
|
173
|
+
}, path, options?.isBackgroundTask ?? false, hooksEnv), path, options);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Determine whether the provided `error` is an authentication failure
|
|
177
|
+
* as per our definition. Note that this is not an exhaustive list of
|
|
178
|
+
* authentication failures, only a collection of errors that we treat
|
|
179
|
+
* equally in terms of error message and presentation to the user.
|
|
180
|
+
*/
|
|
181
|
+
export function isAuthFailureError(error) {
|
|
182
|
+
switch (error) {
|
|
183
|
+
case DugiteError.SSHAuthenticationFailed:
|
|
184
|
+
case DugiteError.SSHPermissionDenied:
|
|
185
|
+
case DugiteError.HTTPSAuthenticationFailed:
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Determine whether the provided `error` is an error from Git indicating
|
|
192
|
+
* that a configuration file write failed due to a lock file already
|
|
193
|
+
* existing for that config file.
|
|
194
|
+
*/
|
|
195
|
+
export function isConfigFileLockError(error) {
|
|
196
|
+
return (error instanceof GitError &&
|
|
197
|
+
error.result.gitError === DugiteError.ConfigLockFileAlreadyExists);
|
|
198
|
+
}
|
|
199
|
+
const lockFilePathRe = /^error: could not lock config file (.+?): File exists$/m;
|
|
200
|
+
/**
|
|
201
|
+
* If the `result` is associated with an config lock file error (as determined
|
|
202
|
+
* by `isConfigFileLockError`) this method will attempt to extract an absolute
|
|
203
|
+
* path (i.e. rooted) to the configuration lock file in question from the Git
|
|
204
|
+
* output.
|
|
205
|
+
*/
|
|
206
|
+
export function parseConfigLockFilePathFromError(result) {
|
|
207
|
+
const match = lockFilePathRe.exec(coerceToString(result.stderr));
|
|
208
|
+
if (match === null) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
const normalized = match[1];
|
|
212
|
+
// https://github.com/git/git/blob/232378479/lockfile.h#L117-L119
|
|
213
|
+
return Path.resolve(result.path, `${normalized}.lock`);
|
|
214
|
+
}
|
|
215
|
+
export function getDescriptionForError(error, stderr) {
|
|
216
|
+
if (isAuthFailureError(error)) {
|
|
217
|
+
const menuHint = 'Settings';
|
|
218
|
+
return `Authentication failed. Some common reasons include:
|
|
219
|
+
|
|
220
|
+
- You are not logged in to your account: see ${menuHint}
|
|
221
|
+
- You may need to log out and log back in to refresh your token.
|
|
222
|
+
- You do not have permission to access this repository.
|
|
223
|
+
- The repository is archived on GitHub. Check the repository settings to confirm you are still permitted to push commits.
|
|
224
|
+
- If you use SSH authentication, check that your key is added to the ssh-agent and associated with your account.
|
|
225
|
+
- If you use SSH authentication, ensure the host key verification passes for your repository hosting service.
|
|
226
|
+
- If you used username / password authentication, you might need to use a Personal Access Token instead of your account password. Check the documentation of your repository hosting service.`;
|
|
227
|
+
}
|
|
228
|
+
switch (error) {
|
|
229
|
+
case DugiteError.BadConfigValue:
|
|
230
|
+
const errorInfo = parseBadConfigValueErrorInfo(stderr);
|
|
231
|
+
if (errorInfo === null) {
|
|
232
|
+
return 'Unsupported git configuration value.';
|
|
233
|
+
}
|
|
234
|
+
return `Unsupported value '${errorInfo.value}' for git config key '${errorInfo.key}'`;
|
|
235
|
+
case DugiteError.SSHKeyAuditUnverified:
|
|
236
|
+
return 'The SSH key is unverified.';
|
|
237
|
+
case DugiteError.RemoteDisconnection:
|
|
238
|
+
return 'The remote disconnected. Check your Internet connection and try again.';
|
|
239
|
+
case DugiteError.HostDown:
|
|
240
|
+
return 'The host is down. Check your Internet connection and try again.';
|
|
241
|
+
case DugiteError.RebaseConflicts:
|
|
242
|
+
return 'We found some conflicts while trying to rebase. Please resolve the conflicts before continuing.';
|
|
243
|
+
case DugiteError.MergeConflicts:
|
|
244
|
+
return 'We found some conflicts while trying to merge. Please resolve the conflicts and commit the changes.';
|
|
245
|
+
case DugiteError.HTTPSRepositoryNotFound:
|
|
246
|
+
case DugiteError.SSHRepositoryNotFound:
|
|
247
|
+
return 'The repository does not seem to exist anymore. You may not have access, or it may have been deleted or renamed.';
|
|
248
|
+
case DugiteError.PushNotFastForward:
|
|
249
|
+
return 'The repository has been updated since you last pulled. Try pulling before pushing.';
|
|
250
|
+
case DugiteError.BranchDeletionFailed:
|
|
251
|
+
return 'Could not delete the branch. It was probably already deleted.';
|
|
252
|
+
case DugiteError.DefaultBranchDeletionFailed:
|
|
253
|
+
return `The branch is the repository's default branch and cannot be deleted.`;
|
|
254
|
+
case DugiteError.RevertConflicts:
|
|
255
|
+
return 'To finish reverting, please merge and commit the changes.';
|
|
256
|
+
case DugiteError.EmptyRebasePatch:
|
|
257
|
+
return 'There aren’t any changes left to apply.';
|
|
258
|
+
case DugiteError.NoMatchingRemoteBranch:
|
|
259
|
+
return 'There aren’t any remote branches that match the current branch.';
|
|
260
|
+
case DugiteError.NothingToCommit:
|
|
261
|
+
return 'There are no changes to commit.';
|
|
262
|
+
case DugiteError.NoSubmoduleMapping:
|
|
263
|
+
return 'A submodule was removed from .gitmodules, but the folder still exists in the repository. Delete the folder, commit the change, then try again.';
|
|
264
|
+
case DugiteError.SubmoduleRepositoryDoesNotExist:
|
|
265
|
+
return 'A submodule points to a location which does not exist.';
|
|
266
|
+
case DugiteError.InvalidSubmoduleSHA:
|
|
267
|
+
return 'A submodule points to a commit which does not exist.';
|
|
268
|
+
case DugiteError.LocalPermissionDenied:
|
|
269
|
+
return 'Permission denied.';
|
|
270
|
+
case DugiteError.InvalidMerge:
|
|
271
|
+
return 'This is not something we can merge.';
|
|
272
|
+
case DugiteError.InvalidRebase:
|
|
273
|
+
return 'This is not something we can rebase.';
|
|
274
|
+
case DugiteError.NonFastForwardMergeIntoEmptyHead:
|
|
275
|
+
return 'The merge you attempted is not a fast-forward, so it cannot be performed on an empty branch.';
|
|
276
|
+
case DugiteError.PatchDoesNotApply:
|
|
277
|
+
return 'The requested changes conflict with one or more files in the repository.';
|
|
278
|
+
case DugiteError.BranchAlreadyExists:
|
|
279
|
+
return 'A branch with that name already exists.';
|
|
280
|
+
case DugiteError.BadRevision:
|
|
281
|
+
return 'Bad revision.';
|
|
282
|
+
case DugiteError.NotAGitRepository:
|
|
283
|
+
return 'This is not a git repository.';
|
|
284
|
+
case DugiteError.ProtectedBranchForcePush:
|
|
285
|
+
return 'This branch is protected from force-push operations.';
|
|
286
|
+
case DugiteError.ProtectedBranchRequiresReview:
|
|
287
|
+
return 'This branch is protected and any changes requires an approved review. Open a pull request with changes targeting this branch instead.';
|
|
288
|
+
case DugiteError.PushWithFileSizeExceedingLimit:
|
|
289
|
+
return "The push operation includes a file which exceeds GitHub's file size restriction of 100MB. Please remove the file from history and try again.";
|
|
290
|
+
case DugiteError.HexBranchNameRejected:
|
|
291
|
+
return 'The branch name cannot be a 40-character string of hexadecimal characters, as this is the format that Git uses for representing objects.';
|
|
292
|
+
case DugiteError.ForcePushRejected:
|
|
293
|
+
return 'The force push has been rejected for the current branch.';
|
|
294
|
+
case DugiteError.InvalidRefLength:
|
|
295
|
+
return 'A ref cannot be longer than 255 characters.';
|
|
296
|
+
case DugiteError.CannotMergeUnrelatedHistories:
|
|
297
|
+
return 'Unable to merge unrelated histories in this repository.';
|
|
298
|
+
case DugiteError.PushWithPrivateEmail:
|
|
299
|
+
return 'Cannot push these commits as they contain an email address marked as private on GitHub. To push anyway, visit https://github.com/settings/emails, uncheck "Keep my email address private", then switch back to GitHub Desktop to push your commits. You can then enable the setting again.';
|
|
300
|
+
case DugiteError.LFSAttributeDoesNotMatch:
|
|
301
|
+
return 'Git LFS attribute found in global Git configuration does not match expected value.';
|
|
302
|
+
case DugiteError.ProtectedBranchDeleteRejected:
|
|
303
|
+
return 'This branch cannot be deleted from the remote repository because it is marked as protected.';
|
|
304
|
+
case DugiteError.ProtectedBranchRequiredStatus:
|
|
305
|
+
return 'The push was rejected by the remote server because a required status check has not been satisfied.';
|
|
306
|
+
case DugiteError.BranchRenameFailed:
|
|
307
|
+
return 'The branch could not be renamed.';
|
|
308
|
+
case DugiteError.PathDoesNotExist:
|
|
309
|
+
return 'The path does not exist on disk.';
|
|
310
|
+
case DugiteError.InvalidObjectName:
|
|
311
|
+
return 'The object was not found in the Git repository.';
|
|
312
|
+
case DugiteError.OutsideRepository:
|
|
313
|
+
return 'This path is not a valid path inside the repository.';
|
|
314
|
+
case DugiteError.LockFileAlreadyExists:
|
|
315
|
+
return 'A lock file already exists in the repository, which blocks this operation from completing.';
|
|
316
|
+
case DugiteError.NoMergeToAbort:
|
|
317
|
+
return 'There is no merge in progress, so there is nothing to abort.';
|
|
318
|
+
case DugiteError.NoExistingRemoteBranch:
|
|
319
|
+
return 'The remote branch does not exist.';
|
|
320
|
+
case DugiteError.LocalChangesOverwritten:
|
|
321
|
+
return 'Unable to switch branches as there are working directory changes which would be overwritten. Please commit or stash your changes.';
|
|
322
|
+
case DugiteError.UnresolvedConflicts:
|
|
323
|
+
return 'There are unresolved conflicts in the working directory.';
|
|
324
|
+
case DugiteError.ConfigLockFileAlreadyExists:
|
|
325
|
+
// Added in dugite 1.88.0 (https://github.com/desktop/dugite/pull/386)
|
|
326
|
+
// in support of https://github.com/desktop/desktop/issues/8675 but we're
|
|
327
|
+
// not using it yet. Returning a null message here means the stderr will
|
|
328
|
+
// be used as the error message (or stdout if stderr is empty), i.e. the
|
|
329
|
+
// same behavior as before the ConfigLockFileAlreadyExists was added
|
|
330
|
+
return null;
|
|
331
|
+
case DugiteError.RemoteAlreadyExists:
|
|
332
|
+
return null;
|
|
333
|
+
case DugiteError.TagAlreadyExists:
|
|
334
|
+
return 'A tag with that name already exists';
|
|
335
|
+
case DugiteError.MergeWithLocalChanges:
|
|
336
|
+
case DugiteError.RebaseWithLocalChanges:
|
|
337
|
+
case DugiteError.GPGFailedToSignData:
|
|
338
|
+
case DugiteError.ConflictModifyDeletedInBranch:
|
|
339
|
+
case DugiteError.MergeCommitNoMainlineOption:
|
|
340
|
+
case DugiteError.UnsafeDirectory:
|
|
341
|
+
case DugiteError.PathExistsButNotInRef:
|
|
342
|
+
case DugiteError.PushWithSecretDetected:
|
|
343
|
+
return null;
|
|
344
|
+
default:
|
|
345
|
+
return assertNever(error, `Unknown error: ${error}`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Returns the arguments to use on any git operation that can end up
|
|
350
|
+
* triggering a rebase.
|
|
351
|
+
*/
|
|
352
|
+
export function gitRebaseArguments() {
|
|
353
|
+
return [
|
|
354
|
+
// Explicitly set the rebase backend to merge.
|
|
355
|
+
// We need to force this option to be sure that Desktop
|
|
356
|
+
// uses the merge backend even if the user has the apply backend
|
|
357
|
+
// configured, since this is the only one supported.
|
|
358
|
+
// This can go away once git deprecates the apply backend.
|
|
359
|
+
...['-c', 'rebase.backend=merge'],
|
|
360
|
+
];
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Returns the SHA of the passed in IGitResult
|
|
364
|
+
*/
|
|
365
|
+
export function parseCommitSHA(result) {
|
|
366
|
+
return result.stdout.split(']')[0].split(' ')[1];
|
|
367
|
+
}
|
|
368
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/git/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,QAAQ,IAAI,WAAW,EACvB,UAAU,EACV,4BAA4B,EAC5B,SAAS,GACV,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,KAAc,EACsD,EAAE;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ED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,8CAA8C;QAC9C,uDAAuD;QACvD,gEAAgE;QAChE,oDAAoD;QACpD,0DAA0D;QAC1D,GAAG,CAAC,IAAI,EAAE,sBAAsB,CAAC;KAClC,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAwB;IACrD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import { Transform } from 'stream';
|
|
3
|
+
export function createTailStream(capacity, options) {
|
|
4
|
+
assert.ok(capacity > 0, 'The "capacity" argument must be greater than 0');
|
|
5
|
+
const chunks = [];
|
|
6
|
+
let length = 0;
|
|
7
|
+
return new Transform({
|
|
8
|
+
...options,
|
|
9
|
+
decodeStrings: true,
|
|
10
|
+
transform(chunk, _, cb) {
|
|
11
|
+
chunks.push(chunk);
|
|
12
|
+
length += chunk.length;
|
|
13
|
+
while (length > capacity) {
|
|
14
|
+
const firstChunk = chunks[0];
|
|
15
|
+
const overrun = length - capacity;
|
|
16
|
+
if (overrun >= firstChunk.length) {
|
|
17
|
+
chunks.shift();
|
|
18
|
+
length -= firstChunk.length;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
chunks[0] = firstChunk.subarray(overrun);
|
|
22
|
+
length -= overrun;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
cb();
|
|
26
|
+
},
|
|
27
|
+
flush: cb => cb(null, Buffer.concat(chunks)),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=create-tail-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-tail-stream.js","sourceRoot":"","sources":["../../src/git/create-t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export declare const formatCredential: (credential: Map<string, string>) => string;
|
|
3
|
+
export declare const fillCredential: (cred: Map<string, string>, path: string, env?: Record<string, string | undefined> | undefined) => Promise<Map<string, string>>;
|
|
4
|
+
export declare const approveCredential: (cred: Map<string, string>, path: string, env?: Record<string, string | undefined> | undefined) => Promise<Map<string, string>>;
|
|
5
|
+
export declare const rejectCredential: (cred: Map<string, string>, path: string, env?: Record<string, string | undefined> | undefined) => Promise<Map<string, string>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { exec as git } from './exec.js';
|
|
2
|
+
export const parseCredential = (value) => {
|
|
3
|
+
const cred = new Map();
|
|
4
|
+
// The credential helper protocol is a simple key=value format but some of its
|
|
5
|
+
// keys are actually arrays which are represented as multiple key[] entries.
|
|
6
|
+
// Since we're currently storing credentials as a Map we need to handle this
|
|
7
|
+
// and expand multiple key[] entries into a key[0], key[1]... key[n] sequence.
|
|
8
|
+
// We then remove the number from the key when we're formatting the credential
|
|
9
|
+
for (const line of value.split(/\r?\n/)) {
|
|
10
|
+
const eqIx = line.indexOf('=');
|
|
11
|
+
if (eqIx === -1) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const k = line.slice(0, eqIx);
|
|
15
|
+
const v = line.slice(eqIx + 1);
|
|
16
|
+
if (k.endsWith('[]')) {
|
|
17
|
+
let i = 0;
|
|
18
|
+
let newKey;
|
|
19
|
+
do {
|
|
20
|
+
newKey = `${k.slice(0, -2)}[${i}]`;
|
|
21
|
+
i++;
|
|
22
|
+
} while (cred.has(newKey));
|
|
23
|
+
cred.set(newKey, v);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
cred.set(k, v);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return cred;
|
|
30
|
+
};
|
|
31
|
+
export const formatCredential = (credential) => {
|
|
32
|
+
const lines = [];
|
|
33
|
+
for (const [k, v] of credential) {
|
|
34
|
+
if (v.includes('\n') || v.includes('\0')) {
|
|
35
|
+
throw new Error(`forbidden characters in credential value: ${k}`);
|
|
36
|
+
}
|
|
37
|
+
lines.push(`${k.replace(/\[\d+\]$/, '[]')}=${v}\n`);
|
|
38
|
+
}
|
|
39
|
+
return lines.join('');
|
|
40
|
+
};
|
|
41
|
+
// Can't use git() as that will call withTrampolineEnv which calls this method
|
|
42
|
+
const exec = (cmd, cred, path, env = {}) => git([
|
|
43
|
+
...['-c', 'credential.helper='],
|
|
44
|
+
...['-c', `credential.helper=manager`],
|
|
45
|
+
'credential',
|
|
46
|
+
cmd,
|
|
47
|
+
], path, {
|
|
48
|
+
stdin: formatCredential(cred),
|
|
49
|
+
env: {
|
|
50
|
+
GIT_TERMINAL_PROMPT: '0',
|
|
51
|
+
GIT_ASKPASS: '',
|
|
52
|
+
TERM: 'dumb',
|
|
53
|
+
...env,
|
|
54
|
+
},
|
|
55
|
+
}).then(({ exitCode, stderr, stdout }) => {
|
|
56
|
+
if (exitCode !== 0) {
|
|
57
|
+
throw new Error(String(stderr));
|
|
58
|
+
}
|
|
59
|
+
return parseCredential(String(stdout));
|
|
60
|
+
});
|
|
61
|
+
export const fillCredential = exec.bind(null, 'fill');
|
|
62
|
+
export const approveCredential = exec.bind(null, 'approve');
|
|
63
|
+
export const rejectCredential = exec.bind(null, 'reject');
|
|
64
|
+
//# sourceMappingURL=credential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential.js","sourceRoot":"","sources":["../../src/git/credential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,GAAG,EAAE,MAAM,WAAW,CAAA;AAEvC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;IAC/C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAA;IAEtC,8EAA8E;IAC9E,4EAA4E;IAC5E,4EAA4E;IAC5E,8EAA8E;IAC9E,8EAA8E;IAC9E,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO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name the repository.\n";
|
|
2
|
+
/** Get the repository's description from the .git/description file. */
|
|
3
|
+
export declare function getGitDescription(repositoryPath: string): Promise<string>;
|
|
4
|
+
/** Write a .git/description file to the repository. */
|
|
5
|
+
export declare function writeGitDescription(repositoryPath: string, description: string): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as Path from 'path';
|
|
2
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
3
|
+
const GitDescriptionPath = '.git/description';
|
|
4
|
+
export const DefaultGitDescription = "Unnamed repository; edit this file 'description' to name the repository.\n";
|
|
5
|
+
/** Get the repository's description from the .git/description file. */
|
|
6
|
+
export async function getGitDescription(repositoryPath) {
|
|
7
|
+
const path = Path.join(repositoryPath, GitDescriptionPath);
|
|
8
|
+
try {
|
|
9
|
+
const data = await readFile(path, 'utf8');
|
|
10
|
+
if (data === DefaultGitDescription) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Write a .git/description file to the repository. */
|
|
20
|
+
export async function writeGitDescription(repositoryPath, description) {
|
|
21
|
+
const fullPath = Path.join(repositoryPath, GitDescriptionPath);
|
|
22
|
+
await writeFile(fullPath, description);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../src/git/description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,kBAAkB,GAAG,kBAAkB,CAAA;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAChC,4EAA4E,CAAA;AAE9E,uEAAuE;AACvE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,cAAsB;IAEtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAA;IAE1D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACzC,IAAI,IAAI,KAAK,qBAAqB,EAAE,CAAC;YACnC,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,uDAAuD;AACvD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,cAAsB,EACtB,WAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAA;IAC9D,MAAM,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAA;AACxC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a list of files with conflict markers present
|
|
3
|
+
*
|
|
4
|
+
* @param repositoryPath filepath to repository
|
|
5
|
+
* @returns filepaths with their number of conflicted markers
|
|
6
|
+
*/
|
|
7
|
+
export declare function getFilesWithConflictMarkers(repositoryPath: string): Promise<Map<string, number>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { git } from './core.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a list of files with conflict markers present
|
|
4
|
+
*
|
|
5
|
+
* @param repositoryPath filepath to repository
|
|
6
|
+
* @returns filepaths with their number of conflicted markers
|
|
7
|
+
*/
|
|
8
|
+
export async function getFilesWithConflictMarkers(repositoryPath) {
|
|
9
|
+
const { stdout } = await git(['diff', '--check'], repositoryPath, 'getFilesWithConflictMarkers', { successExitCodes: new Set([0, 2]) });
|
|
10
|
+
const files = new Map();
|
|
11
|
+
const matches = stdout.matchAll(/^(.+):\d+: leftover conflict marker/gm);
|
|
12
|
+
for (const [, path] of matches) {
|
|
13
|
+
files.set(path, (files.get(path) ?? 0) + 1);
|
|
14
|
+
}
|
|
15
|
+
return files;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=diff-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-check.js","sourceRoot":"","sources":["../../src/git/diff-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAE/B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,cAAsB;IAEtB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAC1B,CAAC,MAAM,EAAE,SAAS,CAAC,EACnB,cAAc,EACd,6BAA6B,EAC7B,EAAE,gBAAgB,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CACtC,CAAA;IAED,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,uCAAuC,CAAC,CAAA;IAExE,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE,CAAC;QAC/B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAC7C,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Repository } from '../models/repository.js';
|
|
2
|
+
/**
|
|
3
|
+
* Possible statuses of an entry in Git, see the git diff-index
|
|
4
|
+
* man page for additional details.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum IndexStatus {
|
|
7
|
+
Unknown = 0,
|
|
8
|
+
Added = 1,
|
|
9
|
+
Copied = 2,
|
|
10
|
+
Deleted = 3,
|
|
11
|
+
Modified = 4,
|
|
12
|
+
Renamed = 5,
|
|
13
|
+
TypeChanged = 6,
|
|
14
|
+
Unmerged = 7
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Index statuses excluding renames and copies.
|
|
18
|
+
*
|
|
19
|
+
* Used when invoking diff-index with rename detection explicitly turned
|
|
20
|
+
* off.
|
|
21
|
+
*/
|
|
22
|
+
export type NoRenameIndexStatus = IndexStatus.Added | IndexStatus.Deleted | IndexStatus.Modified | IndexStatus.TypeChanged | IndexStatus.Unmerged | IndexStatus.Unknown;
|
|
23
|
+
/** The SHA for the null tree. */
|
|
24
|
+
export declare const NullTreeSHA = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
25
|
+
/**
|
|
26
|
+
* Get a list of files which have recorded changes in the index as compared to
|
|
27
|
+
* HEAD along with the type of change.
|
|
28
|
+
*
|
|
29
|
+
* @param repository The repository for which to retrieve the index changes.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getIndexChanges(repository: Repository): Promise<Map<string, NoRenameIndexStatus>>;
|