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
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import { GitError } from './exec.js';
|
|
2
|
+
import byline from 'byline';
|
|
3
|
+
import { AppFileStatusKind, } from '../models/status.js';
|
|
4
|
+
import { merge } from '../lib/merge.js';
|
|
5
|
+
import { formatRebaseValue } from '../lib/rebase.js';
|
|
6
|
+
import { git, gitRebaseArguments, } from './core.js';
|
|
7
|
+
import { stageManualConflictResolution } from './stage.js';
|
|
8
|
+
import { stageFiles } from './update-index.js';
|
|
9
|
+
import { getStatus } from './status.js';
|
|
10
|
+
import { getCommitsBetweenCommits } from './rev-list.js';
|
|
11
|
+
import { join } from 'path';
|
|
12
|
+
import { readFile } from 'fs/promises';
|
|
13
|
+
import { pathExists } from '../lib/path-exists.js';
|
|
14
|
+
/** The app-specific results from attempting to rebase a repository */
|
|
15
|
+
export var RebaseResult;
|
|
16
|
+
(function (RebaseResult) {
|
|
17
|
+
/**
|
|
18
|
+
* Git completed the rebase without reporting any errors, and the caller can
|
|
19
|
+
* signal success to the user.
|
|
20
|
+
*/
|
|
21
|
+
RebaseResult["CompletedWithoutError"] = "CompletedWithoutError";
|
|
22
|
+
/**
|
|
23
|
+
* Git completed the rebase without reporting any errors, but the branch was
|
|
24
|
+
* already up to date and there was nothing to do.
|
|
25
|
+
*/
|
|
26
|
+
RebaseResult["AlreadyUpToDate"] = "AlreadyUpToDate";
|
|
27
|
+
/**
|
|
28
|
+
* The rebase encountered conflicts while attempting to rebase, and these
|
|
29
|
+
* need to be resolved by the user before the rebase can continue.
|
|
30
|
+
*/
|
|
31
|
+
RebaseResult["ConflictsEncountered"] = "ConflictsEncountered";
|
|
32
|
+
/**
|
|
33
|
+
* The rebase was not able to continue as tracked files were not staged in
|
|
34
|
+
* the index.
|
|
35
|
+
*/
|
|
36
|
+
RebaseResult["OutstandingFilesNotStaged"] = "OutstandingFilesNotStaged";
|
|
37
|
+
/**
|
|
38
|
+
* The rebase was not attempted because it could not check the status of the
|
|
39
|
+
* repository. The caller needs to confirm the repository is in a usable
|
|
40
|
+
* state.
|
|
41
|
+
*/
|
|
42
|
+
RebaseResult["Aborted"] = "Aborted";
|
|
43
|
+
/**
|
|
44
|
+
* An unexpected error as part of the rebase flow was caught and handled.
|
|
45
|
+
*
|
|
46
|
+
* Check the logs to find the relevant Git details.
|
|
47
|
+
*/
|
|
48
|
+
RebaseResult["Error"] = "Error";
|
|
49
|
+
})(RebaseResult || (RebaseResult = {}));
|
|
50
|
+
/**
|
|
51
|
+
* Check the `.git/REBASE_HEAD` file exists in a repository to confirm
|
|
52
|
+
* a rebase operation is underway.
|
|
53
|
+
*/
|
|
54
|
+
function isRebaseHeadSet(repository) {
|
|
55
|
+
const path = join(repository.resolvedGitDir, 'REBASE_HEAD');
|
|
56
|
+
return pathExists(path);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get the internal state about the rebase being performed on a repository. This
|
|
60
|
+
* information is required to help Desktop display information to the user
|
|
61
|
+
* about the current action as well as the options available.
|
|
62
|
+
*
|
|
63
|
+
* Returns `null` if no rebase is detected, or if the expected information
|
|
64
|
+
* cannot be found in the repository.
|
|
65
|
+
*/
|
|
66
|
+
export async function getRebaseInternalState(repository) {
|
|
67
|
+
const isRebase = await isRebaseHeadSet(repository);
|
|
68
|
+
if (!isRebase) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
let originalBranchTip = null;
|
|
72
|
+
let targetBranch = null;
|
|
73
|
+
let baseBranchTip = null;
|
|
74
|
+
try {
|
|
75
|
+
originalBranchTip = await readFile(join(repository.resolvedGitDir, 'rebase-merge', 'orig-head'), 'utf8');
|
|
76
|
+
originalBranchTip = originalBranchTip.trim();
|
|
77
|
+
targetBranch = await readFile(join(repository.resolvedGitDir, 'rebase-merge', 'head-name'), 'utf8');
|
|
78
|
+
if (targetBranch.startsWith('refs/heads/')) {
|
|
79
|
+
targetBranch = targetBranch.substring(11).trim();
|
|
80
|
+
}
|
|
81
|
+
baseBranchTip = await readFile(join(repository.resolvedGitDir, 'rebase-merge', 'onto'), 'utf8');
|
|
82
|
+
baseBranchTip = baseBranchTip.trim();
|
|
83
|
+
}
|
|
84
|
+
catch { }
|
|
85
|
+
if (originalBranchTip != null &&
|
|
86
|
+
targetBranch != null &&
|
|
87
|
+
baseBranchTip != null) {
|
|
88
|
+
return { originalBranchTip, targetBranch, baseBranchTip };
|
|
89
|
+
}
|
|
90
|
+
// unable to resolve the rebase state of this repository
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Inspect the `.git/rebase-merge` folder and convert the current rebase state
|
|
95
|
+
* into data that can be provided to the rebase flow to update the application
|
|
96
|
+
* state.
|
|
97
|
+
*
|
|
98
|
+
* This is required when Desktop is not responsible for initiating the rebase:
|
|
99
|
+
*
|
|
100
|
+
* - when a rebase outside Desktop encounters conflicts
|
|
101
|
+
* - when a `git pull --rebase` was run and encounters conflicts
|
|
102
|
+
*
|
|
103
|
+
*/
|
|
104
|
+
export async function getRebaseSnapshot(repository) {
|
|
105
|
+
const rebaseHead = await isRebaseHeadSet(repository);
|
|
106
|
+
if (!rebaseHead) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
let next = -1;
|
|
110
|
+
let last = -1;
|
|
111
|
+
let originalBranchTip = null;
|
|
112
|
+
let baseBranchTip = null;
|
|
113
|
+
// if the repository is in the middle of a rebase `.git/rebase-merge` will
|
|
114
|
+
// contain all the patches of commits that are being rebased into
|
|
115
|
+
// auto-incrementing files, e.g. `0001`, `0002`, `0003`, etc ...
|
|
116
|
+
try {
|
|
117
|
+
// this contains the patch number that was recently applied to the repository
|
|
118
|
+
const nextText = await readFile(join(repository.resolvedGitDir, 'rebase-merge', 'msgnum'), 'utf8');
|
|
119
|
+
next = parseInt(nextText, 10);
|
|
120
|
+
if (isNaN(next)) {
|
|
121
|
+
console.warn(`[getCurrentProgress] found '${nextText}' in .git/rebase-merge/msgnum which could not be parsed to a valid number`);
|
|
122
|
+
next = -1;
|
|
123
|
+
}
|
|
124
|
+
// this contains the total number of patches to be applied to the repository
|
|
125
|
+
const lastText = await readFile(join(repository.resolvedGitDir, 'rebase-merge', 'end'), 'utf8');
|
|
126
|
+
last = parseInt(lastText, 10);
|
|
127
|
+
if (isNaN(last)) {
|
|
128
|
+
console.warn(`[getCurrentProgress] found '${lastText}' in .git/rebase-merge/last which could not be parsed to a valid number`);
|
|
129
|
+
last = -1;
|
|
130
|
+
}
|
|
131
|
+
originalBranchTip = await readFile(join(repository.resolvedGitDir, 'rebase-merge', 'orig-head'), 'utf8');
|
|
132
|
+
originalBranchTip = originalBranchTip.trim();
|
|
133
|
+
baseBranchTip = await readFile(join(repository.resolvedGitDir, 'rebase-merge', 'onto'), 'utf8');
|
|
134
|
+
baseBranchTip = baseBranchTip.trim();
|
|
135
|
+
}
|
|
136
|
+
catch { }
|
|
137
|
+
if (next > 0 &&
|
|
138
|
+
last > 0 &&
|
|
139
|
+
originalBranchTip !== null &&
|
|
140
|
+
baseBranchTip !== null) {
|
|
141
|
+
const percentage = next / last;
|
|
142
|
+
const value = formatRebaseValue(percentage);
|
|
143
|
+
const commits = await getCommitsBetweenCommits(repository, baseBranchTip, originalBranchTip);
|
|
144
|
+
if (commits === null || commits.length === 0) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
// this number starts from 1, but our array of commits starts from 0
|
|
148
|
+
const nextCommitIndex = next - 1;
|
|
149
|
+
const hasValidCommit = commits.length > 0 &&
|
|
150
|
+
nextCommitIndex >= 0 &&
|
|
151
|
+
nextCommitIndex < commits.length;
|
|
152
|
+
const currentCommitSummary = hasValidCommit
|
|
153
|
+
? commits[nextCommitIndex].summary
|
|
154
|
+
: '';
|
|
155
|
+
return {
|
|
156
|
+
progress: {
|
|
157
|
+
kind: 'multiCommitOperation',
|
|
158
|
+
value,
|
|
159
|
+
position: next,
|
|
160
|
+
totalCommitCount: last,
|
|
161
|
+
currentCommitSummary,
|
|
162
|
+
},
|
|
163
|
+
commits,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Attempt to read the `.git/REBASE_HEAD` file inside a repository to confirm
|
|
170
|
+
* the rebase is still active.
|
|
171
|
+
*/
|
|
172
|
+
async function readRebaseHead(repository) {
|
|
173
|
+
try {
|
|
174
|
+
const rebaseHead = join(repository.resolvedGitDir, 'REBASE_HEAD');
|
|
175
|
+
const rebaseCurrentCommitOutput = await readFile(rebaseHead, 'utf8');
|
|
176
|
+
return rebaseCurrentCommitOutput.trim();
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
console.warn('[rebase] a problem was encountered reading .git/REBASE_HEAD, so it is unsafe to continue rebasing', err);
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/** Regex for identifying when rebase applied each commit onto the base branch */
|
|
184
|
+
const rebasingRe = /^Rebasing \((\d+)\/(\d+)\)$/;
|
|
185
|
+
/**
|
|
186
|
+
* A parser to read and emit rebase progress from Git `stderr`
|
|
187
|
+
*/
|
|
188
|
+
class GitRebaseParser {
|
|
189
|
+
commits;
|
|
190
|
+
constructor(commits) {
|
|
191
|
+
this.commits = commits;
|
|
192
|
+
}
|
|
193
|
+
parse(line) {
|
|
194
|
+
const match = rebasingRe.exec(line);
|
|
195
|
+
if (match === null || match.length !== 3) {
|
|
196
|
+
// Git will sometimes emit other output (for example, when it tries to
|
|
197
|
+
// resolve conflicts) and this does not match the expected output
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const rebasedCommitCount = parseInt(match[1], 10);
|
|
201
|
+
const totalCommitCount = parseInt(match[2], 10);
|
|
202
|
+
if (isNaN(rebasedCommitCount) || isNaN(totalCommitCount)) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
const currentCommitSummary = this.commits[rebasedCommitCount - 1]?.summary ?? '';
|
|
206
|
+
const progress = rebasedCommitCount / totalCommitCount;
|
|
207
|
+
const value = formatRebaseValue(progress);
|
|
208
|
+
return {
|
|
209
|
+
kind: 'multiCommitOperation',
|
|
210
|
+
value,
|
|
211
|
+
position: rebasedCommitCount,
|
|
212
|
+
totalCommitCount: totalCommitCount,
|
|
213
|
+
currentCommitSummary,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function configureOptionsForRebase(options, progress) {
|
|
218
|
+
if (progress === undefined) {
|
|
219
|
+
return options;
|
|
220
|
+
}
|
|
221
|
+
const { commits, progressCallback } = progress;
|
|
222
|
+
return merge(options, {
|
|
223
|
+
processCallback: (process) => {
|
|
224
|
+
// If Node.js encounters a synchronous runtime error while spawning
|
|
225
|
+
// `stderr` will be undefined and the error will be emitted asynchronously
|
|
226
|
+
if (process.stderr === null) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const parser = new GitRebaseParser(commits);
|
|
230
|
+
byline(process.stderr).on('data', (line) => {
|
|
231
|
+
const progress = parser.parse(line);
|
|
232
|
+
if (progress != null) {
|
|
233
|
+
progressCallback(progress);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* A stub function to use for initiating rebase in the app.
|
|
241
|
+
*
|
|
242
|
+
* If the rebase fails, the repository will be in an indeterminate state where
|
|
243
|
+
* the rebase is stuck.
|
|
244
|
+
*
|
|
245
|
+
* If the rebase completes without error, `featureBranch` will be checked out
|
|
246
|
+
* and it will probably have a different commit history.
|
|
247
|
+
*
|
|
248
|
+
* @param baseBranch the ref to start the rebase from
|
|
249
|
+
* @param targetBranch the ref to rebase onto `baseBranch`
|
|
250
|
+
*/
|
|
251
|
+
export async function rebase(repository, baseBranch, targetBranch, progressCallback) {
|
|
252
|
+
const baseOptions = {
|
|
253
|
+
expectedErrors: new Set([GitError.RebaseConflicts]),
|
|
254
|
+
};
|
|
255
|
+
let options = baseOptions;
|
|
256
|
+
if (progressCallback !== undefined) {
|
|
257
|
+
const commits = await getCommitsBetweenCommits(repository, baseBranch.tip.sha, targetBranch.tip.sha);
|
|
258
|
+
if (commits === null) {
|
|
259
|
+
// BadRevision can be raised here if git rev-list is unable to resolve a
|
|
260
|
+
// ref to a commit ID, so we need to signal to the caller that this rebase
|
|
261
|
+
// is not possible to perform
|
|
262
|
+
console.warn('Unable to rebase these branches because one or both of the refs do not exist in the repository');
|
|
263
|
+
return RebaseResult.Error;
|
|
264
|
+
}
|
|
265
|
+
options = configureOptionsForRebase(baseOptions, {
|
|
266
|
+
commits,
|
|
267
|
+
progressCallback,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
const result = await git([...gitRebaseArguments(), 'rebase', baseBranch.name, targetBranch.name], repository.path, 'rebase', options);
|
|
271
|
+
return parseRebaseResult(result);
|
|
272
|
+
}
|
|
273
|
+
/** Abandon the current rebase operation */
|
|
274
|
+
export async function abortRebase(repository) {
|
|
275
|
+
await git(['rebase', '--abort'], repository.path, 'abortRebase');
|
|
276
|
+
}
|
|
277
|
+
function parseRebaseResult(result) {
|
|
278
|
+
if (result.exitCode === 0) {
|
|
279
|
+
if (result.stdout.trim().match(/^Current branch [^ ]+ is up to date.$/i)) {
|
|
280
|
+
return RebaseResult.AlreadyUpToDate;
|
|
281
|
+
}
|
|
282
|
+
return RebaseResult.CompletedWithoutError;
|
|
283
|
+
}
|
|
284
|
+
if (result.gitError === GitError.RebaseConflicts) {
|
|
285
|
+
return RebaseResult.ConflictsEncountered;
|
|
286
|
+
}
|
|
287
|
+
if (result.gitError === GitError.UnresolvedConflicts) {
|
|
288
|
+
return RebaseResult.OutstandingFilesNotStaged;
|
|
289
|
+
}
|
|
290
|
+
throw new Error(`Unhandled result found: '${JSON.stringify(result)}'`);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Proceed with the current rebase operation and report back on whether it completed
|
|
294
|
+
*
|
|
295
|
+
* It is expected that the index has staged files which are cleanly rebased onto
|
|
296
|
+
* the base branch, and the remaining unstaged files are those which need manual
|
|
297
|
+
* resolution or were changed by the user to address inline conflicts.
|
|
298
|
+
*
|
|
299
|
+
*/
|
|
300
|
+
export async function continueRebase(repository, files, manualResolutions = new Map(), opts) {
|
|
301
|
+
const trackedFiles = files.filter(f => {
|
|
302
|
+
return f.status.kind !== AppFileStatusKind.Untracked;
|
|
303
|
+
});
|
|
304
|
+
// apply conflict resolutions
|
|
305
|
+
for (const [path, resolution] of manualResolutions) {
|
|
306
|
+
const file = files.find(f => f.path === path);
|
|
307
|
+
if (file !== undefined) {
|
|
308
|
+
await stageManualConflictResolution(repository, file, resolution);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
console.error(`[continueRebase] couldn't find file ${path} even though there's a manual resolution for it`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const otherFiles = trackedFiles.filter(f => !manualResolutions.has(f.path));
|
|
315
|
+
await stageFiles(repository, otherFiles);
|
|
316
|
+
const status = await getStatus(repository, false);
|
|
317
|
+
if (status == null) {
|
|
318
|
+
console.warn(`[continueRebase] unable to get status after staging changes, skipping any other steps`);
|
|
319
|
+
return RebaseResult.Aborted;
|
|
320
|
+
}
|
|
321
|
+
const rebaseCurrentCommit = await readRebaseHead(repository);
|
|
322
|
+
if (rebaseCurrentCommit === null) {
|
|
323
|
+
return RebaseResult.Aborted;
|
|
324
|
+
}
|
|
325
|
+
const trackedFilesAfter = status.workingDirectory.files.filter(f => f.status.kind !== AppFileStatusKind.Untracked);
|
|
326
|
+
const baseOptions = {
|
|
327
|
+
expectedErrors: new Set([
|
|
328
|
+
GitError.RebaseConflicts,
|
|
329
|
+
GitError.UnresolvedConflicts,
|
|
330
|
+
]),
|
|
331
|
+
env: {
|
|
332
|
+
GIT_EDITOR: opts?.gitEditor ?? ':',
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
let options = baseOptions;
|
|
336
|
+
if (opts?.progressCallback) {
|
|
337
|
+
const snapshot = await getRebaseSnapshot(repository);
|
|
338
|
+
if (snapshot === null) {
|
|
339
|
+
console.warn(`[continueRebase] unable to get rebase status, skipping any other steps`);
|
|
340
|
+
return RebaseResult.Aborted;
|
|
341
|
+
}
|
|
342
|
+
options = configureOptionsForRebase(baseOptions, {
|
|
343
|
+
commits: snapshot.commits,
|
|
344
|
+
progressCallback: opts.progressCallback,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
options = {
|
|
348
|
+
...options,
|
|
349
|
+
onTerminalOutputAvailable: opts?.onTerminalOutputAvailable,
|
|
350
|
+
onHookFailure: opts?.onHookFailure,
|
|
351
|
+
onHookProgress: opts?.onHookProgress,
|
|
352
|
+
};
|
|
353
|
+
if (trackedFilesAfter.length === 0) {
|
|
354
|
+
console.warn(`[rebase] no tracked changes to commit for ${rebaseCurrentCommit}, continuing rebase but skipping this commit`);
|
|
355
|
+
const result = await git(['rebase', '--skip', ...(opts?.noVerify ? ['--no-verify'] : [])], repository.path, 'continueRebaseSkipCurrentCommit', options);
|
|
356
|
+
return parseRebaseResult(result);
|
|
357
|
+
}
|
|
358
|
+
const result = await git(['rebase', '--continue', ...(opts?.noVerify ? ['--no-verify'] : [])], repository.path, 'continueRebase', options);
|
|
359
|
+
return parseRebaseResult(result);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Method for initiating interactive rebase in the app.
|
|
363
|
+
*
|
|
364
|
+
* In order to modify the interactive todo list during interactive rebase, we
|
|
365
|
+
* create a temporary todo list of our own. Pass that file's path into our
|
|
366
|
+
* interactive rebase and using the sequence.editor to cat replace the
|
|
367
|
+
* interactive todo list with the contents of our generated one.
|
|
368
|
+
*
|
|
369
|
+
* @param pathOfGeneratedTodo path to generated todo list for interactive rebase
|
|
370
|
+
* @param lastRetainedCommitRef the commit before the earliest commit to be
|
|
371
|
+
* changed during the interactive rebase or null if commit is root (first commit
|
|
372
|
+
* in history) of branch
|
|
373
|
+
*/
|
|
374
|
+
export async function rebaseInteractive(repository, pathOfGeneratedTodo, lastRetainedCommitRef, opts) {
|
|
375
|
+
const baseOptions = {
|
|
376
|
+
expectedErrors: new Set([GitError.RebaseConflicts]),
|
|
377
|
+
env: {
|
|
378
|
+
GIT_SEQUENCE_EDITOR: undefined,
|
|
379
|
+
GIT_EDITOR: opts?.gitEditor ?? ':',
|
|
380
|
+
},
|
|
381
|
+
};
|
|
382
|
+
let options = baseOptions;
|
|
383
|
+
const { progressCallback, commits } = opts ?? {};
|
|
384
|
+
if (progressCallback) {
|
|
385
|
+
if (!commits) {
|
|
386
|
+
console.warn(`Unable to interactively rebase if no commits`);
|
|
387
|
+
return RebaseResult.Error;
|
|
388
|
+
}
|
|
389
|
+
options = configureOptionsForRebase(baseOptions, {
|
|
390
|
+
commits,
|
|
391
|
+
progressCallback,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
options = {
|
|
395
|
+
...options,
|
|
396
|
+
onHookProgress: opts?.onHookProgress,
|
|
397
|
+
onHookFailure: opts?.onHookFailure,
|
|
398
|
+
onTerminalOutputAvailable: opts?.onTerminalOutputAvailable,
|
|
399
|
+
};
|
|
400
|
+
/* If the commit is the first commit in the branch, we cannot reference it
|
|
401
|
+
using the sha thus if lastRetainedCommitRef is null (we couldn't define it),
|
|
402
|
+
we must use the --root flag */
|
|
403
|
+
const ref = lastRetainedCommitRef == null ? '--root' : lastRetainedCommitRef;
|
|
404
|
+
const result = await git([
|
|
405
|
+
'-c',
|
|
406
|
+
// This replaces interactive todo with contents of file at pathOfGeneratedTodo
|
|
407
|
+
`sequence.editor=cat "${pathOfGeneratedTodo}" >`,
|
|
408
|
+
'rebase',
|
|
409
|
+
...(opts?.noVerify ? ['--no-verify'] : []),
|
|
410
|
+
'-i',
|
|
411
|
+
ref,
|
|
412
|
+
], repository.path, opts?.action ?? 'Interactive rebase', options);
|
|
413
|
+
return parseRebaseResult(result);
|
|
414
|
+
}
|
|
415
|
+
//# sourceMappingURL=rebase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rebase.js","sourceRoot":"","sources":["../../src/git/rebase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAK3B,OAAO,EAEL,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,E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AO;YACP,gBAAgB;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,GAAG;QACR,GAAG,OAAO;QACV,cAAc,EAAE,IAAI,EAAE,cAAc;QACpC,aAAa,EAAE,IAAI,EAAE,aAAa;QAClC,yBAAyB,EAAE,IAAI,EAAE,yBAAyB;KAC3D,CAAA;IAED;;kCAE8B;IAC9B,MAAM,GAAG,GAAG,qBAAqB,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAA;IAC5E,MAAM,MAAM,GAAG,MAAM,GAAG,CACtB;QACE,IAAI;QACJ,8EAA8E;QAC9E,wBAAwB,mBAAmB,KAAK;QAChD,QAAQ;QACR,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,IAAI;QACJ,GAAG;KACJ,EACD,UAAU,CAAC,IAAI,EACf,IAAI,EAAE,MAAM,IAAI,oBAAoB,EACpC,OAAO,CACR,CAAA;IAED,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Repository } from '../models/repository.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the `limit` most recently checked out branches.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getRecentBranches(repository: Repository, limit: number): Promise<ReadonlyArray<string>>;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the distinct list of branches that have been checked out after a specific date
|
|
8
|
+
* Returns a map keyed on branch names
|
|
9
|
+
*
|
|
10
|
+
* @param repository the repository who's reflog you want to check
|
|
11
|
+
* @param afterDate filters checkouts so that only those occurring on or after this date are returned
|
|
12
|
+
* @returns map of branch name -> checkout date
|
|
13
|
+
*/
|
|
14
|
+
export declare function getBranchCheckouts(repository: Repository, afterDate: Date): Promise<Map<string, Date>>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { git } from './core.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the `limit` most recently checked out branches.
|
|
4
|
+
*/
|
|
5
|
+
export async function getRecentBranches(repository, limit) {
|
|
6
|
+
// "git reflog show" is just an alias for "git log -g --abbrev-commit --pretty=oneline"
|
|
7
|
+
// but by using log we can give it a max number which should prevent us from balling out
|
|
8
|
+
// of control when there's ginormous reflogs around (as in e.g. github/github).
|
|
9
|
+
const regex = new RegExp(/.*? (renamed|checkout)(?:: moving from|\s*) (?:refs\/heads\/|\s*)(.*?) to (?:refs\/heads\/|\s*)(.*?)$/i);
|
|
10
|
+
const result = await git([
|
|
11
|
+
'log',
|
|
12
|
+
'-g',
|
|
13
|
+
'--no-abbrev-commit',
|
|
14
|
+
'--pretty=oneline',
|
|
15
|
+
'HEAD',
|
|
16
|
+
'-n',
|
|
17
|
+
'2500',
|
|
18
|
+
'--',
|
|
19
|
+
], repository.path, 'getRecentBranches', { successExitCodes: new Set([0, 128]) });
|
|
20
|
+
if (result.exitCode === 128) {
|
|
21
|
+
// error code 128 is returned if the branch is unborn
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
const lines = result.stdout.split('\n');
|
|
25
|
+
const names = new Set();
|
|
26
|
+
const excludedNames = new Set();
|
|
27
|
+
for (const line of lines) {
|
|
28
|
+
const result = regex.exec(line);
|
|
29
|
+
if (result && result.length === 4) {
|
|
30
|
+
const operationType = result[1];
|
|
31
|
+
const excludeBranchName = result[2];
|
|
32
|
+
const branchName = result[3];
|
|
33
|
+
if (operationType === 'renamed') {
|
|
34
|
+
// exclude intermediate-state renaming branch from recent branches
|
|
35
|
+
excludedNames.add(excludeBranchName);
|
|
36
|
+
}
|
|
37
|
+
if (!excludedNames.has(branchName)) {
|
|
38
|
+
names.add(branchName);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (names.size === limit) {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return [...names];
|
|
46
|
+
}
|
|
47
|
+
const noCommitsOnBranchRe = new RegExp("fatal: your current branch '.*' does not have any commits yet");
|
|
48
|
+
/**
|
|
49
|
+
* Gets the distinct list of branches that have been checked out after a specific date
|
|
50
|
+
* Returns a map keyed on branch names
|
|
51
|
+
*
|
|
52
|
+
* @param repository the repository who's reflog you want to check
|
|
53
|
+
* @param afterDate filters checkouts so that only those occurring on or after this date are returned
|
|
54
|
+
* @returns map of branch name -> checkout date
|
|
55
|
+
*/
|
|
56
|
+
export async function getBranchCheckouts(repository, afterDate) {
|
|
57
|
+
//regexr.com/46n1v
|
|
58
|
+
const regex = new RegExp(/^[a-z0-9]{40}\sHEAD@{(.*)}\scheckout: moving from\s.*\sto\s(.*)$/);
|
|
59
|
+
const result = await git([
|
|
60
|
+
'reflog',
|
|
61
|
+
'--date=iso',
|
|
62
|
+
`--after="${afterDate.toISOString()}"`,
|
|
63
|
+
'--pretty=%H %gd %gs',
|
|
64
|
+
`--grep-reflog=checkout: moving from .* to .*$`,
|
|
65
|
+
'--',
|
|
66
|
+
], repository.path, 'getCheckoutsAfterDate', { successExitCodes: new Set([0, 128]) });
|
|
67
|
+
const checkouts = new Map();
|
|
68
|
+
// edge case where orphaned branch is created but Git raises error when
|
|
69
|
+
// reading the reflog on this new branch as it has no commits
|
|
70
|
+
//
|
|
71
|
+
// see https://github.com/desktop/desktop/issues/7983 for more information
|
|
72
|
+
if (result.exitCode === 128 && noCommitsOnBranchRe.test(result.stderr)) {
|
|
73
|
+
return checkouts;
|
|
74
|
+
}
|
|
75
|
+
const lines = result.stdout.split('\n');
|
|
76
|
+
for (const line of lines) {
|
|
77
|
+
const parsedLine = regex.exec(line);
|
|
78
|
+
if (parsedLine === null || parsedLine.length !== 3) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const [, timestamp, branchName] = parsedLine;
|
|
82
|
+
if (!checkouts.has(branchName)) {
|
|
83
|
+
checkouts.set(branchName, new Date(timestamp));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return checkouts;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=reflog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflog.js","sourceRoot":"","sources":["../../src/git/reflog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAG/B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAAsB,EACtB,KAAa;IAEb,uFAAuF;IACvF,wFAAwF;IACxF,+EAA+E;IAC/E,MAAM,KAAK,GAAG,IAAI,MAAM,CACtB,wGAAwG,CACzG,CAAA;IAED,MAAM,MAAM,GAAG,MAAM,GAAG,CACtB;QACE,KAAK;QACL,IAAI;QACJ,oBAAoB;QACpB,kBAAkB;QAClB,MAAM;QACN,IAAI;QACJ,MAAM;QACN,IAAI;KACL,EACD,UAAU,CAAC,IAAI,EACf,mBAAmB,EACnB,EAAE,gBAAgB,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CACxC,CAAA;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;QAC5B,qDAAqD;QACrD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAC/B,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAA;IAEvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;YAC/B,MAAM,iBAAiB,GAAG,MAAM,CAAC,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C;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEnC,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnD,SAAQ;QACV,CAAC;QAED,MAAM,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,GAAG,UAAU,CAAA;QAC5C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Repository } from '../models/repository.js';
|
|
2
|
+
/**
|
|
3
|
+
* Format a local branch in the ref syntax, ensuring situations when the branch
|
|
4
|
+
* is ambiguous are handled.
|
|
5
|
+
*
|
|
6
|
+
* Examples:
|
|
7
|
+
* - main -> refs/heads/main
|
|
8
|
+
* - heads/Microsoft/main -> refs/heads/Microsoft/main
|
|
9
|
+
*
|
|
10
|
+
* @param branch The local branch name
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatAsLocalRef(name: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Read a symbolic ref from the repository.
|
|
15
|
+
*
|
|
16
|
+
* Symbolic refs are used to point to other refs, similar to how symlinks work
|
|
17
|
+
* for files. Because refs can be removed easily from a Git repository,
|
|
18
|
+
* symbolic refs should only be used when absolutely necessary.
|
|
19
|
+
*
|
|
20
|
+
* @param repository The repository to lookup
|
|
21
|
+
* @param ref The symbolic ref to resolve
|
|
22
|
+
*
|
|
23
|
+
* @returns the canonical ref, if found, or `null` if `ref` cannot be found or
|
|
24
|
+
* is not a symbolic ref
|
|
25
|
+
*/
|
|
26
|
+
export declare function getSymbolicRef(repository: Repository, ref: string): Promise<string | null>;
|
package/dist/git/refs.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { git } from './core.js';
|
|
2
|
+
/**
|
|
3
|
+
* Format a local branch in the ref syntax, ensuring situations when the branch
|
|
4
|
+
* is ambiguous are handled.
|
|
5
|
+
*
|
|
6
|
+
* Examples:
|
|
7
|
+
* - main -> refs/heads/main
|
|
8
|
+
* - heads/Microsoft/main -> refs/heads/Microsoft/main
|
|
9
|
+
*
|
|
10
|
+
* @param branch The local branch name
|
|
11
|
+
*/
|
|
12
|
+
export function formatAsLocalRef(name) {
|
|
13
|
+
if (name.startsWith('heads/')) {
|
|
14
|
+
// In some cases, Git will report this name explicitly to distinguish from
|
|
15
|
+
// a remote ref with the same name - this ensures we format it correctly.
|
|
16
|
+
return `refs/${name}`;
|
|
17
|
+
}
|
|
18
|
+
else if (!name.startsWith('refs/heads/')) {
|
|
19
|
+
// By default Git will drop the heads prefix unless absolutely necessary
|
|
20
|
+
// - include this to ensure the ref is fully qualified.
|
|
21
|
+
return `refs/heads/${name}`;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return name;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Read a symbolic ref from the repository.
|
|
29
|
+
*
|
|
30
|
+
* Symbolic refs are used to point to other refs, similar to how symlinks work
|
|
31
|
+
* for files. Because refs can be removed easily from a Git repository,
|
|
32
|
+
* symbolic refs should only be used when absolutely necessary.
|
|
33
|
+
*
|
|
34
|
+
* @param repository The repository to lookup
|
|
35
|
+
* @param ref The symbolic ref to resolve
|
|
36
|
+
*
|
|
37
|
+
* @returns the canonical ref, if found, or `null` if `ref` cannot be found or
|
|
38
|
+
* is not a symbolic ref
|
|
39
|
+
*/
|
|
40
|
+
export async function getSymbolicRef(repository, ref) {
|
|
41
|
+
const result = await git(['symbolic-ref', '-q', ref], repository.path, 'getSymbolicRef', {
|
|
42
|
+
// - 1 is the exit code that Git throws in quiet mode when the ref is not a
|
|
43
|
+
// symbolic ref
|
|
44
|
+
// - 128 is the generic error code that Git returns when it can't find
|
|
45
|
+
// something
|
|
46
|
+
successExitCodes: new Set([0, 1, 128]),
|
|
47
|
+
});
|
|
48
|
+
if (result.exitCode === 1 || result.exitCode === 128) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return result.stdout.trim();
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../src/git/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAG/B;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,0EAA0E;QAC1E,yEAAyE;QACzE,OAAO,QAAQ,IAAI,EAAE,CAAA;IACvB,CAAC;SAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,wEAAwE;QACxE,uDAAuD;QACvD,OAAO,cAAc,IAAI,EAAE,CAAA;IAC7B,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,UAAsB,EACtB,GAAW;IAEX,MAAM,MAAM,GAAG,MAAM,GAAG,CACtB,CAAC,cAAc,EAAE,IAAI,EAAE,GAAG,CAAC,EAC3B,UAAU,CAAC,IAAI,EACf,gBAAgB,EAChB;QACE,4EAA4E;QAC5E,kBAAkB;QAClB,uEAAuE;QACvE,eAAe;QACf,gBAAgB,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;KACvC,CACF,CAAA;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;QACrD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;AAC7B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Repository } from '../models/repository.js';
|
|
2
|
+
import { IRemote } from '../models/remote.js';
|
|
3
|
+
/**
|
|
4
|
+
* List the remotes, sorted alphabetically by `name`, for a repository.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getRemotes(repository: Repository): Promise<ReadonlyArray<IRemote>>;
|
|
7
|
+
/**
|
|
8
|
+
* List the remotes, sorted alphabetically by `name`, for a repository path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getRemotesFromPath(path: string): Promise<ReadonlyArray<IRemote>>;
|
|
11
|
+
export declare const memoizedGetRemotesFromPath: import("memoize-one").MemoizedFn<typeof getRemotesFromPath>;
|
|
12
|
+
/** Add a new remote with the given URL. */
|
|
13
|
+
export declare function addRemote(repository: Repository, name: string, url: string): Promise<IRemote>;
|
|
14
|
+
/** Removes an existing remote, or silently errors if it doesn't exist */
|
|
15
|
+
export declare function removeRemote(repository: Repository, name: string): Promise<void>;
|
|
16
|
+
/** Changes the URL for the remote that matches the given name */
|
|
17
|
+
export declare function setRemoteURL(repository: Repository, name: string, url: string): Promise<true>;
|
|
18
|
+
/**
|
|
19
|
+
* Get the URL for the remote that matches the given name.
|
|
20
|
+
*
|
|
21
|
+
* Returns null if the remote could not be found
|
|
22
|
+
*/
|
|
23
|
+
export declare function getRemoteURL(repository: Repository, name: string): Promise<string | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Update the HEAD ref of the remote, which is the default branch.
|
|
26
|
+
*
|
|
27
|
+
* @param isBackgroundTask Whether the fetch is being performed as a
|
|
28
|
+
* background task as opposed to being user initiated
|
|
29
|
+
*/
|
|
30
|
+
export declare function updateRemoteHEAD(repository: Repository, remote: IRemote, isBackgroundTask: boolean): Promise<void>;
|
|
31
|
+
export declare function getRemoteHEAD(repository: Repository, remote: string): Promise<string | null>;
|