@gitkraken/core-gitlens 0.2.0 → 0.3.1
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/CHANGELOG.md +11 -1
- package/dist/git/cache.d.ts +38 -8
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +120 -55
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +19 -0
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.d.ts.map +1 -1
- package/dist/git/features.js +1 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/commit.d.ts.map +1 -1
- package/dist/git/models/commit.js.map +1 -1
- package/dist/git/models/graph.d.ts +96 -0
- package/dist/git/models/graph.d.ts.map +1 -1
- package/dist/git/models/graph.js +24 -1
- package/dist/git/models/graph.js.map +1 -1
- package/dist/git/models/reference.d.ts +31 -0
- package/dist/git/models/reference.d.ts.map +1 -1
- package/dist/git/models/remote.d.ts.map +1 -1
- package/dist/git/models/remote.js.map +1 -1
- package/dist/git/models/remoteProvider.d.ts +1 -0
- package/dist/git/models/remoteProvider.d.ts.map +1 -1
- package/dist/git/models/remoteProvider.js.map +1 -1
- package/dist/git/models/repository.d.ts +30 -13
- package/dist/git/models/repository.d.ts.map +1 -1
- package/dist/git/models/repository.js +89 -87
- package/dist/git/models/repository.js.map +1 -1
- package/dist/git/models/search.d.ts +2 -2
- package/dist/git/models/search.d.ts.map +1 -1
- package/dist/git/models/statusFile.d.ts +9 -0
- package/dist/git/models/statusFile.d.ts.map +1 -1
- package/dist/git/models/statusFile.js +11 -0
- package/dist/git/models/statusFile.js.map +1 -1
- package/dist/git/models/worktree.d.ts +4 -1
- package/dist/git/models/worktree.d.ts.map +1 -1
- package/dist/git/models/worktree.js +2 -2
- package/dist/git/models/worktree.js.map +1 -1
- package/dist/git/parsers/diffParser.d.ts.map +1 -1
- package/dist/git/parsers/diffParser.js.map +1 -1
- package/dist/git/providers/branches.d.ts +15 -4
- package/dist/git/providers/branches.d.ts.map +1 -1
- package/dist/git/providers/commits.d.ts +4 -0
- package/dist/git/providers/commits.d.ts.map +1 -1
- package/dist/git/providers/config.d.ts +5 -4
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/operations.d.ts +61 -12
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/pausedOperations.d.ts +3 -1
- package/dist/git/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git/providers/refs.d.ts +23 -2
- package/dist/git/providers/refs.d.ts.map +1 -1
- package/dist/git/providers/staging.d.ts +16 -0
- package/dist/git/providers/staging.d.ts.map +1 -1
- package/dist/git/providers/status.d.ts +4 -1
- package/dist/git/providers/status.d.ts.map +1 -1
- package/dist/git/remotes/azure-devops.d.ts.map +1 -1
- package/dist/git/remotes/azure-devops.js.map +1 -1
- package/dist/git/remotes/custom.d.ts +2 -0
- package/dist/git/remotes/custom.d.ts.map +1 -1
- package/dist/git/remotes/custom.js +20 -0
- package/dist/git/remotes/custom.js.map +1 -1
- package/dist/git/{exec.types.d.ts → run.types.d.ts} +22 -3
- package/dist/git/run.types.d.ts.map +1 -0
- package/dist/git/run.types.js +2 -0
- package/dist/git/run.types.js.map +1 -0
- package/dist/git/service.d.ts.map +1 -1
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/autolink.utils.d.ts.map +1 -1
- package/dist/git/utils/autolink.utils.js.map +1 -1
- package/dist/git/utils/blame.utils.d.ts.map +1 -1
- package/dist/git/utils/blame.utils.js.map +1 -1
- package/dist/git/utils/conflictResolution.utils.d.ts +6 -0
- package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -0
- package/dist/git/utils/conflictResolution.utils.js +25 -0
- package/dist/git/utils/conflictResolution.utils.js.map +1 -0
- package/dist/git/utils/contributor.utils.d.ts +3 -0
- package/dist/git/utils/contributor.utils.d.ts.map +1 -1
- package/dist/git/utils/contributor.utils.js +22 -0
- package/dist/git/utils/contributor.utils.js.map +1 -1
- package/dist/git/utils/fileStatus.utils.d.ts +2 -1
- package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
- package/dist/git/utils/fileStatus.utils.js +4 -0
- package/dist/git/utils/fileStatus.utils.js.map +1 -1
- package/dist/git/utils/reachability.utils.d.ts +37 -0
- package/dist/git/utils/reachability.utils.d.ts.map +1 -0
- package/dist/git/utils/reachability.utils.js +96 -0
- package/dist/git/utils/reachability.utils.js.map +1 -0
- package/dist/git/utils/search.utils.d.ts.map +1 -1
- package/dist/git/utils/search.utils.js +3 -0
- package/dist/git/utils/search.utils.js.map +1 -1
- package/dist/git/utils/sorting.d.ts +8 -0
- package/dist/git/utils/sorting.d.ts.map +1 -1
- package/dist/git/utils/sorting.js +15 -0
- package/dist/git/utils/sorting.js.map +1 -1
- package/dist/git/utils/status.utils.d.ts.map +1 -1
- package/dist/git/utils/status.utils.js.map +1 -1
- package/dist/git/watching/classifyChange.d.ts.map +1 -1
- package/dist/git/watching/classifyChange.js +8 -0
- package/dist/git/watching/classifyChange.js.map +1 -1
- package/dist/git/watching/gitIgnoreFilter.js +1 -1
- package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
- package/dist/git/watching/initWatcher.d.ts.map +1 -1
- package/dist/git/watching/initWatcher.js.map +1 -1
- package/dist/git/watching/watchGroup.d.ts.map +1 -1
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +4 -2
- package/dist/git/watching/watchService.d.ts.map +1 -1
- package/dist/git/watching/watchService.js +31 -6
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +14 -12
- package/dist/git/watching/watchSession.d.ts.map +1 -1
- package/dist/git/watching/watchSession.js +56 -55
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git-cli/exec/exec.types.d.ts +1 -1
- package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
- package/dist/git-cli/exec/git.d.ts +3 -3
- package/dist/git-cli/exec/git.d.ts.map +1 -1
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +10 -2
- package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
- package/dist/git-cli/exec/gitQueue.js +39 -12
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/blameParser.js.map +1 -1
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/refParser.d.ts +3 -30
- package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/refParser.js +30 -30
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/providers/blame.d.ts.map +1 -1
- package/dist/git-cli/providers/blame.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +15 -5
- package/dist/git-cli/providers/branches.d.ts.map +1 -1
- package/dist/git-cli/providers/branches.js +99 -68
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +1 -0
- package/dist/git-cli/providers/commits.d.ts.map +1 -1
- package/dist/git-cli/providers/commits.js +86 -30
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +19 -6
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js +86 -38
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/diff.d.ts.map +1 -1
- package/dist/git-cli/providers/diff.js +5 -3
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts.map +1 -1
- package/dist/git-cli/providers/graph.js +139 -16
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +17 -14
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js +135 -63
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/patch.d.ts.map +1 -1
- package/dist/git-cli/providers/patch.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +3 -1
- package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +7 -1
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts +19 -2
- package/dist/git-cli/providers/refs.d.ts.map +1 -1
- package/dist/git-cli/providers/refs.js +286 -2
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.d.ts +6 -0
- package/dist/git-cli/providers/staging.d.ts.map +1 -1
- package/dist/git-cli/providers/staging.js +32 -0
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts.map +1 -1
- package/dist/git-cli/providers/stash.js +20 -2
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +4 -1
- package/dist/git-cli/providers/status.d.ts.map +1 -1
- package/dist/git-cli/providers/status.js +8 -4
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/tags.d.ts.map +1 -1
- package/dist/git-cli/providers/tags.js +10 -6
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/ipc/discovery.d.ts +49 -0
- package/dist/ipc/discovery.d.ts.map +1 -0
- package/dist/ipc/discovery.js +147 -0
- package/dist/ipc/discovery.js.map +1 -0
- package/dist/ipc/ipcServer.d.ts +20 -0
- package/dist/ipc/ipcServer.d.ts.map +1 -0
- package/dist/ipc/ipcServer.js +162 -0
- package/dist/ipc/ipcServer.js.map +1 -0
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts +167 -0
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -0
- package/dist/plus/agents/providers/claudeCodeProvider.js +1786 -0
- package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +36 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.js +171 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -0
- package/dist/plus/agents/sanitizePrompt.d.ts +15 -0
- package/dist/plus/agents/sanitizePrompt.d.ts.map +1 -0
- package/dist/plus/agents/sanitizePrompt.js +103 -0
- package/dist/plus/agents/sanitizePrompt.js.map +1 -0
- package/dist/plus/agents/stateMachine.d.ts +32 -0
- package/dist/plus/agents/stateMachine.d.ts.map +1 -0
- package/dist/plus/agents/stateMachine.js +180 -0
- package/dist/plus/agents/stateMachine.js.map +1 -0
- package/dist/plus/agents/types.d.ts +254 -0
- package/dist/plus/agents/types.d.ts.map +1 -0
- package/dist/plus/agents/types.js +49 -0
- package/dist/plus/agents/types.js.map +1 -0
- package/dist/plus/ai/errors.d.ts +4 -1
- package/dist/plus/ai/errors.d.ts.map +1 -1
- package/dist/plus/ai/errors.js +38 -0
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/ai/models/model.d.ts +1 -1
- package/dist/plus/ai/models/model.d.ts.map +1 -1
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +11 -2
- package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
- package/dist/plus/ai/models/provider.d.ts +3 -0
- package/dist/plus/ai/models/provider.d.ts.map +1 -1
- package/dist/plus/ai/prompts.d.ts +1 -0
- package/dist/plus/ai/prompts.d.ts.map +1 -1
- package/dist/plus/ai/prompts.js +48 -8
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.d.ts +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.js +4 -1
- package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts +4 -3
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +9 -6
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/ai.utils.js +2 -0
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/results.utils.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +12 -1
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +245 -51
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/types.d.ts +8 -0
- package/dist/plus/git-github/api/types.d.ts.map +1 -1
- package/dist/plus/git-github/models.d.ts +1 -1
- package/dist/plus/git-github/models.d.ts.map +1 -1
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/blame.js.map +1 -1
- package/dist/plus/git-github/providers/github/branches.d.ts +5 -1
- package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/branches.js +47 -24
- package/dist/plus/git-github/providers/github/branches.js.map +1 -1
- package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/commits.js +144 -92
- package/dist/plus/git-github/providers/github/commits.js.map +1 -1
- package/dist/plus/git-github/providers/github/diff.d.ts +1 -1
- package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/diff.js +23 -9
- package/dist/plus/git-github/providers/github/diff.js.map +1 -1
- package/dist/plus/git-github/providers/github/refs.d.ts +9 -1
- package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/refs.js +39 -14
- package/dist/plus/git-github/providers/github/refs.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/revision.js +1 -2
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts +4 -1
- package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/status.js +1 -1
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/tags.js +35 -36
- package/dist/plus/git-github/providers/github/tags.js.map +1 -1
- package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
- package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js.map +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +6 -0
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/debounce.js +1 -1
- package/dist/utils/decorators/serializable.d.ts.map +1 -1
- package/dist/utils/decorators/serializable.js.map +1 -1
- package/dist/utils/dedupedAsyncCache.d.ts +37 -0
- package/dist/utils/dedupedAsyncCache.d.ts.map +1 -0
- package/dist/utils/dedupedAsyncCache.js +68 -0
- package/dist/utils/dedupedAsyncCache.js.map +1 -0
- package/dist/utils/diff.d.ts +2 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +53 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/disposable.d.ts.map +1 -1
- package/dist/utils/disposable.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts.map +1 -1
- package/dist/utils/env/node/exec.js.map +1 -1
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/error.js.map +1 -1
- package/dist/utils/iterable.d.ts +7 -1
- package/dist/utils/iterable.d.ts.map +1 -1
- package/dist/utils/iterable.js +12 -4
- package/dist/utils/iterable.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/lruMap.d.ts +9 -0
- package/dist/utils/lruMap.d.ts.map +1 -1
- package/dist/utils/lruMap.js +26 -4
- package/dist/utils/lruMap.js.map +1 -1
- package/dist/utils/markdown.d.ts.map +1 -1
- package/dist/utils/markdown.js.map +1 -1
- package/dist/utils/mru.d.ts.map +1 -1
- package/dist/utils/mru.js.map +1 -1
- package/dist/utils/object.d.ts +22 -1
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/object.js +56 -3
- package/dist/utils/object.js.map +1 -1
- package/dist/utils/paging.js +14 -15
- package/dist/utils/paging.js.map +1 -1
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js.map +1 -1
- package/dist/utils/promise.d.ts +1 -0
- package/dist/utils/promise.d.ts.map +1 -1
- package/dist/utils/promise.js +17 -0
- package/dist/utils/promise.js.map +1 -1
- package/dist/utils/promiseCache.d.ts +10 -0
- package/dist/utils/promiseCache.d.ts.map +1 -1
- package/dist/utils/promiseCache.js +34 -4
- package/dist/utils/promiseCache.js.map +1 -1
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +1 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/utils/uri.d.ts.map +1 -1
- package/dist/utils/uri.js.map +1 -1
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js.map +1 -1
- package/package.json +13 -1
- package/src/git/cache.ts +192 -90
- package/src/git/context.ts +21 -0
- package/src/git/features.ts +2 -0
- package/src/git/models/commit.ts +1 -0
- package/src/git/models/graph.ts +97 -0
- package/src/git/models/reference.ts +33 -0
- package/src/git/models/remote.ts +1 -0
- package/src/git/models/remoteProvider.ts +1 -0
- package/src/git/models/repository.ts +105 -96
- package/src/git/models/search.ts +2 -2
- package/src/git/models/statusFile.ts +12 -0
- package/src/git/models/worktree.ts +10 -2
- package/src/git/parsers/diffParser.ts +2 -0
- package/src/git/providers/branches.ts +22 -4
- package/src/git/providers/commits.ts +4 -0
- package/src/git/providers/config.ts +3 -5
- package/src/git/providers/operations.ts +65 -1
- package/src/git/providers/pausedOperations.ts +1 -0
- package/src/git/providers/refs.ts +32 -3
- package/src/git/providers/staging.ts +12 -0
- package/src/git/providers/status.ts +6 -1
- package/src/git/remotes/azure-devops.ts +2 -0
- package/src/git/remotes/custom.ts +23 -0
- package/src/git/{exec.types.ts → run.types.ts} +22 -2
- package/src/git/service.ts +1 -0
- package/src/git/utils/autolink.utils.ts +1 -0
- package/src/git/utils/blame.utils.ts +2 -0
- package/src/git/utils/conflictResolution.utils.ts +31 -0
- package/src/git/utils/contributor.utils.ts +24 -0
- package/src/git/utils/fileStatus.utils.ts +7 -1
- package/src/git/utils/reachability.utils.ts +109 -0
- package/src/git/utils/search.utils.ts +2 -0
- package/src/git/utils/sorting.ts +17 -0
- package/src/git/utils/status.utils.ts +1 -0
- package/src/git/watching/classifyChange.ts +9 -0
- package/src/git/watching/gitIgnoreFilter.ts +2 -2
- package/src/git/watching/initWatcher.ts +2 -0
- package/src/git/watching/watchGroup.ts +3 -0
- package/src/git/watching/watchService.ts +45 -7
- package/src/git/watching/watchSession.ts +71 -55
- package/src/git-cli/exec/exec.types.ts +2 -2
- package/src/git-cli/exec/git.ts +6 -5
- package/src/git-cli/exec/gitQueue.ts +41 -12
- package/src/git-cli/parsers/blameParser.ts +1 -0
- package/src/git-cli/parsers/logParser.ts +1 -0
- package/src/git-cli/parsers/refParser.ts +33 -34
- package/src/git-cli/providers/blame.ts +1 -0
- package/src/git-cli/providers/branches.ts +165 -93
- package/src/git-cli/providers/commits.ts +107 -37
- package/src/git-cli/providers/config.ts +101 -48
- package/src/git-cli/providers/diff.ts +10 -3
- package/src/git-cli/providers/graph.ts +156 -16
- package/src/git-cli/providers/operations.ts +208 -83
- package/src/git-cli/providers/patch.ts +1 -0
- package/src/git-cli/providers/pausedOperations.ts +8 -0
- package/src/git-cli/providers/refs.ts +247 -3
- package/src/git-cli/providers/revision.ts +2 -2
- package/src/git-cli/providers/staging.ts +33 -0
- package/src/git-cli/providers/stash.ts +20 -2
- package/src/git-cli/providers/status.ts +24 -5
- package/src/git-cli/providers/tags.ts +15 -16
- package/src/ipc/discovery.ts +186 -0
- package/src/ipc/ipcServer.ts +171 -0
- package/src/plus/agents/providers/claudeCodeProvider.ts +2122 -0
- package/src/plus/agents/providers/claudeCodeTranscript.ts +214 -0
- package/src/plus/agents/sanitizePrompt.ts +109 -0
- package/src/plus/agents/stateMachine.ts +197 -0
- package/src/plus/agents/types.ts +325 -0
- package/src/plus/ai/errors.ts +40 -0
- package/src/plus/ai/models/model.ts +1 -0
- package/src/plus/ai/models/promptTemplates.ts +13 -0
- package/src/plus/ai/models/provider.ts +7 -1
- package/src/plus/ai/prompts.ts +49 -8
- package/src/plus/ai/providers/gitkrakenProvider.ts +4 -0
- package/src/plus/ai/providers/openAICompatibleProviderBase.ts +21 -4
- package/src/plus/ai/utils/ai.utils.ts +2 -0
- package/src/plus/ai/utils/results.utils.ts +2 -0
- package/src/plus/git-github/api/github.ts +315 -57
- package/src/plus/git-github/api/types.ts +15 -0
- package/src/plus/git-github/models.ts +1 -1
- package/src/plus/git-github/providers/github/blame.ts +2 -0
- package/src/plus/git-github/providers/github/branches.ts +61 -31
- package/src/plus/git-github/providers/github/commits.ts +231 -160
- package/src/plus/git-github/providers/github/diff.ts +27 -19
- package/src/plus/git-github/providers/github/refs.ts +58 -23
- package/src/plus/git-github/providers/github/revision.ts +1 -2
- package/src/plus/git-github/providers/github/status.ts +6 -1
- package/src/plus/git-github/providers/github/tags.ts +61 -62
- package/src/plus/git-github/providers/githubGitProvider.ts +1 -0
- package/src/utils/color.ts +2 -0
- package/src/utils/date.ts +5 -0
- package/src/utils/debounce.ts +1 -1
- package/src/utils/decorators/serializable.ts +1 -0
- package/src/utils/dedupedAsyncCache.ts +74 -0
- package/src/utils/diff.ts +61 -0
- package/src/utils/disposable.ts +2 -0
- package/src/utils/env/node/exec.ts +2 -0
- package/src/utils/error.ts +1 -0
- package/src/utils/iterable.ts +17 -3
- package/src/utils/logger.ts +1 -0
- package/src/utils/lruMap.ts +29 -4
- package/src/utils/markdown.ts +1 -0
- package/src/utils/mru.ts +2 -0
- package/src/utils/object.ts +55 -4
- package/src/utils/paging.ts +14 -14
- package/src/utils/path.ts +1 -0
- package/src/utils/promise.ts +22 -0
- package/src/utils/promiseCache.ts +48 -16
- package/src/utils/string.ts +3 -1
- package/src/utils/uri.ts +1 -0
- package/src/utils/version.ts +1 -0
- package/dist/git/exec.types.d.ts.map +0 -1
- package/dist/git/exec.types.js +0 -2
- package/dist/git/exec.types.js.map +0 -1
|
@@ -1,52 +1,51 @@
|
|
|
1
1
|
import type { FilteredGitFeatures } from '../../git/features.js';
|
|
2
|
+
import type { RefRecord } from '../../git/models/reference.js';
|
|
2
3
|
import { maybeStopWatch } from '../../utils/stopwatch.js';
|
|
3
4
|
import { iterateByDelimiter } from '../../utils/string.js';
|
|
4
5
|
import type { ExtractAll } from '../../utils/types.js';
|
|
5
6
|
import type { Parser } from './logParser.js';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Unified `for-each-ref` mapping covering branches, remotes, and tags in a single pass.
|
|
10
|
+
* Fields inapplicable to a given ref-type come back as empty strings from git.
|
|
11
|
+
*
|
|
12
|
+
* NOTE: When adding a new field that is gated on a git feature flag, mirror the entry in
|
|
13
|
+
* `refMappingSupportsWorktreePath` (and any future variants) — both maps MUST stay aligned
|
|
14
|
+
* so callers can switch parsers based on `git.supported('git:for-each-ref')` without losing
|
|
15
|
+
* field positions.
|
|
16
|
+
*/
|
|
17
|
+
const refMapping = {
|
|
18
|
+
current: `%(HEAD)`,
|
|
19
|
+
name: `%(refname)`,
|
|
20
|
+
objectname: `%(objectname)`,
|
|
21
|
+
peeledObjectname: `%(*objectname)`,
|
|
22
|
+
upstream: `%(upstream)`,
|
|
23
|
+
upstreamTracking: `%(upstream:track)`,
|
|
24
|
+
committerDate: `%(committerdate:iso8601)`,
|
|
25
|
+
creatorDate: `%(creatordate:iso8601)`,
|
|
26
|
+
authorDate: `%(authordate:iso8601)`,
|
|
27
|
+
subject: `%(subject)`,
|
|
14
28
|
worktreePath: undefined,
|
|
15
29
|
};
|
|
16
30
|
|
|
17
|
-
const
|
|
18
|
-
...
|
|
19
|
-
worktreePath: '%(worktreepath)',
|
|
31
|
+
const refMappingSupportsWorktreePath = {
|
|
32
|
+
...refMapping,
|
|
33
|
+
worktreePath: '%(worktreepath)',
|
|
20
34
|
};
|
|
21
35
|
|
|
22
|
-
type
|
|
36
|
+
type RefParser = Parser<RefRecord>;
|
|
23
37
|
|
|
24
|
-
let
|
|
25
|
-
let
|
|
26
|
-
|
|
38
|
+
let _refParser: RefParser | undefined;
|
|
39
|
+
let _refParserWithWorktree: RefParser | undefined;
|
|
40
|
+
|
|
41
|
+
export function getRefParser(supportedFeatures: FilteredGitFeatures<'git:for-each-ref'>[]): RefParser {
|
|
27
42
|
if (supportedFeatures.includes('git:for-each-ref:worktreePath')) {
|
|
28
|
-
|
|
29
|
-
return
|
|
43
|
+
_refParserWithWorktree ??= createRefParser(refMappingSupportsWorktreePath);
|
|
44
|
+
return _refParserWithWorktree;
|
|
30
45
|
}
|
|
31
|
-
_branchParser ??= createRefParser(branchMapping);
|
|
32
|
-
return _branchParser;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const tagMapping = {
|
|
36
|
-
name: `%(refname)`, // Full reference name
|
|
37
|
-
tagSha: `%(objectname)`, // sha of the tag
|
|
38
|
-
sha: `%(*objectname)`, // sha of the commit the tag points to, if any
|
|
39
|
-
date: `%(creatordate:iso8601)`, // date the tag was created
|
|
40
|
-
commitDate: `%(authordate:iso8601)`, // author date of the commit the tag points to
|
|
41
|
-
message: `%(subject)`, // message
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
type TagParser = Parser<typeof tagMapping>;
|
|
45
|
-
let _tagParser: TagParser | undefined;
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return _tagParser;
|
|
47
|
+
_refParser ??= createRefParser(refMapping);
|
|
48
|
+
return _refParser;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
const recordSep = '\x1E'; // ASCII Record Separator character
|
|
@@ -234,6 +234,7 @@ export class BlameGitSubProvider implements GitBlameSubProvider {
|
|
|
234
234
|
let blameLine = blame.lines[editorLine];
|
|
235
235
|
if (blameLine == null) {
|
|
236
236
|
if (blame.lines.length !== editorLine) return undefined;
|
|
237
|
+
|
|
237
238
|
blameLine = blame.lines[editorLine - 1];
|
|
238
239
|
}
|
|
239
240
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Cache, ConflictDetectionCacheKey } from '../../git/cache.js';
|
|
1
|
+
import type { Cache, ConflictDetectionCacheKey, GkConfigInvalidationTarget } from '../../git/cache.js';
|
|
2
2
|
import type { GitServiceContext } from '../../git/context.js';
|
|
3
3
|
import { BranchError } from '../../git/errors.js';
|
|
4
4
|
import type { BranchDisposition, BranchMetadata } from '../../git/models/branch.js';
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
GitBranchesSubProvider,
|
|
11
11
|
GitBranchMergedStatus,
|
|
12
12
|
} from '../../git/providers/branches.js';
|
|
13
|
+
import type { GitCommandPriority } from '../../git/run.types.js';
|
|
13
14
|
import {
|
|
14
15
|
formatDetachedHeadName,
|
|
15
16
|
getBranchId,
|
|
@@ -41,7 +42,6 @@ import type { GitResult } from '../exec/exec.types.js';
|
|
|
41
42
|
import type { Git } from '../exec/git.js';
|
|
42
43
|
import { getGitCommandError, gitConfigsBranch, gitConfigsLog, GitError, GitErrors, GitWarnings } from '../exec/git.js';
|
|
43
44
|
import { parseMergeTreeConflict } from '../parsers/mergeTreeParser.js';
|
|
44
|
-
import { getBranchParser } from '../parsers/refParser.js';
|
|
45
45
|
|
|
46
46
|
/** Minimum time between writes to the config for last accessed/modified dates */
|
|
47
47
|
const dateMetadataStaleThresholdMs = 5 * 60 * 1000; // 5 minutes
|
|
@@ -96,7 +96,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
96
96
|
const [pausedOpStatusResult, committerDateResult, defaultWorktreePathResult, metadataMapResult] =
|
|
97
97
|
await Promise.allSettled([
|
|
98
98
|
isDetachedHead(ref.name)
|
|
99
|
-
? this.provider.pausedOps?.getPausedOperationStatus(repoPath, cancellation)
|
|
99
|
+
? this.provider.pausedOps?.getPausedOperationStatus(repoPath, undefined, cancellation)
|
|
100
100
|
: undefined,
|
|
101
101
|
this.git
|
|
102
102
|
.run(
|
|
@@ -168,27 +168,22 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
168
168
|
// own cancellation when bypassing the cache (e.g. paging-cursor path).
|
|
169
169
|
signal ??= cancellation;
|
|
170
170
|
try {
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
),
|
|
182
|
-
this.provider.config.getDefaultWorktreePath?.(commonPath),
|
|
183
|
-
this.getBranchMetadataMap(commonPath),
|
|
184
|
-
]);
|
|
185
|
-
|
|
186
|
-
const result = getSettledValue(gitResult);
|
|
171
|
+
const [recordsResult, supportedResult, defaultWorktreePathResult, metadataMapResult] =
|
|
172
|
+
await Promise.allSettled([
|
|
173
|
+
this.provider.refs.getRefs(commonPath, signal),
|
|
174
|
+
this.git.supported('git:for-each-ref'),
|
|
175
|
+
this.provider.config.getDefaultWorktreePath?.(commonPath),
|
|
176
|
+
this.getBranchMetadataMap(commonPath),
|
|
177
|
+
]);
|
|
178
|
+
|
|
179
|
+
const records = getSettledValue(recordsResult) ?? [];
|
|
180
|
+
const supported = getSettledValue(supportedResult) ?? [];
|
|
187
181
|
const metadataMap = getSettledValue(metadataMapResult) ?? new Map<string, BranchMetadata>();
|
|
188
182
|
const defaultWorktreePath = getSettledValue(defaultWorktreePathResult);
|
|
183
|
+
const worktreePathSupported = supported.includes('git:for-each-ref:worktreePath');
|
|
189
184
|
|
|
190
185
|
// If we don't get any data, assume the repo doesn't have any commits yet so check if we have a current branch
|
|
191
|
-
if (!
|
|
186
|
+
if (!records.length) {
|
|
192
187
|
const current = await this.getCurrentBranch(
|
|
193
188
|
commonPath,
|
|
194
189
|
metadataMap,
|
|
@@ -202,25 +197,28 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
202
197
|
|
|
203
198
|
const branches: GitBranch[] = [];
|
|
204
199
|
|
|
205
|
-
for (const
|
|
200
|
+
for (const record of records) {
|
|
201
|
+
const fullName = record.name;
|
|
202
|
+
// Filter to branches and remote-tracking branches; skip tags from the unified records.
|
|
203
|
+
if (!fullName.startsWith('refs/heads/') && !fullName.startsWith('refs/remotes/')) continue;
|
|
206
204
|
// Skip HEAD refs in remote branches
|
|
207
|
-
if (isRemoteHEAD(
|
|
205
|
+
if (isRemoteHEAD(fullName)) continue;
|
|
208
206
|
|
|
209
|
-
const upstream = parseUpstream(
|
|
207
|
+
const upstream = parseUpstream(record.upstream, record.upstreamTracking);
|
|
210
208
|
|
|
211
|
-
const metadata = metadataMap.get(parseRefName(
|
|
212
|
-
const worktreePath =
|
|
209
|
+
const metadata = metadataMap.get(parseRefName(fullName).name);
|
|
210
|
+
const worktreePath = record.worktreePath ? normalizePath(record.worktreePath) : undefined;
|
|
213
211
|
|
|
214
212
|
branches.push(
|
|
215
213
|
new GitBranch(
|
|
216
214
|
commonPath,
|
|
217
|
-
|
|
215
|
+
fullName,
|
|
218
216
|
false, // Don't trust %(HEAD) for current as it's per-worktree -- we will set it later
|
|
219
|
-
|
|
217
|
+
record.committerDate ? new Date(record.committerDate) : undefined,
|
|
220
218
|
metadata,
|
|
221
|
-
|
|
219
|
+
record.objectname,
|
|
222
220
|
upstream,
|
|
223
|
-
|
|
221
|
+
worktreePathSupported
|
|
224
222
|
? worktreePath
|
|
225
223
|
? { path: worktreePath, isDefault: worktreePath === defaultWorktreePath }
|
|
226
224
|
: false
|
|
@@ -234,6 +232,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
234
232
|
// Pre-populate current branch cache for worktrees based on worktreePath info
|
|
235
233
|
// This eliminates the need for rev-parse calls during branch reconstruction
|
|
236
234
|
for (const branch of branches) {
|
|
235
|
+
// oxlint-disable-next-line typescript/prefer-optional-chain
|
|
237
236
|
if (branch.worktree && branch.worktree.path) {
|
|
238
237
|
const { name } = parseRefName(branch.refName);
|
|
239
238
|
const reference = createReference(name, branch.worktree.path, {
|
|
@@ -360,46 +359,23 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
360
359
|
async getBranchContributionsOverview(
|
|
361
360
|
repoPath: string,
|
|
362
361
|
ref: string,
|
|
363
|
-
options?: {
|
|
362
|
+
options?: {
|
|
363
|
+
associatedPullRequest?: Promise<{ refs?: { base?: { branch: string } } } | undefined>;
|
|
364
|
+
priority?: GitCommandPriority;
|
|
365
|
+
},
|
|
364
366
|
cancellation?: AbortSignal,
|
|
365
367
|
): Promise<BranchContributionsOverview | undefined> {
|
|
366
368
|
const scope = getScopedLogger();
|
|
369
|
+
const priority = options?.priority;
|
|
370
|
+
const priorityOpts = priority != null ? { priority: priority } : undefined;
|
|
367
371
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
372
|
+
// Expensive body — runs only on cache miss. Closes over `mergeTarget` so the cache key
|
|
373
|
+
// (`${ref}|${mergeTarget}`) fully captures every input that affects the result.
|
|
374
|
+
const fetchBody = async (
|
|
375
|
+
mergeTarget: string,
|
|
371
376
|
signal: AbortSignal | undefined,
|
|
372
|
-
storedTarget: string | undefined,
|
|
373
377
|
): Promise<BranchContributionsOverview | undefined> => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
// Tier 1: Stored merge target (user-set or previously detected from PR). Caller has
|
|
377
|
-
// already read this once for the cache decision; reuse rather than re-fetching.
|
|
378
|
-
if (storedTarget) {
|
|
379
|
-
const validated = await this.provider.refs.getSymbolicReferenceName(repoPath, storedTarget);
|
|
380
|
-
mergeTarget = validated || storedTarget;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// Tier 2: PR-based lookup. The branch object is only needed here (for `remoteName`),
|
|
384
|
-
// so lazy-load it on the cold path instead of paying for it on every call.
|
|
385
|
-
if (mergeTarget == null && options?.associatedPullRequest != null) {
|
|
386
|
-
const pr = await options.associatedPullRequest;
|
|
387
|
-
if (pr?.refs?.base != null) {
|
|
388
|
-
const branch = await this.getBranch(repoPath, ref, signal);
|
|
389
|
-
if (branch == null) return undefined;
|
|
390
|
-
mergeTarget = `${branch.remoteName}/${pr.refs.base.branch}`;
|
|
391
|
-
// Store for future reuse — turns the next call into a Tier 1 cache-eligible path.
|
|
392
|
-
void this.storeMergeTargetBranchName(repoPath, ref, mergeTarget);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// Tier 3: Base branch, then default branch
|
|
397
|
-
mergeTarget ??= await this.getBaseBranchName(repoPath, ref, signal);
|
|
398
|
-
mergeTarget ??= await this.getDefaultBranchName(repoPath, undefined, signal);
|
|
399
|
-
|
|
400
|
-
if (mergeTarget == null) return undefined;
|
|
401
|
-
|
|
402
|
-
const mergeBase = await this.provider.refs.getMergeBase(repoPath, ref, mergeTarget, undefined, signal);
|
|
378
|
+
const mergeBase = await this.provider.refs.getMergeBase(repoPath, ref, mergeTarget, priorityOpts, signal);
|
|
403
379
|
if (mergeBase == null) return undefined;
|
|
404
380
|
|
|
405
381
|
// Fetch the merge-base commit's dates in parallel with contributors so consumers
|
|
@@ -471,20 +447,61 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
471
447
|
};
|
|
472
448
|
|
|
473
449
|
try {
|
|
474
|
-
//
|
|
475
|
-
//
|
|
476
|
-
//
|
|
450
|
+
// Resolve `mergeTarget` through Tier 1 → Tier 2 → Tier 3. The pieces of each tier are
|
|
451
|
+
// already individually cached (`getStoredMergeTargetBranchName`, `getBaseBranchName`,
|
|
452
|
+
// `getDefaultBranchName`), so this resolution path is cheap on warm caches. Only the
|
|
453
|
+
// expensive body below (`getMergeBase` + `getContributors` w/ stats + `getCommitDates`)
|
|
454
|
+
// is wrapped by `cache.getBranchOverview`, keyed on the resolved `mergeTarget` so any
|
|
455
|
+
// caller that resolves to the same target shares; differing targets get independent
|
|
456
|
+
// slots, which is the correctness constraint that previously forced the Tier 2/3 paths
|
|
457
|
+
// to bypass the cache entirely.
|
|
458
|
+
let mergeTarget: string | undefined;
|
|
459
|
+
|
|
460
|
+
// Tier 1: Stored merge target (user-set or previously detected from PR).
|
|
477
461
|
const storedTarget = await this.getStoredMergeTargetBranchName(repoPath, ref);
|
|
478
|
-
if (storedTarget
|
|
479
|
-
|
|
462
|
+
if (storedTarget) {
|
|
463
|
+
const validated = await this.provider.refs.getSymbolicReferenceName(
|
|
480
464
|
repoPath,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
{ cancellation: cancellation },
|
|
465
|
+
storedTarget,
|
|
466
|
+
priorityOpts,
|
|
467
|
+
cancellation,
|
|
485
468
|
);
|
|
469
|
+
mergeTarget = validated || storedTarget;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Tier 2: PR-based lookup. The branch object is only needed here (for `remoteName`),
|
|
473
|
+
// so lazy-load it on the cold path instead of paying for it on every call.
|
|
474
|
+
if (mergeTarget == null && options?.associatedPullRequest != null) {
|
|
475
|
+
const pr = await options.associatedPullRequest;
|
|
476
|
+
if (pr?.refs?.base != null) {
|
|
477
|
+
const branch = await this.getBranch(repoPath, ref, cancellation);
|
|
478
|
+
if (branch == null) return undefined;
|
|
479
|
+
|
|
480
|
+
mergeTarget = `${branch.remoteName}/${pr.refs.base.branch}`;
|
|
481
|
+
// Store for future reuse — turns the next call into a Tier 1 path. Skip the
|
|
482
|
+
// `branchOverviews` invalidation that the write would otherwise trigger: we're
|
|
483
|
+
// about to populate `${ref}|${mergeTarget}` with this exact target, so evicting
|
|
484
|
+
// it would just force the next caller to redo the body. (gk-merge-target writes
|
|
485
|
+
// do not affect `baseBranchName`, so no need to skip that target.)
|
|
486
|
+
void this.storeMergeTargetBranchName(repoPath, ref, mergeTarget, {
|
|
487
|
+
skipInvalidation: ['branchOverviews'],
|
|
488
|
+
});
|
|
489
|
+
}
|
|
486
490
|
}
|
|
487
|
-
|
|
491
|
+
|
|
492
|
+
// Tier 3: Base branch, then default branch.
|
|
493
|
+
mergeTarget ??= await this.getBaseBranchName(repoPath, ref, priorityOpts, cancellation);
|
|
494
|
+
mergeTarget ??= await this.getDefaultBranchName(repoPath, undefined, priorityOpts, cancellation);
|
|
495
|
+
|
|
496
|
+
if (mergeTarget == null) return undefined;
|
|
497
|
+
|
|
498
|
+
const resolvedTarget = mergeTarget;
|
|
499
|
+
return await this.cache.getBranchOverview(
|
|
500
|
+
repoPath,
|
|
501
|
+
`${ref}|${resolvedTarget}`,
|
|
502
|
+
(_commonPath, _cacheable, signal) => fetchBody(resolvedTarget, signal ?? cancellation),
|
|
503
|
+
{ cancellation: cancellation },
|
|
504
|
+
);
|
|
488
505
|
} catch (ex) {
|
|
489
506
|
scope?.error(ex);
|
|
490
507
|
if (isCancellationError(ex)) throw ex;
|
|
@@ -624,7 +641,12 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
624
641
|
}
|
|
625
642
|
|
|
626
643
|
if (data == null) {
|
|
627
|
-
const symbolicRef = await this.getDefaultBranchName(
|
|
644
|
+
const symbolicRef = await this.getDefaultBranchName(
|
|
645
|
+
repoPath,
|
|
646
|
+
'origin',
|
|
647
|
+
undefined,
|
|
648
|
+
signal,
|
|
649
|
+
);
|
|
628
650
|
if (symbolicRef != null) {
|
|
629
651
|
data = [
|
|
630
652
|
symbolicRef.startsWith('origin/')
|
|
@@ -705,18 +727,21 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
705
727
|
async getDefaultBranchName(
|
|
706
728
|
repoPath: string | undefined,
|
|
707
729
|
remote?: string,
|
|
730
|
+
options?: { priority?: GitCommandPriority },
|
|
708
731
|
cancellation?: AbortSignal,
|
|
709
732
|
): Promise<string | undefined> {
|
|
710
733
|
if (repoPath == null) return undefined;
|
|
711
734
|
|
|
712
735
|
remote ??= 'origin';
|
|
736
|
+
const priority = options?.priority;
|
|
737
|
+
const priorityOpts = priority != null ? { priority: priority } : undefined;
|
|
713
738
|
|
|
714
739
|
return this.cache.getDefaultBranchName(repoPath, remote, async commonPath => {
|
|
715
740
|
let retried = false;
|
|
716
741
|
while (true) {
|
|
717
742
|
try {
|
|
718
743
|
const result = await this.git.run(
|
|
719
|
-
{ cwd: commonPath, cancellation: cancellation },
|
|
744
|
+
{ cwd: commonPath, cancellation: cancellation, ...priorityOpts },
|
|
720
745
|
'symbolic-ref',
|
|
721
746
|
'--short',
|
|
722
747
|
`refs/remotes/${remote}/HEAD`,
|
|
@@ -728,7 +753,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
728
753
|
if (!retried) {
|
|
729
754
|
retried = true;
|
|
730
755
|
await this.git.run(
|
|
731
|
-
{ cwd: commonPath, cancellation: cancellation },
|
|
756
|
+
{ cwd: commonPath, cancellation: cancellation, ...priorityOpts },
|
|
732
757
|
'remote',
|
|
733
758
|
'set-head',
|
|
734
759
|
'-a',
|
|
@@ -738,7 +763,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
738
763
|
}
|
|
739
764
|
|
|
740
765
|
const result = await this.git.run(
|
|
741
|
-
{ cwd: commonPath, cancellation: cancellation },
|
|
766
|
+
{ cwd: commonPath, cancellation: cancellation, ...priorityOpts },
|
|
742
767
|
'ls-remote',
|
|
743
768
|
'--symref',
|
|
744
769
|
remote,
|
|
@@ -1156,6 +1181,7 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
1156
1181
|
currentTreeOid = treeResult.stdout.trim();
|
|
1157
1182
|
} catch (ex) {
|
|
1158
1183
|
if (isCancellationError(ex)) throw ex;
|
|
1184
|
+
|
|
1159
1185
|
scope?.error(ex, `Failed to resolve target branch '${targetBranch}'`);
|
|
1160
1186
|
return createConflictDetectionError('refNotFound');
|
|
1161
1187
|
}
|
|
@@ -1263,7 +1289,15 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
1263
1289
|
}
|
|
1264
1290
|
|
|
1265
1291
|
@debug({ exit: true })
|
|
1266
|
-
getBaseBranchName(
|
|
1292
|
+
getBaseBranchName(
|
|
1293
|
+
repoPath: string,
|
|
1294
|
+
ref: string,
|
|
1295
|
+
options?: { priority?: GitCommandPriority },
|
|
1296
|
+
cancellation?: AbortSignal,
|
|
1297
|
+
): Promise<string | undefined> {
|
|
1298
|
+
const priority = options?.priority;
|
|
1299
|
+
const priorityOpts = priority != null ? { priority: priority } : undefined;
|
|
1300
|
+
|
|
1267
1301
|
return this.cache.getBaseBranchName(
|
|
1268
1302
|
repoPath,
|
|
1269
1303
|
ref,
|
|
@@ -1280,19 +1314,36 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
1280
1314
|
}
|
|
1281
1315
|
|
|
1282
1316
|
if (mergeBase != null) {
|
|
1283
|
-
const branch = await this.provider.refs.getSymbolicReferenceName(
|
|
1317
|
+
const branch = await this.provider.refs.getSymbolicReferenceName(
|
|
1318
|
+
commonPath,
|
|
1319
|
+
mergeBase,
|
|
1320
|
+
priorityOpts,
|
|
1321
|
+
);
|
|
1284
1322
|
if (branch != null) {
|
|
1285
1323
|
if (update) {
|
|
1286
|
-
|
|
1324
|
+
// Self-write: the value we're storing is exactly what this factory is
|
|
1325
|
+
// returning, so any in-flight `branchOverviews` or `baseBranchName` entry
|
|
1326
|
+
// being populated against this resolution should NOT be evicted.
|
|
1327
|
+
void this.storeBaseBranchName(commonPath, ref, branch, {
|
|
1328
|
+
skipInvalidation: ['branchOverviews', 'baseBranchName'],
|
|
1329
|
+
});
|
|
1287
1330
|
}
|
|
1288
1331
|
return branch;
|
|
1289
1332
|
}
|
|
1290
1333
|
}
|
|
1291
1334
|
} catch {}
|
|
1292
1335
|
|
|
1293
|
-
const branch = await this.getBaseBranchFromReflog(
|
|
1336
|
+
const branch = await this.getBaseBranchFromReflog(
|
|
1337
|
+
commonPath,
|
|
1338
|
+
ref,
|
|
1339
|
+
{ upstream: true, priority: priority },
|
|
1340
|
+
signal,
|
|
1341
|
+
);
|
|
1294
1342
|
if (branch != null) {
|
|
1295
|
-
|
|
1343
|
+
// Self-write: see comment on the migration path above.
|
|
1344
|
+
void this.storeBaseBranchName(commonPath, ref, branch, {
|
|
1345
|
+
skipInvalidation: ['branchOverviews', 'baseBranchName'],
|
|
1346
|
+
});
|
|
1296
1347
|
return branch;
|
|
1297
1348
|
}
|
|
1298
1349
|
|
|
@@ -1305,12 +1356,15 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
1305
1356
|
private async getBaseBranchFromReflog(
|
|
1306
1357
|
repoPath: string,
|
|
1307
1358
|
ref: string,
|
|
1308
|
-
options?: { upstream: true },
|
|
1359
|
+
options?: { upstream: true; priority?: GitCommandPriority },
|
|
1309
1360
|
cancellation?: AbortSignal,
|
|
1310
1361
|
): Promise<string | undefined> {
|
|
1362
|
+
const priority = options?.priority;
|
|
1363
|
+
const priorityOpts = priority != null ? { priority: priority } : undefined;
|
|
1364
|
+
|
|
1311
1365
|
try {
|
|
1312
1366
|
let result = await this.git.run(
|
|
1313
|
-
{ cwd: repoPath, cancellation: cancellation },
|
|
1367
|
+
{ cwd: repoPath, cancellation: cancellation, ...priorityOpts },
|
|
1314
1368
|
'reflog',
|
|
1315
1369
|
ref,
|
|
1316
1370
|
'--grep-reflog=branch: Created from *.',
|
|
@@ -1325,18 +1379,22 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
1325
1379
|
let name: string | undefined = match[1];
|
|
1326
1380
|
if (name !== 'HEAD') {
|
|
1327
1381
|
if (options?.upstream) {
|
|
1328
|
-
const upstream = await this.provider.refs.getSymbolicReferenceName(
|
|
1382
|
+
const upstream = await this.provider.refs.getSymbolicReferenceName(
|
|
1383
|
+
repoPath,
|
|
1384
|
+
`${name}@{u}`,
|
|
1385
|
+
priorityOpts,
|
|
1386
|
+
);
|
|
1329
1387
|
if (upstream) return upstream;
|
|
1330
1388
|
}
|
|
1331
1389
|
|
|
1332
|
-
name = await this.provider.refs.getSymbolicReferenceName(repoPath, name);
|
|
1390
|
+
name = await this.provider.refs.getSymbolicReferenceName(repoPath, name, priorityOpts);
|
|
1333
1391
|
if (name) return name;
|
|
1334
1392
|
}
|
|
1335
1393
|
}
|
|
1336
1394
|
|
|
1337
1395
|
// Check if branch was created from HEAD
|
|
1338
1396
|
result = await this.git.run(
|
|
1339
|
-
{ cwd: repoPath, cancellation: cancellation },
|
|
1397
|
+
{ cwd: repoPath, cancellation: cancellation, ...priorityOpts },
|
|
1340
1398
|
'reflog',
|
|
1341
1399
|
'HEAD',
|
|
1342
1400
|
`--grep-reflog=checkout: moving from .* to ${ref.replace('refs/heads/', '')}`,
|
|
@@ -1349,11 +1407,15 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
1349
1407
|
if (match?.length === 2) {
|
|
1350
1408
|
let name: string | undefined = match[1];
|
|
1351
1409
|
if (options?.upstream) {
|
|
1352
|
-
const upstream = await this.provider.refs.getSymbolicReferenceName(
|
|
1410
|
+
const upstream = await this.provider.refs.getSymbolicReferenceName(
|
|
1411
|
+
repoPath,
|
|
1412
|
+
`${name}@{u}`,
|
|
1413
|
+
priorityOpts,
|
|
1414
|
+
);
|
|
1353
1415
|
if (upstream) return upstream;
|
|
1354
1416
|
}
|
|
1355
1417
|
|
|
1356
|
-
name = await this.provider.refs.getSymbolicReferenceName(repoPath, name);
|
|
1418
|
+
name = await this.provider.refs.getSymbolicReferenceName(repoPath, name, priorityOpts);
|
|
1357
1419
|
if (name) return name;
|
|
1358
1420
|
}
|
|
1359
1421
|
} catch (ex) {
|
|
@@ -1469,13 +1531,23 @@ export class BranchesGitSubProvider implements GitBranchesSubProvider {
|
|
|
1469
1531
|
}
|
|
1470
1532
|
|
|
1471
1533
|
@debug()
|
|
1472
|
-
async storeBaseBranchName(
|
|
1473
|
-
|
|
1534
|
+
async storeBaseBranchName(
|
|
1535
|
+
repoPath: string,
|
|
1536
|
+
ref: string,
|
|
1537
|
+
base: string,
|
|
1538
|
+
options?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },
|
|
1539
|
+
): Promise<void> {
|
|
1540
|
+
await this.provider.config.setGkConfig(repoPath, `branch.${ref}.gk-merge-base`, base, options);
|
|
1474
1541
|
}
|
|
1475
1542
|
|
|
1476
1543
|
@debug()
|
|
1477
|
-
async storeMergeTargetBranchName(
|
|
1478
|
-
|
|
1544
|
+
async storeMergeTargetBranchName(
|
|
1545
|
+
repoPath: string,
|
|
1546
|
+
ref: string,
|
|
1547
|
+
target: string,
|
|
1548
|
+
options?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },
|
|
1549
|
+
): Promise<void> {
|
|
1550
|
+
await this.provider.config.setGkConfig(repoPath, `branch.${ref}.gk-merge-target`, target, options);
|
|
1479
1551
|
}
|
|
1480
1552
|
|
|
1481
1553
|
@debug()
|