@gitkraken/core-gitlens 0.5.113 → 0.5.114
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 +17 -1
- package/dist/git/cache.d.ts +4 -0
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +33 -0
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +10 -0
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/errors.d.ts +6 -3
- package/dist/git/errors.d.ts.map +1 -1
- package/dist/git/errors.js +9 -1
- package/dist/git/errors.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 +38 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/gitHealth.d.ts +153 -0
- package/dist/git/gitHealth.d.ts.map +1 -0
- package/dist/git/gitHealth.js +353 -0
- package/dist/git/gitHealth.js.map +1 -0
- package/dist/git/models/search.d.ts +6 -3
- package/dist/git/models/search.d.ts.map +1 -1
- package/dist/git/models/search.js +5 -1
- package/dist/git/models/search.js.map +1 -1
- package/dist/git/parsers/diffParser.d.ts +8 -2
- package/dist/git/parsers/diffParser.d.ts.map +1 -1
- package/dist/git/parsers/diffParser.js +27 -4
- package/dist/git/parsers/diffParser.js.map +1 -1
- package/dist/git/providers/config.d.ts +36 -3
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/graph.d.ts +9 -0
- package/dist/git/providers/graph.d.ts.map +1 -1
- package/dist/git/providers/maintenance.d.ts +222 -0
- package/dist/git/providers/maintenance.d.ts.map +1 -0
- package/dist/git/providers/maintenance.js +20 -0
- package/dist/git/providers/maintenance.js.map +1 -0
- package/dist/git/providers/operations.d.ts +10 -0
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/pausedOperations.d.ts +3 -0
- package/dist/git/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git/providers/provider.d.ts +2 -0
- package/dist/git/providers/provider.d.ts.map +1 -1
- package/dist/git/providers/tags.d.ts +3 -0
- package/dist/git/providers/tags.d.ts.map +1 -1
- package/dist/git/repositoryService.d.ts +1 -0
- package/dist/git/repositoryService.d.ts.map +1 -1
- package/dist/git/repositoryService.js.map +1 -1
- package/dist/git/run.types.d.ts +8 -0
- package/dist/git/run.types.d.ts.map +1 -1
- package/dist/git/service.js +3 -0
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/search.utils.d.ts.map +1 -1
- package/dist/git/utils/search.utils.js +112 -5
- package/dist/git/utils/search.utils.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +3 -0
- package/dist/git/watching/watchService.d.ts.map +1 -1
- package/dist/git/watching/watchService.js +8 -0
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +11 -0
- package/dist/git-cli/cliGitProvider.d.ts.map +1 -1
- package/dist/git-cli/cliGitProvider.js +12 -0
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +23 -1
- package/dist/git-cli/exec/git.d.ts.map +1 -1
- package/dist/git-cli/exec/git.js +83 -8
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +2 -0
- package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
- package/dist/git-cli/exec/gitQueue.js +19 -17
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/parsers/logParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/logParser.js +4 -1
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/providers/blame.d.ts.map +1 -1
- package/dist/git-cli/providers/blame.js +4 -7
- package/dist/git-cli/providers/blame.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts.map +1 -1
- package/dist/git-cli/providers/branches.js +13 -3
- 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 +34 -3
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +27 -0
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js +31 -6
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts +8 -0
- package/dist/git-cli/providers/graph.d.ts.map +1 -1
- package/dist/git-cli/providers/graph.js +85 -6
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/maintenance.d.ts +306 -0
- package/dist/git-cli/providers/maintenance.d.ts.map +1 -0
- package/dist/git-cli/providers/maintenance.js +2129 -0
- package/dist/git-cli/providers/maintenance.js.map +1 -0
- package/dist/git-cli/providers/operations.d.ts +1 -0
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js +8 -0
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +1 -0
- package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +1 -1
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/tags.d.ts +3 -0
- package/dist/git-cli/providers/tags.d.ts.map +1 -1
- package/dist/git-cli/providers/tags.js +23 -1
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/plus/agents/agentCapabilities.d.ts +77 -0
- package/dist/plus/agents/agentCapabilities.d.ts.map +1 -0
- package/dist/plus/agents/agentCapabilities.js +197 -0
- package/dist/plus/agents/agentCapabilities.js.map +1 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +77 -13
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +263 -55
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/agents/providers/{claudeCodeProvider.d.ts → gkAgentProvider.d.ts} +52 -19
- package/dist/plus/agents/providers/gkAgentProvider.d.ts.map +1 -0
- package/dist/plus/agents/providers/{claudeCodeProvider.js → gkAgentProvider.js} +935 -262
- package/dist/plus/agents/providers/gkAgentProvider.js.map +1 -0
- package/dist/plus/agents/types.d.ts +113 -35
- package/dist/plus/agents/types.d.ts.map +1 -1
- package/dist/plus/agents/types.js +7 -4
- package/dist/plus/agents/types.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
- package/dist/plus/ai/prompts.d.ts +4 -0
- package/dist/plus/ai/prompts.d.ts.map +1 -1
- package/dist/plus/ai/prompts.js +59 -4
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +44 -1
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +318 -25
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueSearchQuery.d.ts +13 -0
- package/dist/plus/git-github/api/issueSearchQuery.d.ts.map +1 -1
- package/dist/plus/git-github/api/issueSearchQuery.js +41 -0
- package/dist/plus/git-github/api/issueSearchQuery.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 +2 -1
- package/dist/plus/git-github/providers/github/blame.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +11 -0
- package/dist/plus/integrations/integrationService.d.ts.map +1 -1
- package/dist/plus/integrations/integrationService.js +4 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +26 -0
- package/dist/plus/integrations/manager.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +31 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +31 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +1 -1
- package/dist/plus/integrations/models/integration.d.ts.map +1 -1
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +9 -0
- package/dist/plus/integrations/providers/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.js +7 -0
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts +47 -10
- package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
- package/dist/plus/integrations/reads/broaden.js +144 -33
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +18 -0
- package/dist/plus/integrations/reads/filters.d.ts.map +1 -1
- package/dist/plus/integrations/reads/filters.js +37 -1
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +51 -0
- package/dist/plus/integrations/reads/issueBatch.d.ts.map +1 -0
- package/dist/plus/integrations/reads/issueBatch.js +91 -0
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -0
- package/dist/plus/integrations/reads/sweeps.d.ts.map +1 -1
- package/dist/plus/integrations/reads/sweeps.js +5 -3
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/utils/promiseCache.d.ts +19 -0
- package/dist/utils/promiseCache.d.ts.map +1 -1
- package/dist/utils/promiseCache.js +30 -0
- package/dist/utils/promiseCache.js.map +1 -1
- package/dist/utils/resourceUsage.d.ts +5 -0
- package/dist/utils/resourceUsage.d.ts.map +1 -0
- package/dist/utils/resourceUsage.js +2 -0
- package/dist/utils/resourceUsage.js.map +1 -0
- package/dist/utils/string.d.ts +12 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +36 -1
- package/dist/utils/string.js.map +1 -1
- package/docs/integrations.md +29 -25
- package/docs/kepler-read-api-parity.md +12 -4
- package/package.json +11 -3
- package/src/git/cache.ts +36 -0
- package/src/git/context.ts +11 -0
- package/src/git/errors.ts +13 -1
- package/src/git/features.ts +51 -0
- package/src/git/gitHealth.ts +522 -0
- package/src/git/models/search.ts +19 -4
- package/src/git/parsers/diffParser.ts +27 -4
- package/src/git/providers/config.ts +42 -1
- package/src/git/providers/graph.ts +12 -0
- package/src/git/providers/maintenance.ts +224 -0
- package/src/git/providers/operations.ts +10 -0
- package/src/git/providers/pausedOperations.ts +3 -0
- package/src/git/providers/provider.ts +2 -0
- package/src/git/providers/tags.ts +1 -0
- package/src/git/repositoryService.ts +1 -0
- package/src/git/run.types.ts +8 -0
- package/src/git/service.ts +3 -0
- package/src/git/utils/search.utils.ts +129 -5
- package/src/git/watching/watchService.ts +10 -0
- package/src/git-cli/cliGitProvider.ts +25 -0
- package/src/git-cli/exec/git.ts +120 -6
- package/src/git-cli/exec/gitQueue.ts +19 -17
- package/src/git-cli/parsers/logParser.ts +4 -1
- package/src/git-cli/providers/blame.ts +3 -8
- package/src/git-cli/providers/branches.ts +28 -8
- package/src/git-cli/providers/commits.ts +34 -2
- package/src/git-cli/providers/config.ts +38 -6
- package/src/git-cli/providers/graph.ts +107 -7
- package/src/git-cli/providers/maintenance.ts +2599 -0
- package/src/git-cli/providers/operations.ts +11 -0
- package/src/git-cli/providers/pausedOperations.ts +7 -2
- package/src/git-cli/providers/tags.ts +36 -1
- package/src/plus/agents/agentCapabilities.ts +286 -0
- package/src/plus/agents/providers/claudeCodeTranscript.ts +313 -58
- package/src/plus/agents/providers/{claudeCodeProvider.ts → gkAgentProvider.ts} +1123 -277
- package/src/plus/agents/types.ts +137 -40
- package/src/plus/ai/models/promptTemplates.ts +1 -1
- package/src/plus/ai/prompts.ts +62 -4
- package/src/plus/git-github/api/github.ts +353 -24
- package/src/plus/git-github/api/issueSearchQuery.ts +49 -1
- package/src/plus/git-github/providers/github/blame.ts +2 -1
- package/src/plus/integrations/integrationService.ts +15 -0
- package/src/plus/integrations/manager.ts +26 -0
- package/src/plus/integrations/models/gitHostIntegration.ts +48 -0
- package/src/plus/integrations/models/integration.ts +1 -0
- package/src/plus/integrations/providers/github.ts +18 -0
- package/src/plus/integrations/reads/broaden.ts +282 -70
- package/src/plus/integrations/reads/filters.ts +39 -1
- package/src/plus/integrations/reads/issueBatch.ts +197 -0
- package/src/plus/integrations/reads/sweeps.ts +19 -12
- package/src/utils/promiseCache.ts +43 -0
- package/src/utils/resourceUsage.ts +5 -0
- package/src/utils/string.ts +38 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +0 -1
- package/dist/plus/agents/providers/claudeCodeProvider.js.map +0 -1
|
@@ -8,6 +8,8 @@ export type GitCoreConfigKeys =
|
|
|
8
8
|
| 'core.excludesFile'
|
|
9
9
|
| 'diff.guitool'
|
|
10
10
|
| 'diff.tool'
|
|
11
|
+
/** `fetch.prune` — whether `git fetch` removes remote-tracking branches that no longer exist on the remote */
|
|
12
|
+
| 'fetch.prune'
|
|
11
13
|
| 'gpg.format'
|
|
12
14
|
| 'gpg.program'
|
|
13
15
|
| 'gpg.ssh.program'
|
|
@@ -15,14 +17,20 @@ export type GitCoreConfigKeys =
|
|
|
15
17
|
| 'init.defaultBranch'
|
|
16
18
|
/** `merge.autoStash` — whether `git merge` (and so a merging `git pull`) stashes and reapplies uncommitted changes */
|
|
17
19
|
| 'merge.autoStash'
|
|
20
|
+
/** `merge.ff` — whether `git merge` fast-forwards when possible; also accepts `'only'` to require it */
|
|
21
|
+
| 'merge.ff'
|
|
18
22
|
/** `pull.autoStash` — overrides `merge.autoStash`/`rebase.autoStash` for `git pull`, in either mode */
|
|
19
23
|
| 'pull.autoStash'
|
|
20
24
|
/** `pull.rebase` — whether `git pull` rebases instead of merging; also accepts `merges`/`interactive` */
|
|
21
25
|
| 'pull.rebase'
|
|
22
26
|
/** `rebase.autoStash` — whether `git rebase` (and so a rebasing `git pull`) stashes and reapplies uncommitted changes */
|
|
23
27
|
| 'rebase.autoStash'
|
|
28
|
+
/** `rebase.autosquash` — whether `git rebase` automatically folds `fixup!`/`squash!` commits into the commits they target */
|
|
29
|
+
| 'rebase.autosquash'
|
|
24
30
|
/** `rebase.updateRefs` — whether `git rebase` also updates branches pointing to the rebased commits */
|
|
25
31
|
| 'rebase.updateRefs'
|
|
32
|
+
/** `remote.pushDefault` — the remote `git push` targets when a branch has no explicit push remote configured */
|
|
33
|
+
| 'remote.pushDefault'
|
|
26
34
|
| 'user.email'
|
|
27
35
|
| 'user.name'
|
|
28
36
|
| 'user.signingkey';
|
|
@@ -54,7 +62,40 @@ export type GkConfigKeys =
|
|
|
54
62
|
/** `gk-disposition` — user-assigned branch disposition: 'starred' or 'archived' */
|
|
55
63
|
| `branch.${string}.gk-disposition`
|
|
56
64
|
/** `gk.defaultRemote` — the user-designated default remote for the repository */
|
|
57
|
-
| 'gk.defaultRemote'
|
|
65
|
+
| 'gk.defaultRemote'
|
|
66
|
+
/** `gk.maintenanceLastRun` — ISO 8601 timestamp of the last auto-tier git-optimization maintenance pass */
|
|
67
|
+
| 'gk.maintenanceLastRun'
|
|
68
|
+
/** `gk.commitGraphDisabled` — `'true'` once the user disables GitLens's automatic commit-graph maintenance for this repo */
|
|
69
|
+
| 'gk.commitGraphDisabled'
|
|
70
|
+
/** `gk.fsmonitorNotApplicable` — `'true'` once FSMonitor failed to enable for this repo, so it's never re-suggested */
|
|
71
|
+
| 'gk.fsmonitorNotApplicable'
|
|
72
|
+
/** `gk.untrackedCacheNotApplicable` — `'true'` once the untracked cache failed git's filesystem probe here, so it's never re-suggested */
|
|
73
|
+
| 'gk.untrackedCacheNotApplicable'
|
|
74
|
+
/**
|
|
75
|
+
* `gk.applied.*` — Git Health ownership + undo markers under `[gk "applied"]`. Each value is the lever's
|
|
76
|
+
* prior LOCAL-scope value (so undo restores it exactly) or the literal `unset` sentinel when it was absent;
|
|
77
|
+
* the marker's mere presence also means "applied by GitLens" (so undo is never offered for a user-enabled
|
|
78
|
+
* lever). `backgroundMaintenance` is a presence-only ownership flag (registration is global; undo =
|
|
79
|
+
* unregister), and `maintenanceAuto` holds the prior `maintenance.auto` that `git maintenance start` sets
|
|
80
|
+
* to false and unregister does not restore.
|
|
81
|
+
*/
|
|
82
|
+
| 'gk.applied.untrackedCache'
|
|
83
|
+
| 'gk.applied.fsmonitor'
|
|
84
|
+
| 'gk.applied.manyFiles'
|
|
85
|
+
| 'gk.applied.skipHash'
|
|
86
|
+
| 'gk.applied.backgroundMaintenance'
|
|
87
|
+
| 'gk.applied.maintenanceAuto'
|
|
88
|
+
/** `git maintenance register` sets `maintenance.strategy` too, and `unregister` does NOT restore it. */
|
|
89
|
+
| 'gk.applied.maintenanceStrategy'
|
|
90
|
+
/**
|
|
91
|
+
* Write-ahead records for direct Git Health config mutations. A pending record is finalized into the
|
|
92
|
+
* corresponding `gk.applied.*` marker only after the local config write succeeds; interrupted records are
|
|
93
|
+
* reconciled on the next probe so a crash cannot silently lose ownership or claim a failed write.
|
|
94
|
+
*/
|
|
95
|
+
| 'gk.pending.untrackedCache'
|
|
96
|
+
| 'gk.pending.fsmonitor'
|
|
97
|
+
| 'gk.pending.manyFiles'
|
|
98
|
+
| 'gk.pending.skipHash';
|
|
58
99
|
|
|
59
100
|
export type DeprecatedGkConfigKeys = `branch.${string}.gk-target-base`;
|
|
60
101
|
|
|
@@ -80,4 +80,16 @@ export interface GitGraphSubProvider {
|
|
|
80
80
|
options?: { limit?: number },
|
|
81
81
|
cancellation?: AbortSignal,
|
|
82
82
|
): AsyncGenerator<GitGraphSearchProgress, GitGraphSearch, void>;
|
|
83
|
+
/**
|
|
84
|
+
* Counts commits matching `search` without materializing results — used to probe whether a relaxed
|
|
85
|
+
* (broadened) variant of a zero-result search would actually find anything, before offering it as a
|
|
86
|
+
* calm inline chip. Optional: providers that can't cheaply count (e.g. GitHub) simply omit it, and
|
|
87
|
+
* callers treat a missing implementation the same as "no relaxations available" (never an error).
|
|
88
|
+
*/
|
|
89
|
+
countSearchResults?(
|
|
90
|
+
repoPath: string,
|
|
91
|
+
search: SearchQuery,
|
|
92
|
+
options?: { maxCount?: number },
|
|
93
|
+
cancellation?: AbortSignal,
|
|
94
|
+
): Promise<number>;
|
|
83
95
|
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git maintenance / optimization sub-provider — the data plane behind the Git Health feature.
|
|
3
|
+
*
|
|
4
|
+
* Two tiers of levers (see `.work/dev/git-health/spec.md`):
|
|
5
|
+
* - **Auto tier** — inert, repo-local maintenance applied silently: the demand-cadence commit-graph
|
|
6
|
+
* write and `git maintenance run` one-shots. No config levers — the auto tier never rewrites config.
|
|
7
|
+
* - **Ask tier** — config levers surfaced for one-click apply/undo (`core.untrackedCache`,
|
|
8
|
+
* `core.fsmonitor`, `git maintenance start`, `feature.manyFiles`).
|
|
9
|
+
*
|
|
10
|
+
* The commit-graph is a task OF this service, not a thing beside it: `MaintenanceGitSubProvider` owns its
|
|
11
|
+
* implementation (a direct `git commit-graph write --reachable --split` — usable at 2.24, unlike the 2.30
|
|
12
|
+
* `maintenance run --task=commit-graph`), its policy, and its demand cadence (minutes throttle + single-flight
|
|
13
|
+
* keyed by common git dir). `GraphGitSubProvider` and the repo-open shape probe merely `request(...)` it.
|
|
14
|
+
*
|
|
15
|
+
* Every method is repo-path-first (so the `RepositoryService` proxy can auto-inject `repoPath`) and
|
|
16
|
+
* `AbortSignal`-able. The provider is optional — it exists only on the desktop CLI provider, so web
|
|
17
|
+
* builds and virtual repos never register it (availability is a per-repo capability, `repo.git.maintenance`).
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Auto-tier maintenance tasks. `commit-graph` runs a DIRECT `git commit-graph write --reachable --split`
|
|
22
|
+
* (2.24+); the others run their native `git maintenance run --task=…` implementations.
|
|
23
|
+
*/
|
|
24
|
+
export type GitMaintenanceTask = 'commit-graph' | 'loose-objects' | 'incremental-repack' | 'pack-refs';
|
|
25
|
+
|
|
26
|
+
/** The uniform apply/revert surface for every optimization lever (auto + ask). */
|
|
27
|
+
export type GitOptimizationId = 'untrackedCache' | 'fsmonitor' | 'backgroundMaintenance' | 'manyFiles' | 'sparseIndex';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Cheap per-session shape probe — filesystem stats + config reads only, no expensive git walks. Shared
|
|
31
|
+
* across worktrees (keyed by common path). Everything here is derivable without inflating objects.
|
|
32
|
+
*/
|
|
33
|
+
export interface GitHealthSnapshot {
|
|
34
|
+
/** Repository shape that changes how the remaining measurements should be interpreted. */
|
|
35
|
+
readonly repository: {
|
|
36
|
+
/** Whether local history stops at an intentional shallow boundary; `undefined` when detection failed. */
|
|
37
|
+
readonly shallow: boolean | undefined;
|
|
38
|
+
/** Whether missing objects may be supplied by a promisor remote; `undefined` when detection failed. */
|
|
39
|
+
readonly partial: boolean | undefined;
|
|
40
|
+
/** Whether the worktree is populated from a sparse specification; `undefined` when config was unreadable. */
|
|
41
|
+
readonly sparseCheckout: boolean | undefined;
|
|
42
|
+
/** Whether sparse checkout uses directory-based cone mode; `undefined` when config was unreadable. */
|
|
43
|
+
readonly sparseCheckoutCone: boolean | undefined;
|
|
44
|
+
/** Whether the index is configured to use sparse-directory entries; `undefined` when config was unreadable. */
|
|
45
|
+
readonly sparseIndex: boolean | undefined;
|
|
46
|
+
/** Whether this worktree uses a split index; `undefined` when detection failed. */
|
|
47
|
+
readonly splitIndex: boolean | undefined;
|
|
48
|
+
/** Reference storage selected by the repository format. */
|
|
49
|
+
readonly refFormat: 'files' | 'reftable' | 'unknown';
|
|
50
|
+
};
|
|
51
|
+
/** Bounded loose-reference count for the files ref backend; exact unless the probe reached its cap. */
|
|
52
|
+
readonly looseRefs: { readonly count: number; readonly exact: boolean };
|
|
53
|
+
/** Presence + mtime of `objects/info/commit-graph` (or the split `commit-graphs/` chain), and changed-path Bloom filter state. */
|
|
54
|
+
readonly commitGraph: {
|
|
55
|
+
readonly present: boolean;
|
|
56
|
+
readonly mtime: number | undefined;
|
|
57
|
+
/** Whether the NEWEST graph layer carries changed-path Bloom filters (`BIDX` chunk). */
|
|
58
|
+
readonly changedPaths: boolean;
|
|
59
|
+
/** Whether this repo can write them (Git 2.31+ and not a partial clone). */
|
|
60
|
+
readonly changedPathsSupported: boolean;
|
|
61
|
+
/** `true` once the user disabled GitLens's automatic commit-graph maintenance for this repo (`gk.commitGraphDisabled`). */
|
|
62
|
+
readonly disabled: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* `true` when `core.commitGraph` is EXPLICITLY false in the user's git config — git won't read the
|
|
65
|
+
* cache, and `ensureCommitGraph` honors the same setting as a write opt-out, so the view must not
|
|
66
|
+
* claim the graph is (or will be) maintained.
|
|
67
|
+
*/
|
|
68
|
+
readonly readDisabled: boolean;
|
|
69
|
+
};
|
|
70
|
+
/** Presence of a classic or incremental multi-pack-index. */
|
|
71
|
+
readonly multiPackIndex: boolean;
|
|
72
|
+
/** Whether Git is configured to read/write the multi-pack-index; `undefined` when config was unreadable. */
|
|
73
|
+
readonly multiPackIndexEnabled: boolean | undefined;
|
|
74
|
+
/** Count of `*.pack` files in `objects/pack`. */
|
|
75
|
+
readonly packCount: number;
|
|
76
|
+
/** Pack files not represented by the active multi-pack-index; `undefined` when it could not be established. */
|
|
77
|
+
readonly packsOutsideMultiPackIndex: number | undefined;
|
|
78
|
+
/** Effective `maintenance.incremental-repack.auto` threshold; `undefined` when invalid or unreadable. */
|
|
79
|
+
readonly incrementalRepackAutoThreshold: number | undefined;
|
|
80
|
+
/** Total bytes of all `*.pack` files. */
|
|
81
|
+
readonly packBytes: number;
|
|
82
|
+
/** Raw loose-object sample (a handful of the 256 fanout dirs); the host extrapolates the estimate. */
|
|
83
|
+
readonly looseObjects: { readonly objectsInSampledDirs: number; readonly dirsSampled: number };
|
|
84
|
+
/** Size of the worktree index in bytes (including the largest shared base for a split index). */
|
|
85
|
+
readonly indexBytes: number;
|
|
86
|
+
/**
|
|
87
|
+
* Entry count from the index header (`DIRC`, version, count — all big-endian). For a normal index this is
|
|
88
|
+
* the exact tracked-file count; for a sparse index it counts the populated working set plus sparse-directory
|
|
89
|
+
* entries. It is deliberately `undefined` for a split index, whose header covers only its mutable layer,
|
|
90
|
+
* and during conflicts, whose stage entries duplicate paths.
|
|
91
|
+
*/
|
|
92
|
+
readonly indexEntryCount: number | undefined;
|
|
93
|
+
/** How {@link indexEntryCount} should be interpreted. */
|
|
94
|
+
readonly indexEntryCountType: 'full' | 'sparse' | 'split' | 'conflicted' | 'unavailable';
|
|
95
|
+
/** Current state of the config levers this feature toggles. */
|
|
96
|
+
readonly config: {
|
|
97
|
+
readonly fsmonitor: boolean;
|
|
98
|
+
readonly untrackedCache: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Whether `core.untrackedCache` carries an explicit value in ANY scope (local/global/system).
|
|
101
|
+
* {@link untrackedCache} alone can't tell "unset" from a deliberate `false`/`keep`, and this is the
|
|
102
|
+
* one lever the auto tier applies silently — so it only ever fills in an unset value.
|
|
103
|
+
*/
|
|
104
|
+
readonly untrackedCacheConfigured: boolean;
|
|
105
|
+
readonly manyFiles: boolean;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Whether this repo is registered for system-scheduled `git maintenance` (global `maintenance.repo`).
|
|
109
|
+
* `undefined` when the registration list could not be read — never treat that as "not registered": a
|
|
110
|
+
* repo the user registered themselves would read as unregistered, get suggested again, and a later
|
|
111
|
+
* Undo would silently remove their registration.
|
|
112
|
+
*/
|
|
113
|
+
readonly maintenanceRegistered: boolean | undefined;
|
|
114
|
+
/** `true` once FSMonitor failed to enable here (from the `gk.fsmonitorNotApplicable` marker) — never re-suggest. */
|
|
115
|
+
readonly fsmonitorNotApplicable: boolean;
|
|
116
|
+
/** `true` once the untracked cache failed git's filesystem probe here (`gk.untrackedCacheNotApplicable`) — never re-suggest. */
|
|
117
|
+
readonly untrackedCacheNotApplicable: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Which levers GitLens itself applied (from the `gk.applied.*` ownership markers). Lets the view render a
|
|
120
|
+
* lever the user turned on themselves as "already enabled" (no Undo) versus one GitLens applied (Apply/Undo).
|
|
121
|
+
* Distinct from {@link config}, which reports the effective state regardless of who set it.
|
|
122
|
+
*/
|
|
123
|
+
readonly applied: {
|
|
124
|
+
readonly untrackedCache: boolean;
|
|
125
|
+
readonly fsmonitor: boolean;
|
|
126
|
+
readonly manyFiles: boolean;
|
|
127
|
+
readonly backgroundMaintenance: boolean;
|
|
128
|
+
/** Worktree-scoped ownership; sparse indexes are not shared between linked worktrees. */
|
|
129
|
+
readonly sparseIndex: boolean;
|
|
130
|
+
};
|
|
131
|
+
/** Whether the installed git supports `git maintenance run` (2.30+) — gates the auto-tier tasks. */
|
|
132
|
+
readonly supportsMaintenanceRun: boolean;
|
|
133
|
+
/** Whether the installed git includes the `pack-refs` maintenance task (2.31+). */
|
|
134
|
+
readonly supportsPackRefsMaintenance: boolean;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** On-demand detail computed only when the Git Health view opens (cheap-ish git walks). */
|
|
138
|
+
export interface GitHealthDetails {
|
|
139
|
+
/** `git rev-list --count --all` — total reachable commits. `undefined` if the walk failed. */
|
|
140
|
+
readonly commitCount: number | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Parsed `git count-objects -v` breakdown. `undefined` if it failed. The `size`, `sizePack`, and
|
|
143
|
+
* `sizeGarbage` fields are normalized to BYTES — git itself reports them in KiB.
|
|
144
|
+
*/
|
|
145
|
+
readonly countObjects:
|
|
146
|
+
| {
|
|
147
|
+
readonly count: number;
|
|
148
|
+
readonly size: number;
|
|
149
|
+
readonly inPack: number;
|
|
150
|
+
readonly packs: number;
|
|
151
|
+
readonly sizePack: number;
|
|
152
|
+
readonly prunePackable: number;
|
|
153
|
+
readonly garbage: number;
|
|
154
|
+
readonly sizeGarbage: number;
|
|
155
|
+
}
|
|
156
|
+
| undefined;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Whether a given optimization lever is available for a repo, with a user-facing reason when it isn't. */
|
|
160
|
+
export interface GitOptimizationCapability {
|
|
161
|
+
readonly id: GitOptimizationId;
|
|
162
|
+
readonly supported: boolean;
|
|
163
|
+
/** Present only when `supported` is `false` — why (git version, platform, virtual FS). */
|
|
164
|
+
readonly reason?: string;
|
|
165
|
+
/** Optional caveat to surface even when supported (e.g. `manyFiles` enabling an index older tools can't read). */
|
|
166
|
+
readonly note?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface GitMaintenanceSubProvider {
|
|
170
|
+
/** Cheap filesystem + config probe of the repo's object store and lever states. */
|
|
171
|
+
getHealthSnapshot(repoPath: string, cancellation?: AbortSignal): Promise<GitHealthSnapshot>;
|
|
172
|
+
/** On-demand commit count + `count-objects` breakdown (only when the view opens). */
|
|
173
|
+
getHealthDetails(repoPath: string, cancellation?: AbortSignal): Promise<GitHealthDetails>;
|
|
174
|
+
/** Availability of each optimization lever (git version + platform gated). */
|
|
175
|
+
getCapabilities(repoPath: string): Promise<GitOptimizationCapability[]>;
|
|
176
|
+
/**
|
|
177
|
+
* Hint that a task's cache is worth refreshing now, applying that task's cadence policy. Callers normally
|
|
178
|
+
* ignore the returned promise; consumers that need freshness may await it. It resolves `true` only when a
|
|
179
|
+
* write completed and `false` when a supported request was gated or failed, and never rejects.
|
|
180
|
+
* `commit-graph` runs the demand cadence (minutes throttle + single-flight, both keyed by common git dir),
|
|
181
|
+
* fully gated on the auto-tier switches; `loose-objects`/`incremental-repack` are no-ops here (the daily
|
|
182
|
+
* pass owns them) and return `undefined`.
|
|
183
|
+
*/
|
|
184
|
+
request(repoPath: string, task: GitMaintenanceTask): Promise<boolean> | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* Atomically claims the once-per-`intervalMs` maintenance pass for this repo, stamping the shared
|
|
187
|
+
* `gk.maintenanceLastRun` if and only if the claim succeeds. Returns `false` when another window already
|
|
188
|
+
* holds it. Read-then-write from the host would not be atomic across VS Code windows, so the claim lives
|
|
189
|
+
* here where it can be taken under a real file lock.
|
|
190
|
+
*/
|
|
191
|
+
claimMaintenancePass(repoPath: string, intervalMs: number): Promise<boolean>;
|
|
192
|
+
/**
|
|
193
|
+
* Runs a single maintenance task. Resolves `true` when a supported invocation completed and `false` when
|
|
194
|
+
* it is not applicable. With `auto`, Git evaluates its native condition and may intentionally do no work.
|
|
195
|
+
* A genuine command failure THROWS. `commit-graph` writes directly (2.24+); other tasks go through
|
|
196
|
+
* `git maintenance run --task=…` (2.30+).
|
|
197
|
+
*/
|
|
198
|
+
runMaintenanceTask(
|
|
199
|
+
repoPath: string,
|
|
200
|
+
task: GitMaintenanceTask,
|
|
201
|
+
options?: { readonly auto?: boolean; readonly cancellation?: AbortSignal },
|
|
202
|
+
): Promise<boolean>;
|
|
203
|
+
/**
|
|
204
|
+
* Applies an optimization lever. Returns `true` when it took effect; `false` for a legitimate
|
|
205
|
+
* not-applicable outcome (e.g. the FSMonitor daemon wouldn't start, or the untracked cache failed git's
|
|
206
|
+
* filesystem probe — the config is restored and the repo recorded not-applicable so it's never
|
|
207
|
+
* re-suggested). A genuine command failure (config write refused, `maintenance start` errored) THROWS.
|
|
208
|
+
* Before mutating, the lever's prior value is recorded so {@link revertOptimization} can restore it.
|
|
209
|
+
*/
|
|
210
|
+
applyOptimization(repoPath: string, id: GitOptimizationId, cancellation?: AbortSignal): Promise<boolean>;
|
|
211
|
+
/**
|
|
212
|
+
* Reverts a lever GitLens applied back to its recorded prior value (never a hardcoded inverse). A no-op
|
|
213
|
+
* when GitLens didn't apply it (no ownership marker) — a user-enabled lever is never touched. A genuine
|
|
214
|
+
* command failure THROWS.
|
|
215
|
+
*/
|
|
216
|
+
revertOptimization(repoPath: string, id: GitOptimizationId, cancellation?: AbortSignal): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* Enables or disables GitLens's automatic commit-graph maintenance for this repo — a per-repository off
|
|
219
|
+
* switch, distinct from the global `gitlens.gitOptimizations.enabled` master switch. Writes the
|
|
220
|
+
* `gk.commitGraphDisabled` marker when disabling; clears it when re-enabling (tolerating an
|
|
221
|
+
* already-absent marker). User-clicked, so a genuine write failure THROWS.
|
|
222
|
+
*/
|
|
223
|
+
setCommitGraphDisabled(repoPath: string, disabled: boolean, cancellation?: AbortSignal): Promise<void>;
|
|
224
|
+
}
|
|
@@ -104,6 +104,16 @@ export interface GitOperationsSubProvider {
|
|
|
104
104
|
* emit `p` instead of `pick`). Both honor the user's git config otherwise.
|
|
105
105
|
*/
|
|
106
106
|
programmaticEditor?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Tri-state autosquash control. `true` passes `--autosquash`, folding every pending
|
|
109
|
+
* `fixup!`/`squash!` commit into its target and reordering the todo accordingly; `false` passes
|
|
110
|
+
* `--no-autosquash`, explicitly overriding a `rebase.autosquash=true` git config (omitting the
|
|
111
|
+
* flag would let the config fold anyway); `undefined` passes neither, deferring to git config.
|
|
112
|
+
* `true` is mutually exclusive with {@link programmaticEditor}, which forces
|
|
113
|
+
* `rebase.autosquash=false` so its script-based editor sees a plain, natural-order todo —
|
|
114
|
+
* combining them is a programmer error; the CLI provider throws rather than silently dropping one.
|
|
115
|
+
*/
|
|
116
|
+
autosquash?: boolean;
|
|
107
117
|
/**
|
|
108
118
|
* Command git uses to edit per-commit messages (the combined message a `squash` produces, or a
|
|
109
119
|
* `reword`). Applied as `GIT_EDITOR` — which git's interactive-rebase `reword`/`squash` step honors,
|
|
@@ -15,6 +15,9 @@ export interface GitPausedOperationsSubProvider {
|
|
|
15
15
|
skip?: boolean;
|
|
16
16
|
/** Editor command used if the operation needs to edit a commit message (e.g. `true` to keep the original message without opening an editor) */
|
|
17
17
|
messageEditor?: string;
|
|
18
|
+
/** Extra environment for the git process, for `messageEditor` commands that need it (e.g. a
|
|
19
|
+
* wrapper script reading the real editor from the environment) */
|
|
20
|
+
editorEnv?: Record<string, string>;
|
|
18
21
|
},
|
|
19
22
|
): Promise<void>;
|
|
20
23
|
}
|
|
@@ -7,6 +7,7 @@ import type { GitConfigSubProvider } from './config.js';
|
|
|
7
7
|
import type { GitContributorsSubProvider } from './contributors.js';
|
|
8
8
|
import type { GitDiffSubProvider } from './diff.js';
|
|
9
9
|
import type { GitGraphSubProvider } from './graph.js';
|
|
10
|
+
import type { GitMaintenanceSubProvider } from './maintenance.js';
|
|
10
11
|
import type { GitOperationsSubProvider } from './operations.js';
|
|
11
12
|
import type { GitPatchSubProvider } from './patch.js';
|
|
12
13
|
import type { GitPausedOperationsSubProvider } from './pausedOperations.js';
|
|
@@ -53,6 +54,7 @@ export interface GitProvider {
|
|
|
53
54
|
readonly tags: GitTagsSubProvider;
|
|
54
55
|
|
|
55
56
|
readonly blame?: GitBlameSubProvider;
|
|
57
|
+
readonly maintenance?: GitMaintenanceSubProvider;
|
|
56
58
|
readonly ops?: GitOperationsSubProvider;
|
|
57
59
|
readonly patch?: GitPatchSubProvider;
|
|
58
60
|
readonly pausedOps?: GitPausedOperationsSubProvider;
|
|
@@ -25,4 +25,5 @@ export interface GitTagsSubProvider {
|
|
|
25
25
|
|
|
26
26
|
createTag?(repoPath: string, name: string, sha: string, message?: string): Promise<void>;
|
|
27
27
|
deleteTag?(repoPath: string, name: string): Promise<void>;
|
|
28
|
+
pushTag?(repoPath: string, name: string | string[], remote: string, options?: { force?: boolean }): Promise<void>;
|
|
28
29
|
}
|
|
@@ -49,6 +49,7 @@ export interface RepositoryService {
|
|
|
49
49
|
|
|
50
50
|
// Optional sub-providers
|
|
51
51
|
readonly blame?: SubProviderForRepo<NonNullable<GitProvider['blame']>>;
|
|
52
|
+
readonly maintenance?: SubProviderForRepo<NonNullable<GitProvider['maintenance']>>;
|
|
52
53
|
readonly ops?: SubProviderForRepo<NonNullable<GitProvider['ops']>>;
|
|
53
54
|
readonly patch?: SubProviderForRepo<NonNullable<GitProvider['patch']>>;
|
|
54
55
|
readonly pausedOps?: SubProviderForRepo<NonNullable<GitProvider['pausedOps']>>;
|
package/src/git/run.types.ts
CHANGED
|
@@ -90,6 +90,14 @@ export interface GitRunOptions {
|
|
|
90
90
|
priority?: GitCommandPriority;
|
|
91
91
|
/** Specifies that this command should always be executed locally if possible (for live share sessions) */
|
|
92
92
|
runLocally?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Marks a command GitLens issues as its OWN maintenance work (the Git Health auto pass, the
|
|
95
|
+
* commit-graph write, an explicit "Run Maintenance Now"). Such commands are legitimately slow by
|
|
96
|
+
* design, so they are excluded from the `onSlowCommand` health signal — otherwise our own
|
|
97
|
+
* optimization work becomes the evidence that recommends more of it. Matching on the git
|
|
98
|
+
* subcommand can't express this: the same `update-index`/`status` also serve real user work.
|
|
99
|
+
*/
|
|
100
|
+
selfMaintenance?: boolean;
|
|
93
101
|
|
|
94
102
|
/**
|
|
95
103
|
* If provided, cache the command's result (stdout, stderr, exitCode) in this store via an auto-generated cache key
|
package/src/git/service.ts
CHANGED
|
@@ -344,6 +344,9 @@ function createRepositoryService(
|
|
|
344
344
|
get blame() {
|
|
345
345
|
return getProxy('blame', provider.blame);
|
|
346
346
|
},
|
|
347
|
+
get maintenance() {
|
|
348
|
+
return getProxy('maintenance', provider.maintenance);
|
|
349
|
+
},
|
|
347
350
|
get ops() {
|
|
348
351
|
return getProxy('ops', provider.ops);
|
|
349
352
|
},
|
|
@@ -174,6 +174,11 @@ export function parseSearchQuery(search: SearchQuery, validate: boolean = false)
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
if (validate && operations.get('message:')?.size && operations.get('-message:')?.size) {
|
|
178
|
+
errors ??= [];
|
|
179
|
+
errors.push("Cannot combine 'message:' and '-message:' in the same query");
|
|
180
|
+
}
|
|
181
|
+
|
|
177
182
|
return {
|
|
178
183
|
operations: operations,
|
|
179
184
|
...(errors?.length && { errors: errors }),
|
|
@@ -232,6 +237,38 @@ export function parseSearchQueryGitCommand(
|
|
|
232
237
|
|
|
233
238
|
break;
|
|
234
239
|
|
|
240
|
+
case '-message:': {
|
|
241
|
+
// --invert-grep flips ALL --grep patterns in the command, so a query mixing positive
|
|
242
|
+
// message: terms with negative -message: terms can't be represented in one git invocation.
|
|
243
|
+
// parseSearchQuery's validate path rejects that combination up front; this is a defensive
|
|
244
|
+
// fallback for callers that skip validation -- drop the excluded terms rather than
|
|
245
|
+
// silently inverting the positive matches.
|
|
246
|
+
if (operations.get('message:')?.size) break;
|
|
247
|
+
|
|
248
|
+
let hasValue = false;
|
|
249
|
+
for (let value of values) {
|
|
250
|
+
if (!value) continue;
|
|
251
|
+
|
|
252
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
253
|
+
value = value.slice(1, -1);
|
|
254
|
+
if (!value) continue;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (search.matchWholeWord && search.matchRegex) {
|
|
258
|
+
value = `\\b${value}\\b`;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
searchArgs.add(`--grep=${value}`);
|
|
262
|
+
hasValue = true;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (hasValue) {
|
|
266
|
+
searchArgs.add('--invert-grep');
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
|
|
235
272
|
case 'author:':
|
|
236
273
|
for (let value of values) {
|
|
237
274
|
if (!value) continue;
|
|
@@ -260,6 +297,34 @@ export function parseSearchQueryGitCommand(
|
|
|
260
297
|
|
|
261
298
|
break;
|
|
262
299
|
|
|
300
|
+
case 'committer:':
|
|
301
|
+
for (let value of values) {
|
|
302
|
+
if (!value) continue;
|
|
303
|
+
|
|
304
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
305
|
+
value = value.slice(1, -1);
|
|
306
|
+
if (!value) continue;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (value === '@me') {
|
|
310
|
+
if (!currentUser?.name) continue;
|
|
311
|
+
|
|
312
|
+
value = currentUser.name;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (value.startsWith('@')) {
|
|
316
|
+
value = value.slice(1);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (search.matchWholeWord && search.matchRegex) {
|
|
320
|
+
value = `\\b${value}\\b`;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
searchArgs.add(`--committer=${value}`);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
break;
|
|
327
|
+
|
|
263
328
|
case 'type:':
|
|
264
329
|
for (let value of values) {
|
|
265
330
|
if (!value) continue;
|
|
@@ -276,6 +341,9 @@ export function parseSearchQueryGitCommand(
|
|
|
276
341
|
filters.type = 'tip';
|
|
277
342
|
} else if (value === 'wip') {
|
|
278
343
|
filters.type = 'wip';
|
|
344
|
+
} else if (value === 'merge') {
|
|
345
|
+
filters.type = 'merge';
|
|
346
|
+
searchArgs.add('--merges');
|
|
279
347
|
}
|
|
280
348
|
}
|
|
281
349
|
|
|
@@ -348,6 +416,10 @@ export function parseSearchQueryGitCommand(
|
|
|
348
416
|
if (!value) continue;
|
|
349
417
|
}
|
|
350
418
|
|
|
419
|
+
// A value starting with `-` would be consumed by git as an option rather than a ref
|
|
420
|
+
// (e.g. `ref:--author=x` injecting a flag), so drop it instead of passing it through
|
|
421
|
+
if (value.startsWith('-')) continue;
|
|
422
|
+
|
|
351
423
|
filters.refs = true;
|
|
352
424
|
// Replace --all with the specific ref or ref range
|
|
353
425
|
searchArgs.delete('--all');
|
|
@@ -358,8 +430,13 @@ export function parseSearchQueryGitCommand(
|
|
|
358
430
|
}
|
|
359
431
|
}
|
|
360
432
|
|
|
361
|
-
// Add regex/string matching flags if we have (--grep, --author) patterns
|
|
362
|
-
if (
|
|
433
|
+
// Add regex/string matching flags if we have (--grep, --author, --committer) patterns
|
|
434
|
+
if (
|
|
435
|
+
some(
|
|
436
|
+
searchArgs.values(),
|
|
437
|
+
arg => arg.startsWith('--grep=') || arg.startsWith('--author=') || arg.startsWith('--committer='),
|
|
438
|
+
)
|
|
439
|
+
) {
|
|
363
440
|
searchArgs.add(search.matchRegex ? '--extended-regexp' : '--fixed-strings');
|
|
364
441
|
if (search.matchRegex && !search.matchCase) {
|
|
365
442
|
searchArgs.add('--regexp-ignore-case');
|
|
@@ -404,6 +481,26 @@ export function parseSearchQueryGitHubCommand(
|
|
|
404
481
|
}
|
|
405
482
|
break;
|
|
406
483
|
|
|
484
|
+
case '-message:':
|
|
485
|
+
for (let value of values) {
|
|
486
|
+
if (!value) continue;
|
|
487
|
+
|
|
488
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
489
|
+
value = value.slice(1, -1);
|
|
490
|
+
if (!value) continue;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if (search.matchWholeWord && search.matchRegex) {
|
|
494
|
+
value = `\\b${value}\\b`;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// GitHub's search treats a leading '-' on a bare term as an exclusion, so unlike git's
|
|
498
|
+
// --invert-grep (which flips every --grep in the command), positive and negative message
|
|
499
|
+
// terms can coexist here -- no mixed-query guard needed for this degradation.
|
|
500
|
+
queryArgs.push(`-${value.replace(/ /g, '+')}`);
|
|
501
|
+
}
|
|
502
|
+
break;
|
|
503
|
+
|
|
407
504
|
case 'author:': {
|
|
408
505
|
for (let value of values) {
|
|
409
506
|
if (!value) continue;
|
|
@@ -414,14 +511,13 @@ export function parseSearchQueryGitHubCommand(
|
|
|
414
511
|
}
|
|
415
512
|
|
|
416
513
|
if (value === '@me') {
|
|
417
|
-
if (!currentUser?.
|
|
514
|
+
if (!currentUser?.username) continue;
|
|
418
515
|
|
|
419
516
|
value = `@${currentUser.username}`;
|
|
420
517
|
}
|
|
421
518
|
|
|
422
519
|
value = value.replace(/ /g, '+');
|
|
423
520
|
if (value.startsWith('@')) {
|
|
424
|
-
value = value.slice(1);
|
|
425
521
|
queryArgs.push(`author:${value.slice(1)}`);
|
|
426
522
|
} else if (value.includes('@')) {
|
|
427
523
|
queryArgs.push(`author-email:${value}`);
|
|
@@ -433,11 +529,39 @@ export function parseSearchQueryGitHubCommand(
|
|
|
433
529
|
break;
|
|
434
530
|
}
|
|
435
531
|
|
|
532
|
+
case 'committer:': {
|
|
533
|
+
for (let value of values) {
|
|
534
|
+
if (!value) continue;
|
|
535
|
+
|
|
536
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
537
|
+
value = value.slice(1, -1);
|
|
538
|
+
if (!value) continue;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
if (value === '@me') {
|
|
542
|
+
if (!currentUser?.username) continue;
|
|
543
|
+
|
|
544
|
+
value = `@${currentUser.username}`;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
value = value.replace(/ /g, '+');
|
|
548
|
+
if (value.startsWith('@')) {
|
|
549
|
+
queryArgs.push(`committer:${value.slice(1)}`);
|
|
550
|
+
} else if (value.includes('@')) {
|
|
551
|
+
queryArgs.push(`committer-email:${value}`);
|
|
552
|
+
} else {
|
|
553
|
+
queryArgs.push(`committer-name:${value}`);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
|
|
436
560
|
case 'type:':
|
|
437
561
|
case 'file:':
|
|
438
562
|
case 'change:':
|
|
439
563
|
case 'ref:':
|
|
440
|
-
// Not supported in GitHub search
|
|
564
|
+
// Not supported in GitHub search (type:'s values, including 'merge', have no GitHub commit-search equivalent)
|
|
441
565
|
break;
|
|
442
566
|
|
|
443
567
|
case 'after:':
|
|
@@ -2,6 +2,7 @@ import type { UnifiedDisposable } from '../../utils/disposable.js';
|
|
|
2
2
|
import type { Event } from '../../utils/event.js';
|
|
3
3
|
import { Emitter } from '../../utils/event.js';
|
|
4
4
|
import { isDescendant, relative } from '../../utils/path.js';
|
|
5
|
+
import type { ResourceUsage } from '../../utils/resourceUsage.js';
|
|
5
6
|
import type { GitDir, RepositoryChange } from '../models/repository.js';
|
|
6
7
|
import type { WatcherRepoChangeEvent } from './changeEvent.js';
|
|
7
8
|
import type { GitIgnoreFilter } from './gitIgnoreFilter.js';
|
|
@@ -228,6 +229,15 @@ export class RepositoryWatchService implements UnifiedDisposable {
|
|
|
228
229
|
return this.sessionMap.get(repoPath)?.session;
|
|
229
230
|
}
|
|
230
231
|
|
|
232
|
+
/** Resource usage retained by repository watchers. */
|
|
233
|
+
getResourceUsage(): ResourceUsage {
|
|
234
|
+
return {
|
|
235
|
+
'watch.sessions.count': this.sessionMap.size,
|
|
236
|
+
'watch.groups.count': this.watchGroups.size,
|
|
237
|
+
'watch.workingTreeWatchers.count': this.wtWatchers.size,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
231
241
|
/** Suspend all sessions and mark the service suspended so late-joining sessions start suspended */
|
|
232
242
|
suspendAll(): void {
|
|
233
243
|
this._suspended = true;
|