@gitkraken/core-gitlens 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -1
- package/dist/git/cache.d.ts +28 -4
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +82 -18
- package/dist/git/cache.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/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/repository.d.ts +9 -1
- package/dist/git/models/repository.d.ts.map +1 -1
- package/dist/git/models/repository.js +19 -3
- 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/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/config.d.ts +4 -1
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/operations.d.ts +33 -10
- 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/{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/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/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.map +1 -1
- package/dist/git/watching/watchService.js +24 -4
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts.map +1 -1
- 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 +98 -68
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts.map +1 -1
- package/dist/git-cli/providers/commits.js +74 -30
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +11 -2
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js +27 -2
- 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 +4 -2
- 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 +7 -2
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +13 -11
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js +108 -38
- 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/status.d.ts +4 -1
- package/dist/git-cli/providers/status.d.ts.map +1 -1
- package/dist/git-cli/providers/status.js +4 -3
- 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 +27 -0
- package/dist/ipc/discovery.d.ts.map +1 -0
- package/dist/ipc/discovery.js +38 -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 +114 -0
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -0
- package/dist/plus/agents/providers/claudeCodeProvider.js +1480 -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 +203 -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/promptTemplates.d.ts +11 -2
- package/dist/plus/ai/models/promptTemplates.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/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 +10 -1
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +156 -49
- 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 +38 -13
- 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/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.map +1 -1
- 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/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 +22 -0
- package/dist/utils/promiseCache.js.map +1 -1
- package/dist/utils/string.d.ts.map +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 +142 -28
- package/src/git/models/commit.ts +1 -0
- package/src/git/models/reference.ts +33 -0
- package/src/git/models/remote.ts +1 -0
- package/src/git/models/repository.ts +21 -3
- package/src/git/models/search.ts +2 -2
- 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/config.ts +2 -0
- package/src/git/providers/operations.ts +44 -0
- 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/{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/fileStatus.utils.ts +7 -1
- 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 +38 -5
- package/src/git/watching/watchSession.ts +10 -0
- 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 +164 -93
- package/src/git-cli/providers/commits.ts +83 -37
- package/src/git-cli/providers/config.ts +41 -2
- package/src/git-cli/providers/diff.ts +8 -2
- package/src/git-cli/providers/graph.ts +11 -2
- package/src/git-cli/providers/operations.ts +186 -49
- 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/status.ts +15 -4
- package/src/git-cli/providers/tags.ts +15 -16
- package/src/ipc/discovery.ts +56 -0
- package/src/ipc/ipcServer.ts +171 -0
- package/src/plus/agents/providers/claudeCodeProvider.ts +1782 -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 +277 -0
- package/src/plus/ai/errors.ts +40 -0
- package/src/plus/ai/models/promptTemplates.ts +13 -0
- package/src/plus/ai/prompts.ts +49 -8
- package/src/plus/ai/utils/results.utils.ts +2 -0
- package/src/plus/git-github/api/github.ts +199 -53
- 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 +57 -22
- 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/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 +3 -0
- 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/path.ts +1 -0
- package/src/utils/promise.ts +22 -0
- package/src/utils/promiseCache.ts +24 -0
- package/src/utils/string.ts +2 -0
- 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
package/src/git/models/search.ts
CHANGED
|
@@ -96,8 +96,8 @@ export interface ParsedSearchQuery {
|
|
|
96
96
|
export interface SearchQueryFilters {
|
|
97
97
|
/** Specifies whether the search results will be filtered to specific files */
|
|
98
98
|
files: boolean;
|
|
99
|
-
/** Specifies whether the search results will be filtered to a specific type, only `stash` and `
|
|
100
|
-
type?: 'stash' | 'tip';
|
|
99
|
+
/** Specifies whether the search results will be filtered to a specific type, only `stash`, `tip`, and `wip` are supported */
|
|
100
|
+
type?: 'stash' | 'tip' | 'wip';
|
|
101
101
|
/** Specifies whether the search results will be filtered to a specific ref or ref range */
|
|
102
102
|
refs: boolean;
|
|
103
103
|
}
|
|
@@ -6,6 +6,7 @@ import { basename, normalizePath, relative } from '../../utils/path.js';
|
|
|
6
6
|
import type { Shape } from '../../utils/types.js';
|
|
7
7
|
import type { Uri } from '../../utils/uri.js';
|
|
8
8
|
import { getRepositoryService } from '../repositoryService.js';
|
|
9
|
+
import type { GitCommandPriority } from '../run.types.js';
|
|
9
10
|
import { getRepositoryOrWorktreePath } from '../utils/repository.utils.js';
|
|
10
11
|
import { shortenRevision } from '../utils/revision.utils.js';
|
|
11
12
|
import type { GitBranch } from './branch.js';
|
|
@@ -73,6 +74,7 @@ export class GitWorktree {
|
|
|
73
74
|
const relativePath = normalizePath(relative(this.workspaceFolder.uri.fsPath, this.uri.fsPath));
|
|
74
75
|
return relativePath || this.workspaceFolder.name;
|
|
75
76
|
}
|
|
77
|
+
|
|
76
78
|
const relativePath = normalizePath(relative(this.repoPath, this.uri.fsPath));
|
|
77
79
|
return relativePath || normalizePath(this.uri.fsPath);
|
|
78
80
|
}
|
|
@@ -135,10 +137,15 @@ export class GitWorktree {
|
|
|
135
137
|
: GitWorktree.formatDateFromNow(worktree);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
static async getStatus(
|
|
140
|
+
static async getStatus(
|
|
141
|
+
worktree: GitWorktree,
|
|
142
|
+
options?: { priority?: GitCommandPriority },
|
|
143
|
+
cancellation?: AbortSignal,
|
|
144
|
+
): Promise<GitStatus | undefined> {
|
|
139
145
|
if (worktree.type === 'bare') return undefined;
|
|
146
|
+
|
|
140
147
|
const repo = getRepositoryService(worktree.path);
|
|
141
|
-
return repo?.status.getStatus(cancellation);
|
|
148
|
+
return repo?.status.getStatus(options, cancellation);
|
|
142
149
|
}
|
|
143
150
|
|
|
144
151
|
static async hasWorkingChanges(
|
|
@@ -146,6 +153,7 @@ export class GitWorktree {
|
|
|
146
153
|
options?: { staged?: boolean; unstaged?: boolean; untracked?: boolean },
|
|
147
154
|
): Promise<boolean | undefined> {
|
|
148
155
|
if (worktree.type === 'bare') return undefined;
|
|
156
|
+
|
|
149
157
|
const repo = getRepositoryService(worktree.path);
|
|
150
158
|
return repo?.status.hasWorkingChanges(options);
|
|
151
159
|
}
|
|
@@ -413,6 +413,7 @@ export function parseGitDiffNumStatFiles(data: string, repoPath: string): GitFil
|
|
|
413
413
|
i++;
|
|
414
414
|
continue;
|
|
415
415
|
}
|
|
416
|
+
|
|
416
417
|
const tabIndex2 = field.indexOf('\t', tabIndex1 + 1);
|
|
417
418
|
if (tabIndex2 === -1) {
|
|
418
419
|
i++;
|
|
@@ -427,6 +428,7 @@ export function parseGitDiffNumStatFiles(data: string, repoPath: string): GitFil
|
|
|
427
428
|
if (path === '') {
|
|
428
429
|
// Rename or copy: next two fields are oldPath and newPath (summary pass distinguishes R vs C)
|
|
429
430
|
if (i + 2 >= fields.length) break;
|
|
431
|
+
|
|
430
432
|
originalPath = fields[++i];
|
|
431
433
|
path = fields[++i];
|
|
432
434
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { PagedResult, PagingOptions } from '../../utils/paging.js';
|
|
2
|
+
import type { GkConfigInvalidationTarget } from '../cache.js';
|
|
2
3
|
import type { BranchDisposition, GitBranch } from '../models/branch.js';
|
|
3
4
|
import type { GitCommitStats } from '../models/commit.js';
|
|
4
5
|
import type { GitContributor } from '../models/contributor.js';
|
|
5
6
|
import type { ConflictDetectionResult } from '../models/mergeConflicts.js';
|
|
6
7
|
import type { PullRequest } from '../models/pullRequest.js';
|
|
7
8
|
import type { GitBranchReference } from '../models/reference.js';
|
|
9
|
+
import type { GitCommandPriority } from '../run.types.js';
|
|
8
10
|
import type { BranchSortOptions } from '../utils/sorting.js';
|
|
9
11
|
|
|
10
12
|
export interface BranchContributionsOverview extends GitCommitStats<number> {
|
|
@@ -43,7 +45,7 @@ export interface GitBranchesSubProvider {
|
|
|
43
45
|
getBranchContributionsOverview(
|
|
44
46
|
repoPath: string,
|
|
45
47
|
ref: string,
|
|
46
|
-
options?: { associatedPullRequest?: Promise<PullRequest | undefined
|
|
48
|
+
options?: { associatedPullRequest?: Promise<PullRequest | undefined>; priority?: GitCommandPriority },
|
|
47
49
|
cancellation?: AbortSignal,
|
|
48
50
|
): Promise<BranchContributionsOverview | undefined>;
|
|
49
51
|
getBranchesWithCommits(
|
|
@@ -58,6 +60,7 @@ export interface GitBranchesSubProvider {
|
|
|
58
60
|
getDefaultBranchName(
|
|
59
61
|
repoPath: string | undefined,
|
|
60
62
|
remote?: string,
|
|
63
|
+
options?: { priority?: GitCommandPriority },
|
|
61
64
|
cancellation?: AbortSignal,
|
|
62
65
|
): Promise<string | undefined>;
|
|
63
66
|
|
|
@@ -94,7 +97,12 @@ export interface GitBranchesSubProvider {
|
|
|
94
97
|
targetBranch: string,
|
|
95
98
|
cancellation?: AbortSignal,
|
|
96
99
|
): Promise<ConflictDetectionResult>;
|
|
97
|
-
getBaseBranchName?(
|
|
100
|
+
getBaseBranchName?(
|
|
101
|
+
repoPath: string,
|
|
102
|
+
ref: string,
|
|
103
|
+
options?: { priority?: GitCommandPriority },
|
|
104
|
+
cancellation?: AbortSignal,
|
|
105
|
+
): Promise<string | undefined>;
|
|
98
106
|
getStoredMergeTargetBranchName?(repoPath: string, ref: string): Promise<string | undefined>;
|
|
99
107
|
getStoredDetectedMergeTargetBranchName?(repoPath: string, ref: string): Promise<string | undefined>;
|
|
100
108
|
getStoredUserMergeTargetBranchName?(repoPath: string, ref: string): Promise<string | undefined>;
|
|
@@ -108,7 +116,17 @@ export interface GitBranchesSubProvider {
|
|
|
108
116
|
branchName: string,
|
|
109
117
|
disposition: BranchDisposition | undefined,
|
|
110
118
|
): Promise<void>;
|
|
111
|
-
storeBaseBranchName?(
|
|
112
|
-
|
|
119
|
+
storeBaseBranchName?(
|
|
120
|
+
repoPath: string,
|
|
121
|
+
ref: string,
|
|
122
|
+
base: string,
|
|
123
|
+
options?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },
|
|
124
|
+
): Promise<void>;
|
|
125
|
+
storeMergeTargetBranchName?(
|
|
126
|
+
repoPath: string,
|
|
127
|
+
ref: string,
|
|
128
|
+
target: string,
|
|
129
|
+
options?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },
|
|
130
|
+
): Promise<void>;
|
|
113
131
|
storeUserMergeTargetBranchName?(repoPath: string, ref: string, target: string | undefined): Promise<void>;
|
|
114
132
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GkConfigInvalidationTarget } from '../cache.js';
|
|
1
2
|
import type { GitDir } from '../models/repository.js';
|
|
2
3
|
import type { SigningConfig, ValidationResult } from '../models/signature.js';
|
|
3
4
|
import type { GitUser } from '../models/user.js';
|
|
@@ -97,6 +98,7 @@ export interface GitConfigSubProvider {
|
|
|
97
98
|
repoPath: string,
|
|
98
99
|
key: GkConfigKeys | DeprecatedGkConfigKeys,
|
|
99
100
|
value: string | undefined,
|
|
101
|
+
options?: { skipInvalidation?: readonly GkConfigInvalidationTarget[] },
|
|
100
102
|
): Promise<void>;
|
|
101
103
|
|
|
102
104
|
getSigningConfig?(repoPath: string): Promise<SigningConfig>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GitBranchReference, GitReference } from '../models/reference.js';
|
|
2
2
|
import type { GitConflictFile } from '../models/staging.js';
|
|
3
|
+
import type { GitRunOptions } from '../run.types.js';
|
|
3
4
|
|
|
4
5
|
export interface GitOperationResult {
|
|
5
6
|
readonly conflicted: boolean;
|
|
@@ -7,16 +8,51 @@ export interface GitOperationResult {
|
|
|
7
8
|
readonly conflicts?: GitConflictFile[];
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Spawn-layer overrides callers can pass to user-initiated git operations to inject per-call
|
|
13
|
+
* environment variables, an `AbortSignal` for cancellation, or a custom `timeout`. Forwarded
|
|
14
|
+
* verbatim to the underlying `git.run(...)` invocation; cannot override op-owned fields like
|
|
15
|
+
* `cwd`, `configs`, `errors`, or `stdin`.
|
|
16
|
+
*
|
|
17
|
+
* Note: passing `timeout` overrides per-op safety defaults. `merge`, `rebase`, and `revert`
|
|
18
|
+
* intentionally disable the timeout (set it to 0) because those operations can take a long
|
|
19
|
+
* time; a caller-supplied `timeout` will replace that "no timeout" setting, so use with care.
|
|
20
|
+
*/
|
|
21
|
+
export type GitOperationRunOptions = Pick<GitRunOptions, 'env' | 'cancellation' | 'timeout'>;
|
|
22
|
+
|
|
10
23
|
export interface GitOperationsSubProvider {
|
|
11
24
|
checkout(
|
|
12
25
|
repoPath: string,
|
|
13
26
|
ref: string,
|
|
14
27
|
options?: { createBranch?: string | undefined } | { path?: string | undefined },
|
|
28
|
+
runOptions?: GitOperationRunOptions,
|
|
29
|
+
): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Checks out one side of a conflicted path during a paused merge/rebase/cherry-pick.
|
|
32
|
+
* Executes `git checkout --ours|--theirs -- <path>`, leaving the file unstaged.
|
|
33
|
+
*/
|
|
34
|
+
checkoutConflictedPath(
|
|
35
|
+
repoPath: string,
|
|
36
|
+
path: string,
|
|
37
|
+
side: 'ours' | 'theirs',
|
|
38
|
+
runOptions?: GitOperationRunOptions,
|
|
39
|
+
): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Checks out one side for multiple conflicted paths during a paused merge/rebase/cherry-pick.
|
|
42
|
+
* Batches paths into `git checkout --ours|--theirs -- <paths...>`, chunked to stay under the
|
|
43
|
+
* CLI length limit. Leaves files unstaged.
|
|
44
|
+
*/
|
|
45
|
+
checkoutConflictedPaths(
|
|
46
|
+
repoPath: string,
|
|
47
|
+
paths: string[],
|
|
48
|
+
side: 'ours' | 'theirs',
|
|
49
|
+
runOptions?: GitOperationRunOptions,
|
|
15
50
|
): Promise<void>;
|
|
16
51
|
cherryPick(
|
|
17
52
|
repoPath: string,
|
|
18
53
|
revs: string[],
|
|
19
54
|
options?: { edit?: boolean; noCommit?: boolean; source?: unknown },
|
|
55
|
+
runOptions?: GitOperationRunOptions,
|
|
20
56
|
): Promise<GitOperationResult>;
|
|
21
57
|
commit(
|
|
22
58
|
repoPath: string,
|
|
@@ -30,6 +66,7 @@ export interface GitOperationsSubProvider {
|
|
|
30
66
|
signoff?: boolean;
|
|
31
67
|
source?: unknown;
|
|
32
68
|
},
|
|
69
|
+
runOptions?: GitOperationRunOptions,
|
|
33
70
|
): Promise<void>;
|
|
34
71
|
fetch(
|
|
35
72
|
repoPath: string,
|
|
@@ -40,11 +77,13 @@ export interface GitOperationsSubProvider {
|
|
|
40
77
|
pull?: boolean | undefined;
|
|
41
78
|
remote?: string | undefined;
|
|
42
79
|
},
|
|
80
|
+
runOptions?: GitOperationRunOptions,
|
|
43
81
|
): Promise<void>;
|
|
44
82
|
merge(
|
|
45
83
|
repoPath: string,
|
|
46
84
|
ref: string,
|
|
47
85
|
options?: { fastForward?: boolean | 'only'; noCommit?: boolean; squash?: boolean; source?: unknown },
|
|
86
|
+
runOptions?: GitOperationRunOptions,
|
|
48
87
|
): Promise<GitOperationResult>;
|
|
49
88
|
pull(
|
|
50
89
|
repoPath: string,
|
|
@@ -54,6 +93,7 @@ export interface GitOperationsSubProvider {
|
|
|
54
93
|
tags?: boolean | undefined;
|
|
55
94
|
source?: unknown;
|
|
56
95
|
},
|
|
96
|
+
runOptions?: GitOperationRunOptions,
|
|
57
97
|
): Promise<void>;
|
|
58
98
|
push(
|
|
59
99
|
repoPath: string,
|
|
@@ -62,6 +102,7 @@ export interface GitOperationsSubProvider {
|
|
|
62
102
|
force?: boolean | undefined;
|
|
63
103
|
publish?: { remote: string };
|
|
64
104
|
},
|
|
105
|
+
runOptions?: GitOperationRunOptions,
|
|
65
106
|
): Promise<void>;
|
|
66
107
|
rebase(
|
|
67
108
|
repoPath: string,
|
|
@@ -75,15 +116,18 @@ export interface GitOperationsSubProvider {
|
|
|
75
116
|
updateRefs?: boolean;
|
|
76
117
|
source?: unknown;
|
|
77
118
|
},
|
|
119
|
+
runOptions?: GitOperationRunOptions,
|
|
78
120
|
): Promise<GitOperationResult>;
|
|
79
121
|
reset(
|
|
80
122
|
repoPath: string,
|
|
81
123
|
rev: string,
|
|
82
124
|
options?: { mode?: 'hard' | 'keep' | 'merge' | 'mixed' | 'soft' },
|
|
125
|
+
runOptions?: GitOperationRunOptions,
|
|
83
126
|
): Promise<void>;
|
|
84
127
|
revert(
|
|
85
128
|
repoPath: string,
|
|
86
129
|
refs: string[],
|
|
87
130
|
options?: { editMessage?: boolean; source?: unknown },
|
|
131
|
+
runOptions?: GitOperationRunOptions,
|
|
88
132
|
): Promise<GitOperationResult>;
|
|
89
133
|
}
|
|
@@ -3,6 +3,7 @@ import type { GitPausedOperationStatus } from '../models/pausedOperationStatus.j
|
|
|
3
3
|
export interface GitPausedOperationsSubProvider {
|
|
4
4
|
getPausedOperationStatus(
|
|
5
5
|
repoPath: string,
|
|
6
|
+
options?: { force?: boolean },
|
|
6
7
|
cancellation?: AbortSignal,
|
|
7
8
|
): Promise<GitPausedOperationStatus | undefined>;
|
|
8
9
|
abortPausedOperation(repoPath: string, options?: { quit?: boolean }): Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Uri } from '../../utils/uri.js';
|
|
2
2
|
import type { GitBranch } from '../models/branch.js';
|
|
3
|
-
import type { GitReference } from '../models/reference.js';
|
|
3
|
+
import type { GitReference, GitRefTip } from '../models/reference.js';
|
|
4
4
|
import type { GitTag } from '../models/tag.js';
|
|
5
|
+
import type { GitCommandPriority } from '../run.types.js';
|
|
5
6
|
|
|
6
7
|
export interface GitRefsSubProvider {
|
|
7
8
|
checkIfCouldBeValidBranchOrTagName(repoPath: string, ref: string): Promise<boolean>;
|
|
@@ -9,11 +10,39 @@ export interface GitRefsSubProvider {
|
|
|
9
10
|
repoPath: string,
|
|
10
11
|
ref1: string,
|
|
11
12
|
ref2: string,
|
|
12
|
-
options?: { forkPoint?: boolean | undefined },
|
|
13
|
+
options?: { forkPoint?: boolean | undefined; priority?: GitCommandPriority },
|
|
13
14
|
cancellation?: AbortSignal,
|
|
14
15
|
): Promise<string | undefined>;
|
|
15
16
|
getReference(repoPath: string, ref: string, cancellation?: AbortSignal): Promise<GitReference | undefined>;
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Lightweight enumeration of ref tips (heads/remotes/tags) — no enrichment.
|
|
19
|
+
* Use this when you need a SHA-to-refs map; use `getBranches`/`getTags` for full models.
|
|
20
|
+
*/
|
|
21
|
+
getRefTips(
|
|
22
|
+
repoPath: string,
|
|
23
|
+
options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },
|
|
24
|
+
cancellation?: AbortSignal,
|
|
25
|
+
): Promise<GitRefTip[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Batch reachability — for each input SHA, the refs whose tips contain it.
|
|
28
|
+
*
|
|
29
|
+
* One bounded `git rev-list --topo-order --parents --all ^<oldestSha>^@` walk; ref-set
|
|
30
|
+
* propagation runs in memory. Cost is O(walked subgraph), not O(N × refs) like the per-sha
|
|
31
|
+
* `getBranchesWithCommits([sha])` pattern. Pass the oldest SHA in your dataset to bound the walk.
|
|
32
|
+
*/
|
|
33
|
+
getRefsContainingShas(
|
|
34
|
+
repoPath: string,
|
|
35
|
+
shas: ReadonlySet<string> | readonly string[],
|
|
36
|
+
oldestSha: string,
|
|
37
|
+
options?: { include?: ReadonlyArray<'heads' | 'remotes' | 'tags'> },
|
|
38
|
+
cancellation?: AbortSignal,
|
|
39
|
+
): Promise<Map<string, GitRefTip[]>>;
|
|
40
|
+
getSymbolicReferenceName?(
|
|
41
|
+
repoPath: string,
|
|
42
|
+
ref: string,
|
|
43
|
+
options?: { priority?: GitCommandPriority },
|
|
44
|
+
cancellation?: AbortSignal,
|
|
45
|
+
): Promise<string | undefined>;
|
|
17
46
|
hasBranchOrTag(
|
|
18
47
|
repoPath: string | undefined,
|
|
19
48
|
options?: {
|
|
@@ -19,6 +19,18 @@ export interface GitStagingSubProvider {
|
|
|
19
19
|
unstageFile(repoPath: string, pathOrUri: string | Uri): Promise<void>;
|
|
20
20
|
unstageFiles(repoPath: string, pathsOrUris: (string | Uri)[]): Promise<void>;
|
|
21
21
|
unstageDirectory(repoPath: string, directoryOrUri: string | Uri): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Removes a file from both the working tree and the index in a single operation
|
|
24
|
+
* (`git rm [-f] -- <path>`). Use during conflict resolution when the user has chosen a
|
|
25
|
+
* side that is itself a deletion — atomic, so it can't leave a working-tree-modified
|
|
26
|
+
* file accidentally staged with content. Pass `force: true` to discard local
|
|
27
|
+
* modifications (required for conflicted files).
|
|
28
|
+
*/
|
|
29
|
+
removeFile(repoPath: string, pathOrUri: string | Uri, options?: { force?: boolean }): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Batched form of {@link removeFile}. Chunks paths to stay under the CLI length limit.
|
|
32
|
+
*/
|
|
33
|
+
removeFiles(repoPath: string, pathsOrUris: (string | Uri)[], options?: { force?: boolean }): Promise<void>;
|
|
22
34
|
stageAll(repoPath: string): Promise<void>;
|
|
23
35
|
unstageAll(repoPath: string): Promise<void>;
|
|
24
36
|
}
|
|
@@ -3,6 +3,7 @@ import type { GitFile } from '../models/file.js';
|
|
|
3
3
|
import type { GitConflictFile } from '../models/staging.js';
|
|
4
4
|
import type { GitStatus } from '../models/status.js';
|
|
5
5
|
import type { GitStatusFile } from '../models/statusFile.js';
|
|
6
|
+
import type { GitCommandPriority } from '../run.types.js';
|
|
6
7
|
|
|
7
8
|
export interface GitWorkingChangesState {
|
|
8
9
|
staged: boolean;
|
|
@@ -11,7 +12,11 @@ export interface GitWorkingChangesState {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export interface GitStatusSubProvider {
|
|
14
|
-
getStatus(
|
|
15
|
+
getStatus(
|
|
16
|
+
repoPath: string | undefined,
|
|
17
|
+
options?: { priority?: GitCommandPriority },
|
|
18
|
+
cancellation?: AbortSignal,
|
|
19
|
+
): Promise<GitStatus | undefined>;
|
|
15
20
|
getStatusForFile?(
|
|
16
21
|
repoPath: string,
|
|
17
22
|
pathOrUri: string | Uri,
|
|
@@ -34,6 +34,7 @@ function parseVstsHttpsUrl(url: URL): [string, string, string] {
|
|
|
34
34
|
const owner = getVSTSOwner(url);
|
|
35
35
|
const match = azureProjectRepoRegex.exec(url.pathname);
|
|
36
36
|
if (match == null) throw new Error(`Invalid VSTS URL: ${url.toString()}`);
|
|
37
|
+
|
|
37
38
|
const [, project, repo] = match;
|
|
38
39
|
return [owner, project, repo];
|
|
39
40
|
}
|
|
@@ -43,6 +44,7 @@ const azureHttpsUrlRegex2 = /([^/]+)\/([^/]+)\/_git\/([^/]+)/;
|
|
|
43
44
|
function parseAzureNewStyleUrl(url: URL): [string, string, string] {
|
|
44
45
|
const match = azureHttpsUrlRegex2.exec(url.pathname);
|
|
45
46
|
if (match == null) throw new Error(`Invalid Azure URL: ${url.toString()}`);
|
|
47
|
+
|
|
46
48
|
const [, owner, project, repo] = match;
|
|
47
49
|
return [owner, project, repo];
|
|
48
50
|
}
|
|
@@ -27,11 +27,11 @@ export interface GitResultCache {
|
|
|
27
27
|
* Priority levels for git commands.
|
|
28
28
|
* - `interactive`: User-initiated operations (blame, hover) - highest priority
|
|
29
29
|
* - `normal`: Standard operations (status, config) - default priority
|
|
30
|
-
* - `background`: Expensive operations (
|
|
30
|
+
* - `background`: Expensive operations (graph rendering, full history walks) - can be throttled
|
|
31
31
|
*/
|
|
32
32
|
export type GitCommandPriority = 'interactive' | 'normal' | 'background';
|
|
33
33
|
|
|
34
|
-
export interface
|
|
34
|
+
export interface GitRunOptions {
|
|
35
35
|
cancellation?: AbortSignal;
|
|
36
36
|
configs?: readonly string[];
|
|
37
37
|
readonly correlationKey?: string;
|
|
@@ -63,6 +63,26 @@ export interface GitExecOptions {
|
|
|
63
63
|
readonly timeout?: number;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Untyped escape hatch for raw `git <args>` invocation, returned by
|
|
68
|
+
* `GlGitProvider.createUnsafeGit`.
|
|
69
|
+
*
|
|
70
|
+
* "Unsafe" here means **bypasses the typed safety net** the rest of GitLens relies on
|
|
71
|
+
* — sub-provider cancellation/caching/decorator behaviors and signing-awareness do
|
|
72
|
+
* not apply when commands are issued through this object. It does NOT imply command
|
|
73
|
+
* injection risk; the caller still controls the args.
|
|
74
|
+
*
|
|
75
|
+
* Hand instances to libraries that need to issue arbitrary git commands
|
|
76
|
+
* (`@gitkraken/compose-tools`, `@gitkraken/shared-tools` undo). Inside GitLens
|
|
77
|
+
* itself, prefer the typed sub-providers on `RepositoryService` (`branches`,
|
|
78
|
+
* `commits`, `diff`, `staging`, `stash`, `status`, …). Holding an `UnsafeGit`
|
|
79
|
+
* just to call `run(...)` for an ad-hoc command is almost always wrong — the
|
|
80
|
+
* abstraction exists so it can be handed off, not used directly.
|
|
81
|
+
*/
|
|
82
|
+
export interface UnsafeGit {
|
|
83
|
+
run(args: readonly string[], options?: GitRunOptions): Promise<GitResult>;
|
|
84
|
+
}
|
|
85
|
+
|
|
66
86
|
export interface GitSpawnOptions {
|
|
67
87
|
cancellation?: AbortSignal;
|
|
68
88
|
configs?: readonly string[];
|
package/src/git/service.ts
CHANGED
|
@@ -77,6 +77,7 @@ export class GitService implements UnifiedDisposable {
|
|
|
77
77
|
if (GitService._instance != null) {
|
|
78
78
|
throw new Error('GitService already exists — only one instance is allowed');
|
|
79
79
|
}
|
|
80
|
+
|
|
80
81
|
const instance = new GitService(watchingProvider);
|
|
81
82
|
GitService._instance = instance;
|
|
82
83
|
return instance;
|
|
@@ -179,6 +179,7 @@ export function getBranchAutolinks(
|
|
|
179
179
|
for (const regex of ref.branchNameRegexes) {
|
|
180
180
|
match = branchName.match(regex);
|
|
181
181
|
if (!match?.groups) continue;
|
|
182
|
+
|
|
182
183
|
num = match.groups.issueKeyNumber;
|
|
183
184
|
const linkUrl = ref.url?.replace(numRegex, num);
|
|
184
185
|
autolinks.set(linkUrl, {
|
|
@@ -249,6 +249,7 @@ export function buildDirtyBlame(cleanBlame: GitBlame, mapping: LineMappingResult
|
|
|
249
249
|
const lineCountsBySha = new Map<string, number>();
|
|
250
250
|
for (const blameLine of dirtyBlameLines) {
|
|
251
251
|
if (blameLine == null) continue;
|
|
252
|
+
|
|
252
253
|
lineCountsBySha.set(blameLine.sha, (lineCountsBySha.get(blameLine.sha) ?? 0) + 1);
|
|
253
254
|
}
|
|
254
255
|
|
|
@@ -276,6 +277,7 @@ export function buildDirtyBlame(cleanBlame: GitBlame, mapping: LineMappingResult
|
|
|
276
277
|
for (const [, c] of commits) {
|
|
277
278
|
if (!c.author.name) continue;
|
|
278
279
|
if (authors.has(c.author.name)) continue;
|
|
280
|
+
|
|
279
281
|
authors.set(c.author.name, { name: c.author.name, lineCount: 0, current: c.author.current });
|
|
280
282
|
}
|
|
281
283
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { GitFileConflictStatus } from '../models/fileStatus.js';
|
|
2
|
+
|
|
3
|
+
export type ConflictResolutionAction = 'take-ours' | 'take-theirs' | 'delete' | 'unsupported';
|
|
4
|
+
|
|
5
|
+
export function classifyConflictAction(
|
|
6
|
+
status: GitFileConflictStatus,
|
|
7
|
+
resolution: 'current' | 'incoming',
|
|
8
|
+
): ConflictResolutionAction {
|
|
9
|
+
const takeCurrent = resolution === 'current';
|
|
10
|
+
|
|
11
|
+
if (status === 'DD') return 'delete';
|
|
12
|
+
if (status === 'UD' && !takeCurrent) return 'delete';
|
|
13
|
+
if (status === 'DU' && takeCurrent) return 'delete';
|
|
14
|
+
|
|
15
|
+
// `git checkout --{ours,theirs}` fails when the requested stage is absent.
|
|
16
|
+
// Single-file UI filters these out; bulk resolve surfaces them as failures.
|
|
17
|
+
if (status === 'UA' && takeCurrent) return 'unsupported';
|
|
18
|
+
if (status === 'AU' && !takeCurrent) return 'unsupported';
|
|
19
|
+
|
|
20
|
+
return takeCurrent ? 'take-ours' : 'take-theirs';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Stage Current is invalid when the current side has no content to take (added/deleted only by them, or both deleted)
|
|
24
|
+
export function canStageCurrent(status: GitFileConflictStatus): boolean {
|
|
25
|
+
return status !== 'UA' && status !== 'DD';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Stage Incoming is invalid when the incoming side has no content to take (added/deleted only by us, or both deleted)
|
|
29
|
+
export function canStageIncoming(status: GitFileConflictStatus): boolean {
|
|
30
|
+
return status !== 'AU' && status !== 'DD';
|
|
31
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GitFileStatus } from '../models/fileStatus.js';
|
|
1
|
+
import type { GitFileConflictStatus, GitFileStatus } from '../models/fileStatus.js';
|
|
2
2
|
|
|
3
3
|
const statusIconsMap = {
|
|
4
4
|
'.': undefined,
|
|
@@ -47,3 +47,9 @@ const statusTextMap = {
|
|
|
47
47
|
export function getGitFileStatusText(status: GitFileStatus | keyof typeof statusTextMap): string {
|
|
48
48
|
return statusTextMap[status] ?? 'Unknown';
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
const conflictStatuses = new Set<string>(['U', 'AA', 'AU', 'UA', 'DD', 'DU', 'UD', 'UU']);
|
|
52
|
+
|
|
53
|
+
export function isConflictStatus(status: string | undefined): status is 'U' | GitFileConflictStatus {
|
|
54
|
+
return status != null && conflictStatuses.has(status);
|
|
55
|
+
}
|
package/src/git/utils/sorting.ts
CHANGED
|
@@ -46,6 +46,23 @@ export function compareReachableRefs(
|
|
|
46
46
|
return 0;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
// Hoisted from `compareRefTips` so we don't re-allocate the lookup per sort iteration.
|
|
50
|
+
const refTipTypeOrder = { branch: 0, remote: 1, tag: 2 } as const;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Comparator for `GitRefTip` arrays — local branch < remote branch < tag, tags by version desc.
|
|
54
|
+
* Mirrors `compareReachableRefs` for the lighter ref-tip shape.
|
|
55
|
+
*/
|
|
56
|
+
export function compareRefTips(a: { type: 'branch' | 'remote' | 'tag'; name: string }, b: typeof a): number {
|
|
57
|
+
if (a.type !== b.type) {
|
|
58
|
+
return refTipTypeOrder[a.type] - refTipTypeOrder[b.type];
|
|
59
|
+
}
|
|
60
|
+
if (a.type === 'tag') {
|
|
61
|
+
return compareByVersionDescending(a.name, b.name);
|
|
62
|
+
}
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
49
66
|
export function sortBranches(branches: GitBranch[], options?: BranchSortOptions): GitBranch[] {
|
|
50
67
|
options = { current: true, groupByType: true, orderBy: 'date:desc', ...options };
|
|
51
68
|
|
|
@@ -17,6 +17,15 @@ const classifyRegex =
|
|
|
17
17
|
* handles it as a last-fetched timestamp).
|
|
18
18
|
*/
|
|
19
19
|
export function classifyGitDirChange(relativePath: string): RepositoryChange[] | undefined {
|
|
20
|
+
// User-edited todo file (and its backup) — handled by VS Code's TextDocument
|
|
21
|
+
// events in the rebase webview (see `rebaseWebviewProvider.ts`). Suppress here
|
|
22
|
+
// to avoid thrashing the repo update path on every save during an interactive
|
|
23
|
+
// rebase; rebase lifecycle (start/stop/step) still fires from sibling files
|
|
24
|
+
// in `rebase-merge/` and the directory itself.
|
|
25
|
+
if (relativePath.endsWith('/git-rebase-todo') || relativePath.endsWith('/git-rebase-todo.backup')) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
20
29
|
const match = classifyRegex.exec(relativePath);
|
|
21
30
|
if (match == null) return undefined;
|
|
22
31
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getScopedCounter } from '../../utils/counter.js';
|
|
2
|
-
import { fileUri } from '../../utils/uri.js';
|
|
3
1
|
import type { Ignore } from 'ignore';
|
|
4
2
|
import ignore from 'ignore';
|
|
3
|
+
import { getScopedCounter } from '../../utils/counter.js';
|
|
4
|
+
import { fileUri } from '../../utils/uri.js';
|
|
5
5
|
import type { FileSystemProvider } from '../context.js';
|
|
6
6
|
|
|
7
7
|
export interface GitIgnoreFilterOptions {
|
|
@@ -36,6 +36,7 @@ export class RepositoryInitWatcher implements UnifiedDisposable {
|
|
|
36
36
|
|
|
37
37
|
dispose(): void {
|
|
38
38
|
if (this._disposed) return;
|
|
39
|
+
|
|
39
40
|
this._disposed = true;
|
|
40
41
|
|
|
41
42
|
for (const watcher of this.watchers.values()) {
|
|
@@ -60,6 +61,7 @@ export class RepositoryInitWatcher implements UnifiedDisposable {
|
|
|
60
61
|
|
|
61
62
|
const watcher = this.provider.createWatcher(basePath, gitInitGlob, event => {
|
|
62
63
|
if (event.reason !== 'create') return;
|
|
64
|
+
|
|
63
65
|
this.emitter.fire({ path: event.path, basePath: basePath });
|
|
64
66
|
});
|
|
65
67
|
|
|
@@ -54,6 +54,7 @@ export class WatchGroup implements UnifiedDisposable {
|
|
|
54
54
|
/** Dispose the entire group (common watcher + all root watchers). */
|
|
55
55
|
dispose(): void {
|
|
56
56
|
if (this._disposed) return;
|
|
57
|
+
|
|
57
58
|
this._disposed = true;
|
|
58
59
|
|
|
59
60
|
for (const entry of this._sessions.values()) {
|
|
@@ -132,6 +133,7 @@ export class WatchGroup implements UnifiedDisposable {
|
|
|
132
133
|
private onCommonEvent(event: FileWatchEvent): void {
|
|
133
134
|
// Compute relative path from common git dir
|
|
134
135
|
if (!isDescendant(event.path, this.commonGitDir)) return;
|
|
136
|
+
|
|
135
137
|
const relativePath = relative(this.commonGitDir, event.path);
|
|
136
138
|
if (shouldIgnoreRepoPath(relativePath)) return;
|
|
137
139
|
|
|
@@ -161,6 +163,7 @@ export class WatchGroup implements UnifiedDisposable {
|
|
|
161
163
|
|
|
162
164
|
private onRootEvent(event: FileWatchEvent, entry: SessionEntry): void {
|
|
163
165
|
if (!isDescendant(event.path, entry.gitDirPath)) return;
|
|
166
|
+
|
|
164
167
|
const relativePath = relative(entry.gitDirPath, event.path);
|
|
165
168
|
if (shouldIgnoreRepoPath(relativePath)) return;
|
|
166
169
|
|