@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
|
@@ -38,7 +38,16 @@ export interface WatchHandle {
|
|
|
38
38
|
interface SessionRecord {
|
|
39
39
|
readonly session: RepositoryWatchSession;
|
|
40
40
|
readonly gitDir: GitDir;
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Hooks contributed by all current `watch()` callers for this repo path. Earlier
|
|
43
|
+
* implementations stored just the first caller's hooks (`WatchHooks | undefined`) and
|
|
44
|
+
* silently dropped subsequent callers' hooks — that broke the case where a low-level
|
|
45
|
+
* subscriber (e.g. the Graph's secondary-worktree WIP watcher) opened the session
|
|
46
|
+
* first without hooks, and a later `Repository.setupWatching` for the same path lost
|
|
47
|
+
* its `markFetched` / `onIgnoresChanged` wiring. Each `watch()` call adds its hooks
|
|
48
|
+
* to this set and removes them on dispose; fire sites iterate the set.
|
|
49
|
+
*/
|
|
50
|
+
readonly watchHooks: Set<WatchHooks>;
|
|
42
51
|
refCount: number;
|
|
43
52
|
}
|
|
44
53
|
|
|
@@ -83,6 +92,7 @@ export class RepositoryWatchService implements UnifiedDisposable {
|
|
|
83
92
|
|
|
84
93
|
dispose(): void {
|
|
85
94
|
if (this._disposed) return;
|
|
95
|
+
|
|
86
96
|
this._disposed = true;
|
|
87
97
|
|
|
88
98
|
for (const record of this.sessionMap.values()) {
|
|
@@ -117,6 +127,9 @@ export class RepositoryWatchService implements UnifiedDisposable {
|
|
|
117
127
|
let record = this.sessionMap.get(repoPath);
|
|
118
128
|
if (record != null) {
|
|
119
129
|
record.refCount++;
|
|
130
|
+
if (watchHooks != null) {
|
|
131
|
+
record.watchHooks.add(watchHooks);
|
|
132
|
+
}
|
|
120
133
|
} else {
|
|
121
134
|
const session = new RepositoryWatchSession({
|
|
122
135
|
repoPath: repoPath,
|
|
@@ -150,10 +163,15 @@ export class RepositoryWatchService implements UnifiedDisposable {
|
|
|
150
163
|
},
|
|
151
164
|
});
|
|
152
165
|
|
|
166
|
+
const watchHooksSet = new Set<WatchHooks>();
|
|
167
|
+
if (watchHooks != null) {
|
|
168
|
+
watchHooksSet.add(watchHooks);
|
|
169
|
+
}
|
|
170
|
+
|
|
153
171
|
record = {
|
|
154
172
|
session: session,
|
|
155
173
|
gitDir: gitDir,
|
|
156
|
-
watchHooks:
|
|
174
|
+
watchHooks: watchHooksSet,
|
|
157
175
|
refCount: 1,
|
|
158
176
|
};
|
|
159
177
|
this.sessionMap.set(repoPath, record);
|
|
@@ -166,12 +184,16 @@ export class RepositoryWatchService implements UnifiedDisposable {
|
|
|
166
184
|
session: sessionRef,
|
|
167
185
|
dispose: (): void => {
|
|
168
186
|
if (handleDisposed) return;
|
|
187
|
+
|
|
169
188
|
handleDisposed = true;
|
|
170
189
|
|
|
171
190
|
const rec = this.sessionMap.get(repoPath);
|
|
172
191
|
if (rec == null) return;
|
|
173
192
|
|
|
174
193
|
rec.refCount--;
|
|
194
|
+
if (watchHooks != null) {
|
|
195
|
+
rec.watchHooks.delete(watchHooks);
|
|
196
|
+
}
|
|
175
197
|
if (rec.refCount <= 0) {
|
|
176
198
|
this.sessionMap.delete(repoPath);
|
|
177
199
|
this.disposeSessionRecord(rec);
|
|
@@ -229,11 +251,18 @@ export class RepositoryWatchService implements UnifiedDisposable {
|
|
|
229
251
|
session.pushRepoChanges(changes);
|
|
230
252
|
},
|
|
231
253
|
onFetchHeadChanged: function (repoPath: string): void {
|
|
232
|
-
|
|
254
|
+
// Iterate at fire time so callers that joined after the group was wired up
|
|
255
|
+
// still receive events (e.g. a `Repository.setupWatching` whose hooks landed
|
|
256
|
+
// after a hookless `GitRepositoryService.watch` registered first).
|
|
257
|
+
for (const h of watchHooks) {
|
|
258
|
+
h.onFetchHeadChanged?.(repoPath);
|
|
259
|
+
}
|
|
233
260
|
},
|
|
234
261
|
onIgnoresChanged: (repoPath: string): void => {
|
|
235
262
|
this.refreshWorkingTreeFilter(repoPath);
|
|
236
|
-
watchHooks
|
|
263
|
+
for (const h of watchHooks) {
|
|
264
|
+
h.onIgnoresChanged?.(repoPath);
|
|
265
|
+
}
|
|
237
266
|
},
|
|
238
267
|
};
|
|
239
268
|
|
|
@@ -293,7 +322,10 @@ export class RepositoryWatchService implements UnifiedDisposable {
|
|
|
293
322
|
if (filter != null) {
|
|
294
323
|
void filter.refresh();
|
|
295
324
|
}
|
|
296
|
-
|
|
325
|
+
// See `connectToWatchGroup` for the iterate-at-fire-time rationale.
|
|
326
|
+
for (const h of watchHooks) {
|
|
327
|
+
h.onGitIgnoreChanged?.(repoPath);
|
|
328
|
+
}
|
|
297
329
|
// Don't push .gitignore itself as a working tree change
|
|
298
330
|
return;
|
|
299
331
|
}
|
|
@@ -341,6 +373,7 @@ function filterWorkingTreePaths(absolutePaths: string[], repoPath: string, filte
|
|
|
341
373
|
const result: string[] = [];
|
|
342
374
|
for (const p of absolutePaths) {
|
|
343
375
|
if (!isDescendant(p, repoPath)) continue;
|
|
376
|
+
|
|
344
377
|
const relativePath = relative(repoPath, p);
|
|
345
378
|
if (!filter.isIgnored(relativePath)) {
|
|
346
379
|
result.push(p);
|
|
@@ -97,6 +97,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
|
|
|
97
97
|
|
|
98
98
|
dispose(): void {
|
|
99
99
|
if (this._disposed) return;
|
|
100
|
+
|
|
100
101
|
this._disposed = true;
|
|
101
102
|
|
|
102
103
|
this.cancelRepoTimer();
|
|
@@ -175,6 +176,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
|
|
|
175
176
|
return Object.assign(
|
|
176
177
|
createDisposable(() => {
|
|
177
178
|
if (subDisposed) return;
|
|
179
|
+
|
|
178
180
|
subDisposed = true;
|
|
179
181
|
|
|
180
182
|
this.repoDelays.delete(id);
|
|
@@ -221,6 +223,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
|
|
|
221
223
|
return Object.assign(
|
|
222
224
|
createDisposable(() => {
|
|
223
225
|
if (subDisposed) return;
|
|
226
|
+
|
|
224
227
|
subDisposed = true;
|
|
225
228
|
|
|
226
229
|
this.wtDelays.delete(id);
|
|
@@ -245,6 +248,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
|
|
|
245
248
|
|
|
246
249
|
resume(delayMs?: number): void {
|
|
247
250
|
if (!this._suspended) return;
|
|
251
|
+
|
|
248
252
|
this._suspended = false;
|
|
249
253
|
|
|
250
254
|
// Flush accumulated changes
|
|
@@ -259,30 +263,35 @@ export class RepositoryWatchSession implements UnifiedDisposable {
|
|
|
259
263
|
/** Inject changes (e.g., after a git operation the caller performed). Goes through debounce + suspend. */
|
|
260
264
|
fireChange(...changes: RepositoryChange[]): void {
|
|
261
265
|
if (this._disposed || changes.length === 0) return;
|
|
266
|
+
|
|
262
267
|
this.coalesceRepo(changes);
|
|
263
268
|
}
|
|
264
269
|
|
|
265
270
|
/** Immediate fire, bypassing debounce + suspend (for Closed/Opened). */
|
|
266
271
|
fireChangeImmediate(...changes: RepositoryChange[]): void {
|
|
267
272
|
if (this._disposed || changes.length === 0) return;
|
|
273
|
+
|
|
268
274
|
this.repoEmitter.fire(new WatcherRepoChangeEvent(this.repoPath, changes));
|
|
269
275
|
}
|
|
270
276
|
|
|
271
277
|
/** Push interpreted repo changes into the pipeline */
|
|
272
278
|
pushRepoChanges(changes: RepositoryChange[]): void {
|
|
273
279
|
if (this._disposed) return;
|
|
280
|
+
|
|
274
281
|
this.coalesceRepo(changes);
|
|
275
282
|
}
|
|
276
283
|
|
|
277
284
|
/** Push working tree file changes into the pipeline */
|
|
278
285
|
pushWorkingTreeChanges(paths: Iterable<string>): void {
|
|
279
286
|
if (this._disposed) return;
|
|
287
|
+
|
|
280
288
|
this._etagWorkingTree++;
|
|
281
289
|
this.coalesceWT(paths);
|
|
282
290
|
}
|
|
283
291
|
|
|
284
292
|
private static minDelay(delays: Map<number, number>, fallback: number): number {
|
|
285
293
|
if (delays.size === 0) return fallback;
|
|
294
|
+
|
|
286
295
|
let min = fallback;
|
|
287
296
|
for (const d of delays.values()) {
|
|
288
297
|
if (d < min) {
|
|
@@ -304,6 +313,7 @@ export class RepositoryWatchSession implements UnifiedDisposable {
|
|
|
304
313
|
this.repoTimer = undefined;
|
|
305
314
|
const event = this.pendingRepoEvent;
|
|
306
315
|
if (event == null) return;
|
|
316
|
+
|
|
307
317
|
this.pendingRepoEvent = undefined;
|
|
308
318
|
this.repoEmitter.fire(event);
|
|
309
319
|
this.onDidFireRepoChangeCallback?.(event);
|
package/src/git-cli/exec/git.ts
CHANGED
|
@@ -39,7 +39,7 @@ import { compare, fromString } from '../../utils/version.js';
|
|
|
39
39
|
import { CancelledRunError, RunError } from './exec.errors.js';
|
|
40
40
|
import type { RunOptions, RunResult } from './exec.js';
|
|
41
41
|
import { fsExists, runSpawn } from './exec.js';
|
|
42
|
-
import type { GitCommandPriority,
|
|
42
|
+
import type { GitCommandPriority, GitResult, GitRunOptions, GitSpawnOptions } from './exec.types.js';
|
|
43
43
|
import type { FilteredGitFeatures, GitFeatureOrPrefix, GitFeatures } from './features.js';
|
|
44
44
|
import { gitFeaturesByVersion } from './features.js';
|
|
45
45
|
import type { GitQueueConfig } from './gitQueue.js';
|
|
@@ -508,7 +508,7 @@ const trailingNewlineRegex = /[\r|\n]+$/;
|
|
|
508
508
|
const uniqueCounterForStdin = getScopedCounter();
|
|
509
509
|
const uniqueCounterForStream = getScopedCounter();
|
|
510
510
|
|
|
511
|
-
type ExitCodeOnlyGitCommandOptions =
|
|
511
|
+
type ExitCodeOnlyGitCommandOptions = GitRunOptions & { exitCodeOnly: true };
|
|
512
512
|
|
|
513
513
|
export class Git {
|
|
514
514
|
/** Map of running git commands — avoids running duplicate overlapping commands */
|
|
@@ -636,11 +636,11 @@ export class Git {
|
|
|
636
636
|
...args: readonly (string | undefined)[]
|
|
637
637
|
): Promise<GitResult<unknown>>;
|
|
638
638
|
async run<T extends string | Buffer = string>(
|
|
639
|
-
options:
|
|
639
|
+
options: GitRunOptions,
|
|
640
640
|
...args: readonly (string | undefined)[]
|
|
641
641
|
): Promise<GitResult<T>>;
|
|
642
642
|
async run<T extends string | Buffer = string>(
|
|
643
|
-
options:
|
|
643
|
+
options: GitRunOptions,
|
|
644
644
|
...args: readonly (string | undefined)[]
|
|
645
645
|
): Promise<GitResult<T | unknown>> {
|
|
646
646
|
if (this.options.isTrusted?.() === false) throw new WorkspaceUntrustedError();
|
|
@@ -668,7 +668,7 @@ export class Git {
|
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
private async runCore<T extends string | Buffer>(
|
|
671
|
-
options:
|
|
671
|
+
options: GitRunOptions,
|
|
672
672
|
args: string[],
|
|
673
673
|
gitCommand: string,
|
|
674
674
|
): Promise<GitResult<T | unknown>> {
|
|
@@ -906,6 +906,7 @@ export class Git {
|
|
|
906
906
|
let cleanedUp = false;
|
|
907
907
|
const cleanup = () => {
|
|
908
908
|
if (cleanedUp) return;
|
|
909
|
+
|
|
909
910
|
cleanedUp = true;
|
|
910
911
|
|
|
911
912
|
try {
|
|
@@ -261,33 +261,62 @@ export class GitQueue {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
265
|
-
*
|
|
264
|
+
* Git global options that consume the next positional arg as their value
|
|
265
|
+
* (e.g. `--work-tree <path>`). Long-form `--name=value` is already skipped by
|
|
266
|
+
* the leading-dash check, so only the separated form needs explicit handling.
|
|
267
|
+
*/
|
|
268
|
+
const optionsTakingValue = new Set([
|
|
269
|
+
'-c',
|
|
270
|
+
'-C',
|
|
271
|
+
'--git-dir',
|
|
272
|
+
'--work-tree',
|
|
273
|
+
'--namespace',
|
|
274
|
+
'--exec-path',
|
|
275
|
+
'--super-prefix',
|
|
276
|
+
'--config-env',
|
|
277
|
+
'--attr-source',
|
|
278
|
+
'--list-cmds',
|
|
279
|
+
]);
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Infers a queue priority from the git command being invoked.
|
|
283
|
+
*
|
|
284
|
+
* Intentionally narrow: only returns 'background' for commands that are
|
|
285
|
+
* *always* read-only AND *always* potentially expensive. Polymorphic commands
|
|
286
|
+
* like `log` and `rev-list` (which can be quick bounded lookups or full-history
|
|
287
|
+
* walks) are deliberately omitted — call sites that perform heavy walks must
|
|
288
|
+
* pass `priority: 'background'` explicitly. Never upgrades to 'interactive'.
|
|
289
|
+
*
|
|
290
|
+
* No subcommand awareness (e.g. `stash list`, `branch -l`): the risk of
|
|
291
|
+
* misclassifying a write subcommand as background outweighs the gain.
|
|
266
292
|
*/
|
|
267
293
|
export function inferGitCommandPriority(args: readonly (string | undefined)[]): GitCommandPriority {
|
|
268
|
-
let skip = false;
|
|
269
294
|
let command: string | undefined;
|
|
270
|
-
for (
|
|
295
|
+
for (let i = 0; i < args.length; i++) {
|
|
296
|
+
const a = args[i];
|
|
271
297
|
if (a == null) continue;
|
|
272
|
-
if (
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
skip = true;
|
|
298
|
+
if (optionsTakingValue.has(a)) {
|
|
299
|
+
const next = args[i + 1];
|
|
300
|
+
if (next != null && !next.startsWith('-')) {
|
|
301
|
+
i++;
|
|
302
|
+
}
|
|
278
303
|
continue;
|
|
279
304
|
}
|
|
280
305
|
if (a.startsWith('-')) continue;
|
|
306
|
+
|
|
281
307
|
command = a;
|
|
282
308
|
break;
|
|
283
309
|
}
|
|
284
310
|
|
|
285
311
|
switch (command) {
|
|
286
|
-
case 'log':
|
|
287
|
-
case 'rev-list':
|
|
288
312
|
case 'for-each-ref':
|
|
289
313
|
case 'shortlog':
|
|
290
314
|
case 'reflog':
|
|
315
|
+
case 'name-rev':
|
|
316
|
+
case 'describe':
|
|
317
|
+
case 'cherry':
|
|
318
|
+
case 'count-objects':
|
|
319
|
+
case 'fsck':
|
|
291
320
|
return 'background';
|
|
292
321
|
default:
|
|
293
322
|
return 'normal';
|
|
@@ -420,6 +420,7 @@ function createLogParserWithFilesAndStats<T extends Record<string, string> | voi
|
|
|
420
420
|
|
|
421
421
|
endIndex = line.indexOf(' ', startIndex);
|
|
422
422
|
if (endIndex === -1) continue;
|
|
423
|
+
|
|
423
424
|
const newMode = line.substring(startIndex, endIndex);
|
|
424
425
|
|
|
425
426
|
// Parse old_sha and new_sha positions
|
|
@@ -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
|
|