@gitkraken/core-gitlens 0.58.0 → 0.60.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 +20 -1
- package/dist/git/context.d.ts +1 -0
- package/dist/git/context.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.js +1 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/graph.d.ts +2 -1
- package/dist/git/models/graph.js.map +1 -1
- package/dist/git/models/graphSession.d.ts +8 -0
- package/dist/git/models/graphSession.js.map +1 -1
- package/dist/git/parsers/diffParser.js +1 -1
- package/dist/git/utils/hiddenRefs.utils.d.ts +26 -0
- package/dist/git/utils/hiddenRefs.utils.js +89 -0
- package/dist/git/utils/hiddenRefs.utils.js.map +1 -0
- package/dist/git/utils/search.utils.d.ts +3 -1
- package/dist/git/utils/search.utils.js +3 -1
- package/dist/git/utils/search.utils.js.map +1 -1
- package/dist/git-cli/exec/git.js +2 -1
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/locator.d.ts +2 -1
- package/dist/git-cli/exec/locator.js +11 -3
- package/dist/git-cli/exec/locator.js.map +1 -1
- package/dist/git-cli/parsers/blameParser.js +1 -1
- package/dist/git-cli/parsers/indexParser.js +1 -1
- package/dist/git-cli/parsers/statusParser.js +1 -1
- package/dist/git-cli/providers/branches.js +1 -1
- package/dist/git-cli/providers/commits.js +3 -2
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.js +2 -2
- package/dist/git-cli/providers/graph.d.ts +11 -1
- package/dist/git-cli/providers/graph.js +156 -38
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.js +1 -1
- package/dist/git-cli/providers/staging.js +1 -1
- package/dist/git-cli/providers/tags.js +1 -1
- package/dist/git-cli/service.js +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/integrations/index.d.ts +2 -1
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +7 -0
- package/dist/plus/integrations/integrationService.js +71 -8
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +6 -0
- package/dist/plus/integrations/models/azurePullRequestWrites.d.ts +3 -1
- package/dist/plus/integrations/models/gitlabIssueWrites.d.ts +86 -0
- package/dist/plus/integrations/models/gitlabIssueWrites.js +9 -0
- package/dist/plus/integrations/models/gitlabIssueWrites.js.map +1 -0
- package/dist/plus/integrations/models/integration.d.ts +1 -1
- package/dist/plus/integrations/models/integration.js +1 -1
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issueTrackerWrites.d.ts +12 -3
- package/dist/plus/integrations/models/publicIntegration.d.ts +1 -0
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +1 -1
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azurePullRequestWriteErrors.d.ts +6 -2
- package/dist/plus/integrations/providers/azurePullRequestWriteErrors.js +44 -10
- package/dist/plus/integrations/providers/azurePullRequestWriteErrors.js.map +1 -1
- package/dist/plus/integrations/providers/azurePullRequestWrites.d.ts +1 -0
- package/dist/plus/integrations/providers/azurePullRequestWrites.js +28 -13
- package/dist/plus/integrations/providers/azurePullRequestWrites.js.map +1 -1
- package/dist/plus/integrations/providers/github.js +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +4 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.js +4 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.d.ts +11 -0
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.js +73 -0
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab/issueWrites.d.ts +33 -0
- package/dist/plus/integrations/providers/gitlab/issueWrites.js +325 -0
- package/dist/plus/integrations/providers/gitlab/issueWrites.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab.d.ts +7 -1
- package/dist/plus/integrations/providers/gitlab.js +24 -0
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/providers/jira-server.d.ts +10 -0
- package/dist/plus/integrations/providers/jira-server.js +16 -1
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +6 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js +60 -11
- package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -1
- package/dist/plus/integrations/providers/providerApiClient.js +6 -2
- package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +3 -0
- package/dist/plus/integrations/providers/providersApi.js +13 -0
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +1 -1
- package/dist/plus/integrations/reads/currentAccount.js +1 -1
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +1 -0
- package/dist/plus/integrations/reads/issueTracker.js +4 -1
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/docs/integrations.md +65 -5
- package/docs/kepler-read-api-parity.md +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.60.0] - 2026-12-01
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Adds GitLab.com issue write discovery, creation, title and description editing, close, reopen, and permanent deletion to `IntegrationManager`. The API uses the selected account's effective permissions and verifies the canonical project and issue identities before dispatch (plus/integrations) ([#6261](https://github.com/gitkraken/vscode-gitlens/issues/6261), [#6433](https://github.com/gitkraken/vscode-gitlens/pull/6433), [gitkraken/kepler#5427](https://github.com/gitkraken/kepler/issues/5427))
|
|
14
|
+
|
|
15
|
+
## [0.59.0] - 2026-12-01
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Adds Jira Data Center issue write options and create, edit, transition, and delete operations to `IntegrationManager`. Writes verify the configured connection, full installation URL, account, and canonical project and issue identities. The API discovers required fields and workflow transitions, reports refused or unconfirmed writes, and uses the installation's current account (plus/integrations) ([#6272](https://github.com/gitkraken/vscode-gitlens/issues/6272), [#6427](https://github.com/gitkraken/vscode-gitlens/pull/6427), [gitkraken/kepler#5438](https://github.com/gitkraken/kepler/issues/5438))
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Preserves redacted provider validation messages in Azure DevOps Services and Server pull request write failures, distinguishes explicit missing-scope responses from permission failures, and identifies required-reviewer policy refusals without changing the existing policy reason (plus/integrations) ([#6385](https://github.com/gitkraken/vscode-gitlens/issues/6385))
|
|
24
|
+
- Fixes `isGitUnanswered` reading a failed git lookup as git's answer: when the locator rejected with `UnableToFindGitError` or `InvalidGitConfigError`, a repository lookup answered "not a repository" and the untrusted bare clone check was skipped. Both errors now count as no answer from git, so callers reject rather than remember a wrong answer (git-cli)
|
|
25
|
+
|
|
9
26
|
## [0.58.0] - 2026-11-30
|
|
10
27
|
|
|
11
28
|
### Added
|
|
@@ -1526,7 +1543,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
1526
1543
|
|
|
1527
1544
|
- Initial release. Bundles `@gitlens/utils`, `@gitlens/git`, `@gitlens/git-cli`, `@gitlens/ai`, and `@gitlens/git-github` into a single core npm package with subpath exports.
|
|
1528
1545
|
|
|
1529
|
-
[unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.
|
|
1546
|
+
[unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.60.0...HEAD
|
|
1547
|
+
[0.60.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.59.0..releases/core/v0.60.0
|
|
1548
|
+
[0.59.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.58.0..releases/core/v0.59.0
|
|
1530
1549
|
[0.58.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.57.0...gitkraken:releases/core/v0.58.0
|
|
1531
1550
|
[0.57.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.56.1...gitkraken:releases/core/v0.57.0
|
|
1532
1551
|
[0.56.1]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.56.0...gitkraken:releases/core/v0.56.1
|
package/dist/git/context.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ export interface GitServiceConfig {
|
|
|
89
89
|
/** Maximum search items (0 = unlimited). */
|
|
90
90
|
readonly maxSearchItems?: number;
|
|
91
91
|
};
|
|
92
|
+
readonly hiddenRefPatterns?: Readonly<Record<string, boolean>>;
|
|
92
93
|
/** Auto-tier git-optimization (maintenance) preferences. */
|
|
93
94
|
readonly maintenance?: {
|
|
94
95
|
/** Master switch for the auto-tier optimizations (maps to `gitlens.gitOptimizations.enabled`). Defaults to `true`. */
|
package/dist/git/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":[],"sources":["../../../git/src/context.ts"],"sourcesContent":["import type { Event } from '@gitlens/utils/event.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport type { CachedGitTypes } from './cache.js';\nimport type { SigningErrorReason } from './errors.js';\nimport type { GitRemote } from './models/remote.js';\nimport type { RemoteProvider, RemoteProviderId } from './models/remoteProvider.js';\nimport type { RepositoryChange } from './models/repository.js';\nimport type { SearchQuery } from './models/search.js';\nimport type { SigningFormat } from './models/signature.js';\nimport type { GitConflictFile } from './models/staging.js';\nimport type { RemoteProviderConfig } from './remotes/matcher.js';\n\n/**\n * Context provided to sub-providers at construction time.\n * Replaces the Container dependency in the GitLens extension.\n *\n * This is intentionally minimal — most configuration is passed as explicit\n * per-call options on sub-provider methods, not hidden in a context object.\n */\nexport interface GitServiceContext {\n\t/**\n\t * Provides default values for sub-provider options when callers omit them.\n\t * If not provided, sub-providers use their own built-in defaults.\n\t */\n\treadonly config?: GitServiceConfig;\n\t/** File system abstraction for reading files, checking stats, and listing directories. */\n\treadonly fs: FileSystemProvider;\n\t/** Outbound hooks for events from library to host */\n\treadonly hooks?: GitServiceHooks;\n\t/** Host-side remote capabilities (custom providers, sorting, repo info) */\n\treadonly remotes?: RemotesProvider;\n\t/** Search query preprocessing hooks (e.g., NLP → structured search). */\n\treadonly searchQuery?: SearchQueryProvider;\n\t/** Workspace environment (folder resolution, trust state) */\n\treadonly workspace?: WorkspaceProvider;\n}\n\n/**\n * Provides default values for sub-provider options when callers omit them.\n *\n * Consumers implement this backed by their own config system (e.g., VS Code settings).\n * Properties are getters so values are read fresh each time — consumers can make them\n * reactive to config changes.\n *\n * Library sub-providers check `context.config?.{property}` when the caller doesn't\n * pass the corresponding option, falling back to sensible built-in defaults if the\n * config provider is also absent.\n */\nexport interface GitServiceConfig {\n\treadonly commits: {\n\t\t/**\n\t\t * Whether commit/stash queries include per-commit file details by default, resolved per\n\t\t * repository so a host can defer them where loading them has proven slow.\n\t\t */\n\t\treadonly includeFileDetails?: (repoPath: string) => boolean;\n\t\t/** Default commit ordering for log/branch queries (e.g., `'date'`, `'author-date'`, `'topo'`). */\n\t\treadonly ordering?: 'date' | 'author-date' | 'topo' | null;\n\t\t/** Default maximum items for operations (0 = unlimited). */\n\t\treadonly maxItems?: number;\n\t\t/** Similarity threshold for rename detection (0–100). `null` uses Git's default. */\n\t\treadonly similarityThreshold?: number | null;\n\t};\n\n\t/** File-history–specific defaults for `getLogForPath`. */\n\treadonly fileHistory?: {\n\t\t/** Whether to show commits from all branches (maps to `--all`). */\n\t\treadonly showAllBranches?: boolean;\n\t\t/** Whether to include merge commits (maps to `--no-merges` when false). */\n\t\treadonly showMergeCommits?: boolean;\n\t\t/** Whether to follow renames (maps to `--follow`). */\n\t\treadonly followRenames?: boolean;\n\t};\n\n\t/** Search-specific defaults for `searchCommits`. */\n\treadonly search?: {\n\t\t/** Default maximum items for search results (0 = unlimited). */\n\t\treadonly maxItems?: number;\n\t};\n\n\t/** Graph-specific configuration defaults. */\n\treadonly graph?: {\n\t\t/** Whether to keep git's commit-graph file up to date in the background after graph loads —\n\t\t * written when missing, periodically refreshed to cover new commits (accelerates ordered\n\t\t * history walks — the graph's initial load). Fed from the master switch\n\t\t * (`gitlens.gitOptimizations.enabled`); `false` disables the background write. */\n\t\treadonly writeCommitGraph?: boolean;\n\t\t/** Graph commit ordering (falls back to `commits.ordering` or `'date'`). */\n\t\treadonly commitOrdering?: 'date' | 'author-date' | 'topo';\n\t\t/** Whether to only follow first parent in graph. */\n\t\treadonly onlyFollowFirstParent?: boolean;\n\t\t/** Whether to use avatars in graph. */\n\t\treadonly avatars?: boolean;\n\t\t/** Maximum search items (0 = unlimited). */\n\t\treadonly maxSearchItems?: number;\n\t};\n\n\t/** Auto-tier git-optimization (maintenance) preferences. */\n\treadonly maintenance?: {\n\t\t/** Master switch for the auto-tier optimizations (maps to `gitlens.gitOptimizations.enabled`). Defaults to `true`. */\n\t\treadonly enabled?: boolean;\n\t};\n\n\t/** Force-push preferences. */\n\treadonly push?: {\n\t\t/** Whether to use `--force-with-lease` instead of a plain `--force` when force-pushing. Defaults to `true`. */\n\t\treadonly useForceWithLease?: boolean;\n\t\t/**\n\t\t * Whether to add `--force-if-includes` when force-pushing. Only applies when `useForceWithLease` is `true`\n\t\t * and the installed Git supports it. Defaults to `true`.\n\t\t */\n\t\treadonly useForceIfIncludes?: boolean;\n\t};\n\n\t/** Commit-signing preferences. */\n\treadonly signing?: {\n\t\t/**\n\t\t * Host-level override for whether commit signing is enabled (e.g. VS Code's `git.enableCommitSigning`).\n\t\t * When `true`, signing is treated as enabled even if the repo's `commit.gpgsign` is unset/false. It never\n\t\t * forces signing off.\n\t\t */\n\t\treadonly enabled?: boolean;\n\t};\n}\n\n/** Git command types that can produce conflicts. */\nexport type GitConflictCommand = 'merge' | 'rebase' | 'cherry-pick' | 'revert' | 'stash-apply' | 'stash-pop';\n\n/**\n * Hooks for outbound events from library to host.\n *\n * All hooks are optional — the library calls them when events occur,\n * and the host decides what to do (telemetry, logging, UI updates, etc.).\n *\n * Provider-augmented hooks (`cache`, `repository`) are wired by the provider\n * to its emitters at construction time. Pass-through hooks (`commits`,\n * `operations`) are provided by the host and forwarded unchanged.\n */\nexport interface GitServiceHooks {\n\t/** Cache lifecycle hooks — wired by the provider to its cache-reset emitter */\n\treadonly cache?: {\n\t\t/**\n\t\t * Called after the provider changed repository state (a typed write, or `notifyChanged`). The provider\n\t\t * has already cleared its own caches for those types and the repository's pending commands (its sibling\n\t\t * worktrees included); the handler only needs to update host-side state. Forwarding to\n\t\t * `Cache.clearCaches` as well is redundant but harmless.\n\t\t */\n\t\tonReset?(repoPath: string, ...types: CachedGitTypes[]): void;\n\t};\n\t/** Repository state hooks — wired by the provider to its repository-changed emitter */\n\treadonly repository?: {\n\t\t/**\n\t\t * Called when repository state has changed.\n\t\t *\n\t\t * `refs`, when given, are the full ref names (`refs/heads/main`, `refs/remotes/origin/main`) the write\n\t\t * created, moved or deleted. A ref kind in `changes` (`heads`, `remotes`, `tags`, `stash`) with at least\n\t\t * one name of its kind in `refs` is fully described by those names: no other ref of that kind moved. A ref\n\t\t * kind in `changes` with no name in `refs` stays unnamed — any ref of that kind may have moved. A host that\n\t\t * ignores `refs` treats every ref kind as unnamed, as before.\n\t\t *\n\t\t * `options.configConfinedToRefs`, given only with `config` among `changes`, says the write changed\n\t\t * `.git/config` only in the `branch.<name>` sections of the local branches `refs` names (`refs/heads/<name>`),\n\t\t * as a branch create, delete, rename or upstream change does. A branch's section matters only to a checkout on\n\t\t * that branch or one whose upstream or base is that branch, so the config change concerns exactly the\n\t\t * checkouts following those branches. Without it, the config change may be anywhere in the file, whatever\n\t\t * `refs` names. A host that ignores it treats every config change as unconfined, as before.\n\t\t */\n\t\tonChanged?(\n\t\t\trepoPath: string,\n\t\t\tchanges: RepositoryChange[],\n\t\t\trefs?: readonly string[],\n\t\t\toptions?: { readonly configConfinedToRefs?: boolean },\n\t\t): void;\n\t};\n\t/** Commit lifecycle hooks */\n\treadonly commits?: {\n\t\t/**\n\t\t * Called when a commit is signed successfully.\n\t\t *\n\t\t * Note: currently fired only from explicit-sign paths — the patch provider's\n\t\t * `commit-tree -S` and the commit operation when the host signing override\n\t\t * (`config.signing.enabled`) adds `-S`. Operations that sign implicitly via\n\t\t * `commit.gpgsign=true` (`commit` without the override, `merge`, `pull`,\n\t\t * `rebase`, `revert`, `cherryPick`) do not fire this hook because the\n\t\t * library cannot cheaply confirm that signing actually occurred without an\n\t\t * extra `git config`/`log --show-signature` call.\n\t\t */\n\t\tonSigned?(format: SigningFormat, source?: unknown): void;\n\t\t/** Called when commit signing fails — fired from all signing-capable paths. */\n\t\tonSigningFailed?(reason: SigningErrorReason, format: SigningFormat, source?: unknown): void;\n\t};\n\t/** Git operation hooks */\n\treadonly operations?: {\n\t\t/**\n\t\t * Called when a git command produced a conflict.\n\t\t * @param conflicts Optional conflicted file list. Populated for merge/rebase/cherry-pick/revert;\n\t\t * may be absent for stash operations or when the file list couldn't be read.\n\t\t */\n\t\tonConflicted?(command: GitConflictCommand, conflicts?: GitConflictFile[]): void;\n\t\t/** Called when getGitDir resolves to a non-existent .git directory or rev-parse fails */\n\t\tonGitDirResolveFailed?(repoPath: string, gitDir: string, errorMessage: string): void;\n\t\t/**\n\t\t * Called when a git operation that can start a rebase begins (`'started'`, before the\n\t\t * process runs) and again when the command exits (`'ended'`, on success and failure alike).\n\t\t * Fired at start (not from the result) because `git rebase` exits 0 when stopping at\n\t\t * `edit`/`break`, and fired for every pull because `pull.rebase=true` config can start\n\t\t * a rebase the host can't predict from the arguments. The `'ended'` phase lets the host\n\t\t * check whether the operation actually left a rebase in progress.\n\t\t * @param repoPath The path the rebase state will appear under (the worktree path for\n\t\t * worktree-targeted pulls)\n\t\t */\n\t\tonRebaseCapableOperation?(repoPath: string, command: 'rebase' | 'pull', phase: 'started' | 'ended'): void;\n\t};\n}\n\n/**\n * Host-provided context attached to remote providers at construction time.\n * Subset of {@link RemotesProvider} — only the fields individual providers need.\n */\nexport interface RemoteProviderContext {\n\t/** Returns repository info (e.g., ID) from the host's integration system */\n\treadonly getRepositoryInfo?: (\n\t\tproviderId: RemoteProviderId,\n\t\ttarget: { owner: string; name: string; project?: string },\n\t) => Promise<{ id: string } | undefined>;\n}\n\n/**\n * File system abstraction following the `workspace.fs` model.\n *\n * Hosts provide an implementation backed by their platform:\n * - Desktop (Node.js): wraps `workspace.fs` or `fs/promises`\n * - Browser: wraps `workspace.fs` for virtual file systems\n *\n * Used by sub-providers that need file system access without\n * importing Node.js `fs` or VS Code APIs directly.\n */\nexport interface FileStat {\n\ttype: number;\n\tctime: number;\n\tmtime: number;\n\tsize: number;\n}\n\n/**\n * File type bitmask matching `vscode.FileType`.\n * Values can be combined (e.g., `FileType.File | FileType.SymbolicLink`).\n */\nexport const FileType = {\n\tUnknown: 0,\n\tFile: 1,\n\tDirectory: 2,\n\tSymbolicLink: 64,\n} as const;\nexport type FileType = (typeof FileType)[keyof typeof FileType];\n\nexport interface FileSystemProvider {\n\treadDirectory(uri: Uri): Promise<[string, number][]>;\n\treadFile(uri: Uri): Promise<Uint8Array>;\n\tstat(uri: Uri): Promise<FileStat | undefined>;\n}\n\n/**\n * Host-side remote capabilities: custom provider configs, sorting, and repository info.\n *\n * The host provides extra provider configs (user custom remotes, cloud self-managed hosts)\n * and the library combines them with built-in providers to build a matcher.\n * Sorting lets the host control remote priority (integration metadata, user preferences).\n * Repository info enables cross-fork PR URLs via integration API lookups.\n */\nexport interface RemotesProvider {\n\t/**\n\t * Returns extra remote provider configurations beyond built-ins.\n\t * Includes user-configured custom remotes (from settings) and\n\t * cloud self-managed host integrations.\n\t */\n\tgetCustomProviders?(repoPath: string): Promise<RemoteProviderConfig[] | undefined>;\n\n\t/**\n\t * Returns repository info from the host's integration system.\n\t * Used by remote providers for cross-fork PR creation URLs.\n\t * Returns `undefined` if no integration is available or connected.\n\t */\n\tgetRepositoryInfo?(\n\t\tproviderId: RemoteProviderId,\n\t\ttarget: { owner: string; name: string; project?: string },\n\t): Promise<{ id: string } | undefined>;\n\n\t/**\n\t * Sorts remotes by priority. The host owns the full ranking policy\n\t * (remote name heuristics, integration metadata, user preferences).\n\t * If not provided, the library returns remotes in their original order.\n\t */\n\tsort?(remotes: GitRemote<RemoteProvider>[], cancellation?: AbortSignal): Promise<GitRemote<RemoteProvider>[]>;\n}\n\n/**\n * Provides search query preprocessing.\n *\n * Hosts implement this to add capabilities like NLP → structured search\n * conversion before the library executes the query.\n */\nexport interface SearchQueryProvider {\n\t/**\n\t * Pre-processes a search query before execution (e.g., converts natural language to structured search).\n\t * Called by commits sub-provider before executing `searchCommits`.\n\t */\n\tpreprocessQuery?(search: SearchQuery, source?: unknown): Promise<SearchQuery>;\n}\n\n/**\n * Provides workspace environment info: folder resolution and trust state.\n * Used by sub-providers for workspace folder lookup and to gate operations\n * in untrusted workspaces.\n *\n * When `isTrusted` is absent, the workspace is assumed trusted. A host serving several repositories that\n * needs a verdict per repository leaves it absent and supplies the git executor's per-path\n * `gitOptions.isTrusted` instead; a set `isTrusted` here wins and answers for every path.\n */\nexport interface WorkspaceProvider {\n\t/** Fires when the workspace trust state changes (e.g., user grants trust) */\n\treadonly onDidChangeTrust?: Event<boolean>;\n\n\t/** Whether the workspace is currently trusted */\n\treadonly isTrusted?: boolean;\n\n\t/** Resolves the workspace folder that contains the given repoPath */\n\tgetFolder(repoPath: string): { path: string } | undefined;\n\n\t/** Returns the default URI for new worktrees, given a repository path. */\n\tgetWorktreeDefaultUri?(repoPath: string): Uri | undefined;\n}\n"],"mappings":";;;;;AAuPA,MAAa,WAAW;CACvB,SAAS;CACT,MAAM;CACN,WAAW;CACX,cAAc;AACf"}
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../../git/src/context.ts"],"sourcesContent":["import type { Event } from '@gitlens/utils/event.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport type { CachedGitTypes } from './cache.js';\nimport type { SigningErrorReason } from './errors.js';\nimport type { GitRemote } from './models/remote.js';\nimport type { RemoteProvider, RemoteProviderId } from './models/remoteProvider.js';\nimport type { RepositoryChange } from './models/repository.js';\nimport type { SearchQuery } from './models/search.js';\nimport type { SigningFormat } from './models/signature.js';\nimport type { GitConflictFile } from './models/staging.js';\nimport type { RemoteProviderConfig } from './remotes/matcher.js';\n\n/**\n * Context provided to sub-providers at construction time.\n * Replaces the Container dependency in the GitLens extension.\n *\n * This is intentionally minimal — most configuration is passed as explicit\n * per-call options on sub-provider methods, not hidden in a context object.\n */\nexport interface GitServiceContext {\n\t/**\n\t * Provides default values for sub-provider options when callers omit them.\n\t * If not provided, sub-providers use their own built-in defaults.\n\t */\n\treadonly config?: GitServiceConfig;\n\t/** File system abstraction for reading files, checking stats, and listing directories. */\n\treadonly fs: FileSystemProvider;\n\t/** Outbound hooks for events from library to host */\n\treadonly hooks?: GitServiceHooks;\n\t/** Host-side remote capabilities (custom providers, sorting, repo info) */\n\treadonly remotes?: RemotesProvider;\n\t/** Search query preprocessing hooks (e.g., NLP → structured search). */\n\treadonly searchQuery?: SearchQueryProvider;\n\t/** Workspace environment (folder resolution, trust state) */\n\treadonly workspace?: WorkspaceProvider;\n}\n\n/**\n * Provides default values for sub-provider options when callers omit them.\n *\n * Consumers implement this backed by their own config system (e.g., VS Code settings).\n * Properties are getters so values are read fresh each time — consumers can make them\n * reactive to config changes.\n *\n * Library sub-providers check `context.config?.{property}` when the caller doesn't\n * pass the corresponding option, falling back to sensible built-in defaults if the\n * config provider is also absent.\n */\nexport interface GitServiceConfig {\n\treadonly commits: {\n\t\t/**\n\t\t * Whether commit/stash queries include per-commit file details by default, resolved per\n\t\t * repository so a host can defer them where loading them has proven slow.\n\t\t */\n\t\treadonly includeFileDetails?: (repoPath: string) => boolean;\n\t\t/** Default commit ordering for log/branch queries (e.g., `'date'`, `'author-date'`, `'topo'`). */\n\t\treadonly ordering?: 'date' | 'author-date' | 'topo' | null;\n\t\t/** Default maximum items for operations (0 = unlimited). */\n\t\treadonly maxItems?: number;\n\t\t/** Similarity threshold for rename detection (0–100). `null` uses Git's default. */\n\t\treadonly similarityThreshold?: number | null;\n\t};\n\n\t/** File-history–specific defaults for `getLogForPath`. */\n\treadonly fileHistory?: {\n\t\t/** Whether to show commits from all branches (maps to `--all`). */\n\t\treadonly showAllBranches?: boolean;\n\t\t/** Whether to include merge commits (maps to `--no-merges` when false). */\n\t\treadonly showMergeCommits?: boolean;\n\t\t/** Whether to follow renames (maps to `--follow`). */\n\t\treadonly followRenames?: boolean;\n\t};\n\n\t/** Search-specific defaults for `searchCommits`. */\n\treadonly search?: {\n\t\t/** Default maximum items for search results (0 = unlimited). */\n\t\treadonly maxItems?: number;\n\t};\n\n\t/** Graph-specific configuration defaults. */\n\treadonly graph?: {\n\t\t/** Whether to keep git's commit-graph file up to date in the background after graph loads —\n\t\t * written when missing, periodically refreshed to cover new commits (accelerates ordered\n\t\t * history walks — the graph's initial load). Fed from the master switch\n\t\t * (`gitlens.gitOptimizations.enabled`); `false` disables the background write. */\n\t\treadonly writeCommitGraph?: boolean;\n\t\t/** Graph commit ordering (falls back to `commits.ordering` or `'date'`). */\n\t\treadonly commitOrdering?: 'date' | 'author-date' | 'topo';\n\t\t/** Whether to only follow first parent in graph. */\n\t\treadonly onlyFollowFirstParent?: boolean;\n\t\t/** Whether to use avatars in graph. */\n\t\treadonly avatars?: boolean;\n\t\t/** Maximum search items (0 = unlimited). */\n\t\treadonly maxSearchItems?: number;\n\t};\n\n\treadonly hiddenRefPatterns?: Readonly<Record<string, boolean>>;\n\n\t/** Auto-tier git-optimization (maintenance) preferences. */\n\treadonly maintenance?: {\n\t\t/** Master switch for the auto-tier optimizations (maps to `gitlens.gitOptimizations.enabled`). Defaults to `true`. */\n\t\treadonly enabled?: boolean;\n\t};\n\n\t/** Force-push preferences. */\n\treadonly push?: {\n\t\t/** Whether to use `--force-with-lease` instead of a plain `--force` when force-pushing. Defaults to `true`. */\n\t\treadonly useForceWithLease?: boolean;\n\t\t/**\n\t\t * Whether to add `--force-if-includes` when force-pushing. Only applies when `useForceWithLease` is `true`\n\t\t * and the installed Git supports it. Defaults to `true`.\n\t\t */\n\t\treadonly useForceIfIncludes?: boolean;\n\t};\n\n\t/** Commit-signing preferences. */\n\treadonly signing?: {\n\t\t/**\n\t\t * Host-level override for whether commit signing is enabled (e.g. VS Code's `git.enableCommitSigning`).\n\t\t * When `true`, signing is treated as enabled even if the repo's `commit.gpgsign` is unset/false. It never\n\t\t * forces signing off.\n\t\t */\n\t\treadonly enabled?: boolean;\n\t};\n}\n\n/** Git command types that can produce conflicts. */\nexport type GitConflictCommand = 'merge' | 'rebase' | 'cherry-pick' | 'revert' | 'stash-apply' | 'stash-pop';\n\n/**\n * Hooks for outbound events from library to host.\n *\n * All hooks are optional — the library calls them when events occur,\n * and the host decides what to do (telemetry, logging, UI updates, etc.).\n *\n * Provider-augmented hooks (`cache`, `repository`) are wired by the provider\n * to its emitters at construction time. Pass-through hooks (`commits`,\n * `operations`) are provided by the host and forwarded unchanged.\n */\nexport interface GitServiceHooks {\n\t/** Cache lifecycle hooks — wired by the provider to its cache-reset emitter */\n\treadonly cache?: {\n\t\t/**\n\t\t * Called after the provider changed repository state (a typed write, or `notifyChanged`). The provider\n\t\t * has already cleared its own caches for those types and the repository's pending commands (its sibling\n\t\t * worktrees included); the handler only needs to update host-side state. Forwarding to\n\t\t * `Cache.clearCaches` as well is redundant but harmless.\n\t\t */\n\t\tonReset?(repoPath: string, ...types: CachedGitTypes[]): void;\n\t};\n\t/** Repository state hooks — wired by the provider to its repository-changed emitter */\n\treadonly repository?: {\n\t\t/**\n\t\t * Called when repository state has changed.\n\t\t *\n\t\t * `refs`, when given, are the full ref names (`refs/heads/main`, `refs/remotes/origin/main`) the write\n\t\t * created, moved or deleted. A ref kind in `changes` (`heads`, `remotes`, `tags`, `stash`) with at least\n\t\t * one name of its kind in `refs` is fully described by those names: no other ref of that kind moved. A ref\n\t\t * kind in `changes` with no name in `refs` stays unnamed — any ref of that kind may have moved. A host that\n\t\t * ignores `refs` treats every ref kind as unnamed, as before.\n\t\t *\n\t\t * `options.configConfinedToRefs`, given only with `config` among `changes`, says the write changed\n\t\t * `.git/config` only in the `branch.<name>` sections of the local branches `refs` names (`refs/heads/<name>`),\n\t\t * as a branch create, delete, rename or upstream change does. A branch's section matters only to a checkout on\n\t\t * that branch or one whose upstream or base is that branch, so the config change concerns exactly the\n\t\t * checkouts following those branches. Without it, the config change may be anywhere in the file, whatever\n\t\t * `refs` names. A host that ignores it treats every config change as unconfined, as before.\n\t\t */\n\t\tonChanged?(\n\t\t\trepoPath: string,\n\t\t\tchanges: RepositoryChange[],\n\t\t\trefs?: readonly string[],\n\t\t\toptions?: { readonly configConfinedToRefs?: boolean },\n\t\t): void;\n\t};\n\t/** Commit lifecycle hooks */\n\treadonly commits?: {\n\t\t/**\n\t\t * Called when a commit is signed successfully.\n\t\t *\n\t\t * Note: currently fired only from explicit-sign paths — the patch provider's\n\t\t * `commit-tree -S` and the commit operation when the host signing override\n\t\t * (`config.signing.enabled`) adds `-S`. Operations that sign implicitly via\n\t\t * `commit.gpgsign=true` (`commit` without the override, `merge`, `pull`,\n\t\t * `rebase`, `revert`, `cherryPick`) do not fire this hook because the\n\t\t * library cannot cheaply confirm that signing actually occurred without an\n\t\t * extra `git config`/`log --show-signature` call.\n\t\t */\n\t\tonSigned?(format: SigningFormat, source?: unknown): void;\n\t\t/** Called when commit signing fails — fired from all signing-capable paths. */\n\t\tonSigningFailed?(reason: SigningErrorReason, format: SigningFormat, source?: unknown): void;\n\t};\n\t/** Git operation hooks */\n\treadonly operations?: {\n\t\t/**\n\t\t * Called when a git command produced a conflict.\n\t\t * @param conflicts Optional conflicted file list. Populated for merge/rebase/cherry-pick/revert;\n\t\t * may be absent for stash operations or when the file list couldn't be read.\n\t\t */\n\t\tonConflicted?(command: GitConflictCommand, conflicts?: GitConflictFile[]): void;\n\t\t/** Called when getGitDir resolves to a non-existent .git directory or rev-parse fails */\n\t\tonGitDirResolveFailed?(repoPath: string, gitDir: string, errorMessage: string): void;\n\t\t/**\n\t\t * Called when a git operation that can start a rebase begins (`'started'`, before the\n\t\t * process runs) and again when the command exits (`'ended'`, on success and failure alike).\n\t\t * Fired at start (not from the result) because `git rebase` exits 0 when stopping at\n\t\t * `edit`/`break`, and fired for every pull because `pull.rebase=true` config can start\n\t\t * a rebase the host can't predict from the arguments. The `'ended'` phase lets the host\n\t\t * check whether the operation actually left a rebase in progress.\n\t\t * @param repoPath The path the rebase state will appear under (the worktree path for\n\t\t * worktree-targeted pulls)\n\t\t */\n\t\tonRebaseCapableOperation?(repoPath: string, command: 'rebase' | 'pull', phase: 'started' | 'ended'): void;\n\t};\n}\n\n/**\n * Host-provided context attached to remote providers at construction time.\n * Subset of {@link RemotesProvider} — only the fields individual providers need.\n */\nexport interface RemoteProviderContext {\n\t/** Returns repository info (e.g., ID) from the host's integration system */\n\treadonly getRepositoryInfo?: (\n\t\tproviderId: RemoteProviderId,\n\t\ttarget: { owner: string; name: string; project?: string },\n\t) => Promise<{ id: string } | undefined>;\n}\n\n/**\n * File system abstraction following the `workspace.fs` model.\n *\n * Hosts provide an implementation backed by their platform:\n * - Desktop (Node.js): wraps `workspace.fs` or `fs/promises`\n * - Browser: wraps `workspace.fs` for virtual file systems\n *\n * Used by sub-providers that need file system access without\n * importing Node.js `fs` or VS Code APIs directly.\n */\nexport interface FileStat {\n\ttype: number;\n\tctime: number;\n\tmtime: number;\n\tsize: number;\n}\n\n/**\n * File type bitmask matching `vscode.FileType`.\n * Values can be combined (e.g., `FileType.File | FileType.SymbolicLink`).\n */\nexport const FileType = {\n\tUnknown: 0,\n\tFile: 1,\n\tDirectory: 2,\n\tSymbolicLink: 64,\n} as const;\nexport type FileType = (typeof FileType)[keyof typeof FileType];\n\nexport interface FileSystemProvider {\n\treadDirectory(uri: Uri): Promise<[string, number][]>;\n\treadFile(uri: Uri): Promise<Uint8Array>;\n\tstat(uri: Uri): Promise<FileStat | undefined>;\n}\n\n/**\n * Host-side remote capabilities: custom provider configs, sorting, and repository info.\n *\n * The host provides extra provider configs (user custom remotes, cloud self-managed hosts)\n * and the library combines them with built-in providers to build a matcher.\n * Sorting lets the host control remote priority (integration metadata, user preferences).\n * Repository info enables cross-fork PR URLs via integration API lookups.\n */\nexport interface RemotesProvider {\n\t/**\n\t * Returns extra remote provider configurations beyond built-ins.\n\t * Includes user-configured custom remotes (from settings) and\n\t * cloud self-managed host integrations.\n\t */\n\tgetCustomProviders?(repoPath: string): Promise<RemoteProviderConfig[] | undefined>;\n\n\t/**\n\t * Returns repository info from the host's integration system.\n\t * Used by remote providers for cross-fork PR creation URLs.\n\t * Returns `undefined` if no integration is available or connected.\n\t */\n\tgetRepositoryInfo?(\n\t\tproviderId: RemoteProviderId,\n\t\ttarget: { owner: string; name: string; project?: string },\n\t): Promise<{ id: string } | undefined>;\n\n\t/**\n\t * Sorts remotes by priority. The host owns the full ranking policy\n\t * (remote name heuristics, integration metadata, user preferences).\n\t * If not provided, the library returns remotes in their original order.\n\t */\n\tsort?(remotes: GitRemote<RemoteProvider>[], cancellation?: AbortSignal): Promise<GitRemote<RemoteProvider>[]>;\n}\n\n/**\n * Provides search query preprocessing.\n *\n * Hosts implement this to add capabilities like NLP → structured search\n * conversion before the library executes the query.\n */\nexport interface SearchQueryProvider {\n\t/**\n\t * Pre-processes a search query before execution (e.g., converts natural language to structured search).\n\t * Called by commits sub-provider before executing `searchCommits`.\n\t */\n\tpreprocessQuery?(search: SearchQuery, source?: unknown): Promise<SearchQuery>;\n}\n\n/**\n * Provides workspace environment info: folder resolution and trust state.\n * Used by sub-providers for workspace folder lookup and to gate operations\n * in untrusted workspaces.\n *\n * When `isTrusted` is absent, the workspace is assumed trusted. A host serving several repositories that\n * needs a verdict per repository leaves it absent and supplies the git executor's per-path\n * `gitOptions.isTrusted` instead; a set `isTrusted` here wins and answers for every path.\n */\nexport interface WorkspaceProvider {\n\t/** Fires when the workspace trust state changes (e.g., user grants trust) */\n\treadonly onDidChangeTrust?: Event<boolean>;\n\n\t/** Whether the workspace is currently trusted */\n\treadonly isTrusted?: boolean;\n\n\t/** Resolves the workspace folder that contains the given repoPath */\n\tgetFolder(repoPath: string): { path: string } | undefined;\n\n\t/** Returns the default URI for new worktrees, given a repository path. */\n\tgetWorktreeDefaultUri?(repoPath: string): Uri | undefined;\n}\n"],"mappings":";;;;;AAyPA,MAAa,WAAW;CACvB,SAAS;CACT,MAAM;CACN,WAAW;CACX,cAAc;AACf"}
|
package/dist/git/features.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../git/src/features.d.ts
|
|
2
|
-
export type GitFeatures = 'git:checkout:pathspec-from-file' | 'git:commit-graph' | 'git:commit-graph:changed-paths' | 'git:diff:autoRefreshIndex:off' | 'git:fetch:all-config' | 'git:fetch:follow-remote-head' | 'git:fetch:no-write-fetch-head' | 'git:for-each-ref:ahead-behind' | 'git:for-each-ref:worktreePath' | 'git:fsmonitor' | 'git:fsmonitor:linux' | 'git:ignoreRevsFile' | 'git:index:skipHash' | 'git:log:diff-merges' | 'git:ls-files:directory' | 'git:maintenance' | 'git:maintenance:pack-refs' | 'git:maintenance:start' | 'git:maintenance:start:systemd' | 'git:manyFiles' | 'git:merge-tree:trees' | 'git:merge-tree:write-tree' | 'git:patch-id:binary-oids' | 'git:patch-id:verbatim' | 'git:push:force-if-includes' | 'git:rebase:autosquash' | 'git:rev-parse:end-of-options' | 'git:rev-parse:reflog-oldest-old-value' | 'git:signing:ssh' | 'git:signing:x509' | 'git:sparse-index' | 'git:stash:push:pathspecs' | 'git:stash:push:staged' | 'git:stash:push:stdin' | 'git:status:find-renames' | 'git:status:ignored-matching' | 'git:status:porcelain-v2' | 'git:untrackedCache' | 'git:worktree:list:lock-reason' | 'git:worktrees';
|
|
2
|
+
export type GitFeatures = 'git:checkout:pathspec-from-file' | 'git:commit-graph' | 'git:commit-graph:changed-paths' | 'git:diff:autoRefreshIndex:off' | 'git:fetch:all-config' | 'git:fetch:follow-remote-head' | 'git:fetch:no-write-fetch-head' | 'git:for-each-ref:ahead-behind' | 'git:for-each-ref:worktreePath' | 'git:fsmonitor' | 'git:fsmonitor:linux' | 'git:ignoreRevsFile' | 'git:index:skipHash' | 'git:log:diff-merges' | 'git:ls-files:directory' | 'git:maintenance' | 'git:maintenance:pack-refs' | 'git:maintenance:start' | 'git:maintenance:start:systemd' | 'git:manyFiles' | 'git:merge-tree:trees' | 'git:merge-tree:write-tree' | 'git:patch-id:binary-oids' | 'git:patch-id:verbatim' | 'git:push:force-if-includes' | 'git:rebase:autosquash' | 'git:rev-list:exclude-first-parent-only' | 'git:rev-parse:end-of-options' | 'git:rev-parse:reflog-oldest-old-value' | 'git:signing:ssh' | 'git:signing:x509' | 'git:sparse-index' | 'git:stash:push:pathspecs' | 'git:stash:push:staged' | 'git:stash:push:stdin' | 'git:status:find-renames' | 'git:status:ignored-matching' | 'git:status:porcelain-v2' | 'git:untrackedCache' | 'git:worktree:list:lock-reason' | 'git:worktrees';
|
|
3
3
|
type ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}` ? Rest extends `${infer SubPrefix}:${string}` ? T | `${Prefix}:${SubPrefix}` | Prefix : T | Prefix : never;
|
|
4
4
|
export type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;
|
|
5
5
|
export type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures ? T : Extract<GitFeatures, T | `${T}:${string}`>;
|
package/dist/git/features.js
CHANGED
|
@@ -27,6 +27,7 @@ const gitFeaturesByVersion = /* @__PURE__ */ new Map([
|
|
|
27
27
|
["git:patch-id:verbatim", "2.39"],
|
|
28
28
|
["git:push:force-if-includes", "2.30.0"],
|
|
29
29
|
["git:rebase:autosquash", "2.44"],
|
|
30
|
+
["git:rev-list:exclude-first-parent-only", "2.38"],
|
|
30
31
|
["git:rev-parse:end-of-options", "2.30"],
|
|
31
32
|
["git:rev-parse:reflog-oldest-old-value", "2.31"],
|
|
32
33
|
["git:signing:ssh", "2.34.0"],
|
package/dist/git/features.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","names":[],"sources":["../../../git/src/features.ts"],"sourcesContent":["// GitFeature's must start with `git:` to be recognized in all usages\nexport type GitFeatures =\n\t| 'git:checkout:pathspec-from-file'\n\t| 'git:commit-graph'\n\t| 'git:commit-graph:changed-paths'\n\t| 'git:diff:autoRefreshIndex:off'\n\t| 'git:fetch:all-config'\n\t| 'git:fetch:follow-remote-head'\n\t| 'git:fetch:no-write-fetch-head'\n\t| 'git:for-each-ref:ahead-behind'\n\t| 'git:for-each-ref:worktreePath'\n\t| 'git:fsmonitor'\n\t| 'git:fsmonitor:linux'\n\t| 'git:ignoreRevsFile'\n\t| 'git:index:skipHash'\n\t| 'git:log:diff-merges'\n\t| 'git:ls-files:directory'\n\t| 'git:maintenance'\n\t| 'git:maintenance:pack-refs'\n\t| 'git:maintenance:start'\n\t| 'git:maintenance:start:systemd'\n\t| 'git:manyFiles'\n\t| 'git:merge-tree:trees'\n\t| 'git:merge-tree:write-tree'\n\t| 'git:patch-id:binary-oids'\n\t| 'git:patch-id:verbatim'\n\t| 'git:push:force-if-includes'\n\t| 'git:rebase:autosquash'\n\t| 'git:rev-parse:end-of-options'\n\t| 'git:rev-parse:reflog-oldest-old-value'\n\t| 'git:signing:ssh'\n\t| 'git:signing:x509'\n\t| 'git:sparse-index'\n\t| 'git:stash:push:pathspecs'\n\t| 'git:stash:push:staged'\n\t| 'git:stash:push:stdin'\n\t| 'git:status:find-renames'\n\t| 'git:status:ignored-matching'\n\t| 'git:status:porcelain-v2'\n\t| 'git:untrackedCache'\n\t| 'git:worktree:list:lock-reason'\n\t| 'git:worktrees';\n\ntype ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}`\n\t? Rest extends `${infer SubPrefix}:${string}`\n\t\t? T | `${Prefix}:${SubPrefix}` | Prefix\n\t\t: T | Prefix\n\t: never;\n\nexport type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;\nexport type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures\n\t? T\n\t: Extract<GitFeatures, T | `${T}:${string}`>;\n\nexport const gitMinimumVersion = '2.7.2';\nexport const gitFeaturesByVersion = new Map<GitFeatures, string>([\n\t['git:checkout:pathspec-from-file', '2.26'],\n\t// 2.24 is when git READS the commit-graph file by default (core.commitGraph on); writing it for\n\t// older gits would be dead weight.\n\t['git:commit-graph', '2.24'],\n\t// Changed-path Bloom filters (`--changed-paths`), the v2 filter format — pre-2.31 shipped Bloom filters\n\t// with real correctness bugs (bad results for merge commits), so 2.31 is the safe floor to write them.\n\t['git:commit-graph:changed-paths', '2.31'],\n\t// From 2.46 `diff --quiet` compares contents, so with auto-refresh off a file whose timestamps moved but whose\n\t// content did not still reads as unchanged; before it, such a file reads as changed.\n\t['git:diff:autoRefreshIndex:off', '2.46'],\n\t// A bare `fetch` reads every remote when `fetch.all` is set\n\t['git:fetch:all-config', '2.44'],\n\t// A fetch using a remote's configured refspecs creates its missing `refs/remotes/<remote>/HEAD`\n\t// (`remote.<name>.followRemoteHEAD`, default `create`)\n\t['git:fetch:follow-remote-head', '2.48'],\n\t['git:fetch:no-write-fetch-head', '2.29'],\n\t// `%(ahead-behind:<commit>)` in for-each-ref formats\n\t['git:for-each-ref:ahead-behind', '2.41'],\n\t['git:for-each-ref:worktreePath', '2.23'],\n\t// `core.fsmonitor=true` selects the built-in FSMonitor daemon (accepting a bool rather than only a\n\t// hook path). This 2.37 floor is the Windows + macOS one.\n\t['git:fsmonitor', '2.37'],\n\t// Linux got its own FSMonitor backend (inotify) only in 2.55, hence a separate floor. Note the backend\n\t// places a watch on EVERY directory, so a large repo can exhaust `fs.inotify.max_user_watches` and the\n\t// daemon fails at runtime even on a new enough git — the apply path must still probe, not just gate.\n\t['git:fsmonitor:linux', '2.55'],\n\t['git:ignoreRevsFile', '2.23'],\n\t// `index.skipHash` (skip the trailing index checksum for faster writes); part of `feature.manyFiles`.\n\t['git:index:skipHash', '2.40'],\n\t// `log --diff-merges=first-parent`: diffs a merge against its first parent only (`-m` diffs against every parent)\n\t['git:log:diff-merges', '2.31'],\n\t// `ls-files --others --directory --no-empty-directory` answers from the directory walk as reworked in 2.27;\n\t// the flags themselves are older\n\t['git:ls-files:directory', '2.27'],\n\t// `git maintenance run --task=…`. The `maintenance` builtin + `commit-graph`/`gc` tasks are 2.29, but\n\t// the loose-objects + incremental-repack tasks the auto tier uses landed in 2.30 (and `core.multiPackIndex`\n\t// is default-on from 2.30, so no separate midx config write is needed) — 2.30 is the safe floor.\n\t['git:maintenance', '2.30'],\n\t// The pack-refs maintenance task landed one release after the maintenance builtin.\n\t['git:maintenance:pack-refs', '2.31'],\n\t// `git maintenance start` — the subcommands exist from 2.30 (cron only); launchctl (macOS) + schtasks\n\t// (Windows) scheduling arrived in 2.31, so 2.31 is the cross-platform-safe floor.\n\t['git:maintenance:start', '2.31'],\n\t// `git maintenance start` systemd-timer scheduling. On Linux, 2.31–2.33 is cron-only and modern distros\n\t// often ship without cron (scheduling then silently fails); the systemd fallback arrived in 2.34.\n\t['git:maintenance:start:systemd', '2.34'],\n\t// `feature.manyFiles` umbrella (index v4 + untracked cache + skipHash where available).\n\t['git:manyFiles', '2.24'],\n\t// `merge-tree --write-tree --merge-base=<base> <tree> <commit>`: `--merge-base` arrived in 2.40, but plain trees as merge\n\t// inputs only in 2.45 — older git rejects a tree with \"expected commit type\"\n\t['git:merge-tree:trees', '2.45'],\n\t// `merge-tree --write-tree` mode with `-z`/`--name-only`/`--no-messages`; the older trivial mode can't check conflicts\n\t['git:merge-tree:write-tree', '2.38'],\n\t// `patch-id` hashes a binary change through its blob ids; older ones hash the diff's text, so need `--binary` data\n\t['git:patch-id:binary-oids', '2.39'],\n\t// `patch-id --verbatim`: hashes whitespace and file-mode header lines instead of normalizing them away\n\t['git:patch-id:verbatim', '2.39'],\n\t['git:push:force-if-includes', '2.30.0'],\n\t// `--autosquash` WITHOUT `-i` (folding `fixup!`/`squash!` commits into a plain/automatic rebase).\n\t// Interactive rebases support autosquash on every git version GitLens supports, so this floor only\n\t// gates the non-interactive path.\n\t['git:rebase:autosquash', '2.44'],\n\t['git:rev-parse:end-of-options', '2.30'],\n\t// `<ref>@{<n>}` for a reflog of exactly n entries names the value before the oldest one, refusing only a null one\n\t// (the entry that created the ref); older ones refuse it either way\n\t['git:rev-parse:reflog-oldest-old-value', '2.31'],\n\t['git:signing:ssh', '2.34.0'],\n\t['git:signing:x509', '2.19.0'],\n\t// Sparse-index support debuted earlier, but 2.33 shipped a corruption fix and 2.34 broadened command\n\t// support. Use 2.34 as the conservative floor before offering a repository mutation.\n\t['git:sparse-index', '2.34'],\n\t['git:stash:push:pathspecs', '2.13.2'],\n\t['git:stash:push:staged', '2.35.0'],\n\t['git:stash:push:stdin', '2.30.0'],\n\t['git:status:find-renames', '2.18'],\n\t// `status --ignored=matching`: an ignored folder is one entry, without a walk of what is inside it\n\t['git:status:ignored-matching', '2.16'],\n\t['git:status:porcelain-v2', '2.11'],\n\t// `core.untrackedCache=true` (repo-local cache of untracked-file scans — the auto-tier config lever).\n\t['git:untrackedCache', '2.8'],\n\t// `worktree list --porcelain` prints a lock's reason (`locked <reason>`); older ones print a bare `locked`\n\t['git:worktree:list:lock-reason', '2.31'],\n\t['git:worktrees', '2.17.0'],\n]);\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"features.js","names":[],"sources":["../../../git/src/features.ts"],"sourcesContent":["// GitFeature's must start with `git:` to be recognized in all usages\nexport type GitFeatures =\n\t| 'git:checkout:pathspec-from-file'\n\t| 'git:commit-graph'\n\t| 'git:commit-graph:changed-paths'\n\t| 'git:diff:autoRefreshIndex:off'\n\t| 'git:fetch:all-config'\n\t| 'git:fetch:follow-remote-head'\n\t| 'git:fetch:no-write-fetch-head'\n\t| 'git:for-each-ref:ahead-behind'\n\t| 'git:for-each-ref:worktreePath'\n\t| 'git:fsmonitor'\n\t| 'git:fsmonitor:linux'\n\t| 'git:ignoreRevsFile'\n\t| 'git:index:skipHash'\n\t| 'git:log:diff-merges'\n\t| 'git:ls-files:directory'\n\t| 'git:maintenance'\n\t| 'git:maintenance:pack-refs'\n\t| 'git:maintenance:start'\n\t| 'git:maintenance:start:systemd'\n\t| 'git:manyFiles'\n\t| 'git:merge-tree:trees'\n\t| 'git:merge-tree:write-tree'\n\t| 'git:patch-id:binary-oids'\n\t| 'git:patch-id:verbatim'\n\t| 'git:push:force-if-includes'\n\t| 'git:rebase:autosquash'\n\t| 'git:rev-list:exclude-first-parent-only'\n\t| 'git:rev-parse:end-of-options'\n\t| 'git:rev-parse:reflog-oldest-old-value'\n\t| 'git:signing:ssh'\n\t| 'git:signing:x509'\n\t| 'git:sparse-index'\n\t| 'git:stash:push:pathspecs'\n\t| 'git:stash:push:staged'\n\t| 'git:stash:push:stdin'\n\t| 'git:status:find-renames'\n\t| 'git:status:ignored-matching'\n\t| 'git:status:porcelain-v2'\n\t| 'git:untrackedCache'\n\t| 'git:worktree:list:lock-reason'\n\t| 'git:worktrees';\n\ntype ExtractPrefix<T> = T extends `${infer Prefix}:${infer Rest}`\n\t? Rest extends `${infer SubPrefix}:${string}`\n\t\t? T | `${Prefix}:${SubPrefix}` | Prefix\n\t\t: T | Prefix\n\t: never;\n\nexport type GitFeatureOrPrefix = ExtractPrefix<GitFeatures>;\nexport type FilteredGitFeatures<T extends GitFeatureOrPrefix> = T extends GitFeatures\n\t? T\n\t: Extract<GitFeatures, T | `${T}:${string}`>;\n\nexport const gitMinimumVersion = '2.7.2';\nexport const gitFeaturesByVersion = new Map<GitFeatures, string>([\n\t['git:checkout:pathspec-from-file', '2.26'],\n\t// 2.24 is when git READS the commit-graph file by default (core.commitGraph on); writing it for\n\t// older gits would be dead weight.\n\t['git:commit-graph', '2.24'],\n\t// Changed-path Bloom filters (`--changed-paths`), the v2 filter format — pre-2.31 shipped Bloom filters\n\t// with real correctness bugs (bad results for merge commits), so 2.31 is the safe floor to write them.\n\t['git:commit-graph:changed-paths', '2.31'],\n\t// From 2.46 `diff --quiet` compares contents, so with auto-refresh off a file whose timestamps moved but whose\n\t// content did not still reads as unchanged; before it, such a file reads as changed.\n\t['git:diff:autoRefreshIndex:off', '2.46'],\n\t// A bare `fetch` reads every remote when `fetch.all` is set\n\t['git:fetch:all-config', '2.44'],\n\t// A fetch using a remote's configured refspecs creates its missing `refs/remotes/<remote>/HEAD`\n\t// (`remote.<name>.followRemoteHEAD`, default `create`)\n\t['git:fetch:follow-remote-head', '2.48'],\n\t['git:fetch:no-write-fetch-head', '2.29'],\n\t// `%(ahead-behind:<commit>)` in for-each-ref formats\n\t['git:for-each-ref:ahead-behind', '2.41'],\n\t['git:for-each-ref:worktreePath', '2.23'],\n\t// `core.fsmonitor=true` selects the built-in FSMonitor daemon (accepting a bool rather than only a\n\t// hook path). This 2.37 floor is the Windows + macOS one.\n\t['git:fsmonitor', '2.37'],\n\t// Linux got its own FSMonitor backend (inotify) only in 2.55, hence a separate floor. Note the backend\n\t// places a watch on EVERY directory, so a large repo can exhaust `fs.inotify.max_user_watches` and the\n\t// daemon fails at runtime even on a new enough git — the apply path must still probe, not just gate.\n\t['git:fsmonitor:linux', '2.55'],\n\t['git:ignoreRevsFile', '2.23'],\n\t// `index.skipHash` (skip the trailing index checksum for faster writes); part of `feature.manyFiles`.\n\t['git:index:skipHash', '2.40'],\n\t// `log --diff-merges=first-parent`: diffs a merge against its first parent only (`-m` diffs against every parent)\n\t['git:log:diff-merges', '2.31'],\n\t// `ls-files --others --directory --no-empty-directory` answers from the directory walk as reworked in 2.27;\n\t// the flags themselves are older\n\t['git:ls-files:directory', '2.27'],\n\t// `git maintenance run --task=…`. The `maintenance` builtin + `commit-graph`/`gc` tasks are 2.29, but\n\t// the loose-objects + incremental-repack tasks the auto tier uses landed in 2.30 (and `core.multiPackIndex`\n\t// is default-on from 2.30, so no separate midx config write is needed) — 2.30 is the safe floor.\n\t['git:maintenance', '2.30'],\n\t// The pack-refs maintenance task landed one release after the maintenance builtin.\n\t['git:maintenance:pack-refs', '2.31'],\n\t// `git maintenance start` — the subcommands exist from 2.30 (cron only); launchctl (macOS) + schtasks\n\t// (Windows) scheduling arrived in 2.31, so 2.31 is the cross-platform-safe floor.\n\t['git:maintenance:start', '2.31'],\n\t// `git maintenance start` systemd-timer scheduling. On Linux, 2.31–2.33 is cron-only and modern distros\n\t// often ship without cron (scheduling then silently fails); the systemd fallback arrived in 2.34.\n\t['git:maintenance:start:systemd', '2.34'],\n\t// `feature.manyFiles` umbrella (index v4 + untracked cache + skipHash where available).\n\t['git:manyFiles', '2.24'],\n\t// `merge-tree --write-tree --merge-base=<base> <tree> <commit>`: `--merge-base` arrived in 2.40, but plain trees as merge\n\t// inputs only in 2.45 — older git rejects a tree with \"expected commit type\"\n\t['git:merge-tree:trees', '2.45'],\n\t// `merge-tree --write-tree` mode with `-z`/`--name-only`/`--no-messages`; the older trivial mode can't check conflicts\n\t['git:merge-tree:write-tree', '2.38'],\n\t// `patch-id` hashes a binary change through its blob ids; older ones hash the diff's text, so need `--binary` data\n\t['git:patch-id:binary-oids', '2.39'],\n\t// `patch-id --verbatim`: hashes whitespace and file-mode header lines instead of normalizing them away\n\t['git:patch-id:verbatim', '2.39'],\n\t['git:push:force-if-includes', '2.30.0'],\n\t// `--autosquash` WITHOUT `-i` (folding `fixup!`/`squash!` commits into a plain/automatic rebase).\n\t// Interactive rebases support autosquash on every git version GitLens supports, so this floor only\n\t// gates the non-interactive path.\n\t['git:rebase:autosquash', '2.44'],\n\t['git:rev-list:exclude-first-parent-only', '2.38'],\n\t['git:rev-parse:end-of-options', '2.30'],\n\t// `<ref>@{<n>}` for a reflog of exactly n entries names the value before the oldest one, refusing only a null one\n\t// (the entry that created the ref); older ones refuse it either way\n\t['git:rev-parse:reflog-oldest-old-value', '2.31'],\n\t['git:signing:ssh', '2.34.0'],\n\t['git:signing:x509', '2.19.0'],\n\t// Sparse-index support debuted earlier, but 2.33 shipped a corruption fix and 2.34 broadened command\n\t// support. Use 2.34 as the conservative floor before offering a repository mutation.\n\t['git:sparse-index', '2.34'],\n\t['git:stash:push:pathspecs', '2.13.2'],\n\t['git:stash:push:staged', '2.35.0'],\n\t['git:stash:push:stdin', '2.30.0'],\n\t['git:status:find-renames', '2.18'],\n\t// `status --ignored=matching`: an ignored folder is one entry, without a walk of what is inside it\n\t['git:status:ignored-matching', '2.16'],\n\t['git:status:porcelain-v2', '2.11'],\n\t// `core.untrackedCache=true` (repo-local cache of untracked-file scans — the auto-tier config lever).\n\t['git:untrackedCache', '2.8'],\n\t// `worktree list --porcelain` prints a lock's reason (`locked <reason>`); older ones print a bare `locked`\n\t['git:worktree:list:lock-reason', '2.31'],\n\t['git:worktrees', '2.17.0'],\n]);\n"],"mappings":";AAuDA,MAAa,oBAAoB;AACjC,MAAa,uCAAuB,IAAI,IAAyB;CAChE,CAAC,mCAAmC,MAAM;CAG1C,CAAC,oBAAoB,MAAM;CAG3B,CAAC,kCAAkC,MAAM;CAGzC,CAAC,iCAAiC,MAAM;CAExC,CAAC,wBAAwB,MAAM;CAG/B,CAAC,gCAAgC,MAAM;CACvC,CAAC,iCAAiC,MAAM;CAExC,CAAC,iCAAiC,MAAM;CACxC,CAAC,iCAAiC,MAAM;CAGxC,CAAC,iBAAiB,MAAM;CAIxB,CAAC,uBAAuB,MAAM;CAC9B,CAAC,sBAAsB,MAAM;CAE7B,CAAC,sBAAsB,MAAM;CAE7B,CAAC,uBAAuB,MAAM;CAG9B,CAAC,0BAA0B,MAAM;CAIjC,CAAC,mBAAmB,MAAM;CAE1B,CAAC,6BAA6B,MAAM;CAGpC,CAAC,yBAAyB,MAAM;CAGhC,CAAC,iCAAiC,MAAM;CAExC,CAAC,iBAAiB,MAAM;CAGxB,CAAC,wBAAwB,MAAM;CAE/B,CAAC,6BAA6B,MAAM;CAEpC,CAAC,4BAA4B,MAAM;CAEnC,CAAC,yBAAyB,MAAM;CAChC,CAAC,8BAA8B,QAAQ;CAIvC,CAAC,yBAAyB,MAAM;CAChC,CAAC,0CAA0C,MAAM;CACjD,CAAC,gCAAgC,MAAM;CAGvC,CAAC,yCAAyC,MAAM;CAChD,CAAC,mBAAmB,QAAQ;CAC5B,CAAC,oBAAoB,QAAQ;CAG7B,CAAC,oBAAoB,MAAM;CAC3B,CAAC,4BAA4B,QAAQ;CACrC,CAAC,yBAAyB,QAAQ;CAClC,CAAC,wBAAwB,QAAQ;CACjC,CAAC,2BAA2B,MAAM;CAElC,CAAC,+BAA+B,MAAM;CACtC,CAAC,2BAA2B,MAAM;CAElC,CAAC,sBAAsB,KAAK;CAE5B,CAAC,iCAAiC,MAAM;CACxC,CAAC,iBAAiB,QAAQ;AAC3B,CAAC"}
|
|
@@ -337,6 +337,7 @@ export interface GraphIncrementalSeed {
|
|
|
337
337
|
* current config of) first-parent forces a full fallback. Absent ⇒ treated as `false`.
|
|
338
338
|
*/
|
|
339
339
|
readonly onlyFollowFirstParent?: boolean;
|
|
340
|
+
readonly hiddenRefsKey?: string;
|
|
340
341
|
/** The prior window's shallow boundary. Compare contents, since partial deepening stays shallow. */
|
|
341
342
|
readonly shallowBoundary?: string;
|
|
342
343
|
/**
|
|
@@ -372,7 +373,7 @@ export interface IncrementalGraphOutcome {
|
|
|
372
373
|
/** Fast path only: how many NEW commit rows the incremental enumeration added at the head. */
|
|
373
374
|
readonly added?: number;
|
|
374
375
|
}
|
|
375
|
-
export type IncrementalGraphFallbackReason = 'no-row-processor' | 'ordering-not-date' | 'rev-outside-seed' | 'first-parent' | 'limit-exceeds-seed' | 'ref-deleted' | 'ref-non-fast-forward' | 'replace-refs-changed' | 'shallow-changed' | 'stash-changed' | 'stash-window-conflict' | 'date-boundary' | 'metadata-changed' | 'error';
|
|
376
|
+
export type IncrementalGraphFallbackReason = 'no-row-processor' | 'ordering-not-date' | 'rev-outside-seed' | 'first-parent' | 'hidden-refs-changed' | 'limit-exceeds-seed' | 'ref-deleted' | 'ref-non-fast-forward' | 'replace-refs-changed' | 'shallow-changed' | 'stash-changed' | 'stash-window-conflict' | 'date-boundary' | 'metadata-changed' | 'error';
|
|
376
377
|
/**
|
|
377
378
|
* Processes a single graph row — mutates the row in place.
|
|
378
379
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.js","names":[],"sources":["../../../../git/src/models/graph.ts"],"sourcesContent":["import type { GitCommitReachability } from '../providers/commits.js';\nimport type { GitBranch } from './branch.js';\nimport type { GitStashCommit } from './commit.js';\nimport type { GitRemote } from './remote.js';\nimport type { GkProviderId } from './repositoryIdentities.js';\nimport type { GitWorktree } from './worktree.js';\n\nexport type GitGraphRowKind = 'commit' | 'merge' | 'stash' | 'workdir';\n\nexport interface GitGraphRowHead {\n\t/**\n\t * Stable ref id. **Its presence is the provider-tier marker** — the one signal separating a ref that\n\t * can be acted on from a lean, name-only one, now that neither carries a serialized context.\n\t *\n\t * The CLI provider stamps an id on every ref it emits (`git-cli/providers/graph.ts:781`, `:805`,\n\t * `:836`); the GitHub provider never does, because it has no branch metadata to key\n\t * (`git-github/providers/github/graph.ts:231`, `:239`). So `id == null` means \"this ref came from a\n\t * provider that computes nothing beyond a name\", and every id-keyed feature — ref metadata, exclusions,\n\t * pinning, PR/issue lookup — must degrade rather than guess. Consumers already do this; it is written\n\t * down here because until now it was an accident of two providers rather than a stated contract.\n\t *\n\t * ⚠ An id means the ref is **identifiable and actionable** — it does NOT mean its enrichment is\n\t * complete. The CLI resolves branches, remotes and worktrees with `Promise.allSettled`\n\t * (`git-cli/providers/graph.ts:546`) and still synthesizes ids when any of those settle rejected, so an\n\t * id-bearing ref can carry a missing `starred`/`upstream` that means \"not computed\" rather than \"no\".\n\t * Treat every optional field as enrichment that may be absent, and never report a capability from its\n\t * absence. If a consumer ever needs to tell \"unavailable\" from \"false\", that wants one graph-level\n\t * completeness flag, not a per-ref field on every row.\n\t */\n\tid?: string;\n\tname: string;\n\tisCurrentHead: boolean;\n\t/**\n\t * The tracked upstream. `missing`/`state` are optional here while {@link GitTrackingUpstream} makes\n\t * them required, and the difference is meaningful: absent means the producer did NOT compute them\n\t * (the GitHub provider has no branch metadata at all), NOT \"present and false/zero\". Consumers must\n\t * treat `undefined` as unknown rather than folding it into the negative case.\n\t */\n\tupstream?: { name: string; id: string; missing?: boolean; state?: { ahead: number; behind: number } };\n\t/** Starred (a GitKraken branch disposition). Structured so `+starred` stops being baked into the\n\t * serialized context at row-build time, where starring a branch left the label stale. */\n\tstarred?: boolean;\n\t/** Set when this branch is checked out in ANY worktree, including the default one. Grouped so\n\t * producers can't half-populate id-without-path or vice versa. Consumers that mean \"checked out\n\t * somewhere other than here\" — the ref-ordering tier and the worktree glyph — must test\n\t * `isDefault` too; the default worktree's checkout is the ordinary case, not a worktree badge.\n\t * Note `isDefault` here describes the WORKTREE; the sibling `isDefault` below describes the BRANCH. */\n\tworktree?: { id: string; path: string; isDefault: boolean };\n\t/** True when this head is the repository's default branch. */\n\tisDefault?: boolean;\n}\n\nexport interface GitGraphRowRemoteHead {\n\t/** Stable ref id; see {@link GitGraphRowHead.id} — its presence is the provider-tier marker. */\n\tid?: string;\n\tname: string;\n\turl?: string;\n\towner: string;\n\tavatarUrl?: string;\n\tcurrent?: boolean;\n\t/** True when this remote ref IS the repository's default branch and no local branch tracks it (no\n\t * local checkout) — so the default-branch tier still applies for remote-only defaults. */\n\tisDefault?: boolean;\n\thostingServiceType?: GkProviderId;\n\t/** See {@link GitGraphRowHead.starred}. */\n\tstarred?: boolean;\n}\n\nexport interface GitGraphRowTag {\n\t/** Stable ref id; see {@link GitGraphRowHead.id} — its presence is the provider-tier marker. */\n\tid?: string;\n\tname: string;\n\tannotated: boolean;\n}\n\n/**\n * Compact, host-computed flags for a commit/stash row, shipped instead of the bulky serialized\n * `contexts.row`/`contexts.avatar` blobs (which duplicated sha/message/repoPath already on the row).\n * The webview reconstructs the full webview-item contexts from these flags + row fields + repoPath.\n * Bit 0: reachable-from-HEAD (`+current`); Bit 1: unique-to-one-local-branch (`+unique`);\n * Bit 2: has-children — set ONLY on undo-eligible tip rows (active HEAD + worktree HEADs) that have a\n * child, to gate Undo Commit to leaf tips (undoing a commit other work is stacked on is unsafe). It is\n * NOT a general has-children signal: non-tip rows never carry it (the host only computes it for tips);\n * Bit 3: unpushed/ahead-of-upstream (`+unpublished`).\n * Bit 4: history-rewriteable (`+rewriteable`) — on the first-parent chain from HEAD up to (excluding)\n * the first merge commit, so a plain (non-`--rebase-merges`) interactive rebase can safely rewrite it;\n * gates squash/drop/reword/modify. Strictly narrower than `+current` (reachable-from-HEAD includes a\n * merge's other-parent ancestry, which is NOT safely rewriteable).\n * Bit 5: unpulled/behind-the-upstream — the exact mirror of bit 3: on HEAD's upstream tip but NOT on HEAD\n * (i.e. `HEAD..@{u}`). Drives the graph's read-only unpulled indicator; it has no `webviewItem` segment\n * (no command gates on it). Mutually exclusive with `Unpublished` by construction.\n * (`+HEAD` derives from `row.heads[].isCurrentHead`; contributor `+current` from `row.isCurrentUser`.)\n */\nexport const enum GitGraphRowContextFlags {\n\tNone = 0,\n\tReachableFromHead = 1 << 0,\n\tUniqueToBranch = 1 << 1,\n\tHasChildren = 1 << 2,\n\tUnpublished = 1 << 3,\n\tRewriteableFromHead = 1 << 4,\n\tUnpulled = 1 << 5,\n}\n\n/** Context data attached to graph rows for command/menu handling. */\nexport interface GitGraphRowContexts {\n\t/** Compact replacement for the serialized commit `row`/`avatar` contexts; see {@link GitGraphRowContextFlags}. */\n\tflags?: GitGraphRowContextFlags;\n\t/**\n\t * Index into the per-graph `GraphReachabilityTable.sets` for this row's reachable-refs set,\n\t * shipped instead of the per-row `reachability` object (which dominated the graph payload). The\n\t * webview rebuilds `row.reachability` from the shared table. Absent ⇒ no reachability for this row.\n\t */\n\treachabilityIndex?: number;\n\t/** Serialized right-click context. Built here only for stash rows; commit rows ship {@link flags}\n\t * instead and have theirs rebuilt on demand (see `rowContext.utils`). */\n\trow?: string | object;\n\t/** Serialized context per grouped-ref name, for the group's own menu. */\n\trefGroups?: Record<string, string | object>;\n}\n\nexport interface GitGraphRowStats {\n\tfiles: number;\n\tadditions: number;\n\tdeletions: number;\n}\n\n/**\n * Wire encoding for per-row reachability, shipped once per graph payload instead of inline on every\n * row. Git reachability is monotone (adjacent commits share ref-sets), so the rows collapse to a\n * relatively small number of distinct sets over the repo's ref universe — `dictionary` (the shared\n * ref list) + `sets` (distinct membership bitmaps, base64; bit i ⇒ `dictionary[i]` reachable) + a\n * per-row index (`GitGraphRowContexts.reachabilityIndex`) reconstructs every row's `reachability`\n * client-side for a fraction of the bytes the inline objects cost. `current` is a per-ref property\n * (the checked-out HEAD branch) and lives in the dictionary entry.\n *\n * The table is append-only within a graph generation, so the host ships only the entries appended\n * since its last push (a delta) on same-generation pagination and the full table on a new generation;\n * `id` lets the webview tell the two apart (same `id` ⇒ append the delta, new `id` ⇒ replace + reset\n * its decode cache). A fresh `getGraph` walk mints a new `id`; `more()` keeps the same one.\n */\nexport interface GraphReachabilityTable {\n\t/** Generation id — stable across `more()` pagination, new per fresh graph walk. */\n\treadonly id: number;\n\treadonly dictionary: GitCommitReachability['refs'];\n\t/** Distinct ref-membership bitmaps, base64-encoded `Uint8Array` of `ceil(dictionary.length/8)` bytes. */\n\treadonly sets: string[];\n}\n\n/** Library-owned graph row type. */\nexport interface GitGraphRow {\n\tsha: string;\n\tparents: string[];\n\tauthor: string;\n\temail: string;\n\tdate: number;\n\tcommitDate?: number;\n\tmessage: string;\n\tkind: GitGraphRowKind;\n\theads?: GitGraphRowHead[];\n\tremotes?: GitGraphRowRemoteHead[];\n\ttags?: GitGraphRowTag[];\n\tcontexts?: GitGraphRowContexts;\n\tstats?: GitGraphRowStats;\n\t/** Stash rows only: the `{n}` of `stash@{n}`, so consumers stop parsing it back out of the message. */\n\tstashNumber?: string;\n\t/**\n\t * Transient, set only for the duration of {@link GraphRowProcessor.processRow} (the row processor's\n\t * `+unique` decision reads it). The provider strips it before pushing the row and records the\n\t * reachable-ref set into the shared {@link GitGraph.reachability} table instead (see\n\t * {@link GitGraphRowContexts.reachabilityIndex}), so emitted rows do NOT retain the per-row arrays.\n\t */\n\treachability?: GitCommitReachability;\n\tisCurrentUser?: boolean;\n}\n\nexport interface GitGraph {\n\treadonly repoPath: string;\n\t/** A map of all avatar urls */\n\treadonly avatars: Map<string, string>;\n\t/** A set of all \"seen\" commit ids */\n\treadonly ids: Set<string>;\n\treadonly includes: { stats?: boolean } | undefined;\n\treadonly branches: ReadonlyMap<string, GitBranch>;\n\treadonly remotes: ReadonlyMap<string, GitRemote>;\n\treadonly downstreams: ReadonlyMap<string, string[]>;\n\treadonly stashes: ReadonlyMap<string, GitStashCommit> | undefined;\n\treadonly worktrees: ReadonlyArray<GitWorktree> | undefined;\n\treadonly worktreesByBranch: ReadonlyMap<string, GitWorktree> | undefined;\n\n\t/** SHAs reachable from HEAD (for enrichment: marking commits on the current branch) */\n\treadonly reachableFromHEAD?: ReadonlySet<string>;\n\n\t/**\n\t * Ref tips as of this walk: canonical refname (`refs/heads/…`, `refs/remotes/…`, `refs/tags/…`) →\n\t * PEELED tip sha (annotated tags map to the commit their badge sits on). Captured so the host can seed\n\t * the NEXT rebuild's {@link GraphIncrementalSeed.tips} — the map the R6b fast path diffs against to find\n\t * the structural changes that force a full fallback. The CLI provider populates it on both paths (full\n\t * walk + fast path); the GitHub provider leaves it undefined.\n\t */\n\treadonly refTips?: ReadonlyMap<string, string>;\n\n\t/**\n\t * Fingerprint of every SIDE INPUT row construction embeds into row decorations as of this walk —\n\t * default branch, per-branch upstreams, HEAD's upstream, remote urls/providers, worktree assignments,\n\t * and the current user. These can all change WITHOUT moving any ref tip (`git remote set-head`,\n\t * `branch --set-upstream-to`, `worktree add`, remote/user config edits), and the R6b fast path reuses\n\t * prior rows wholesale (only flags/reachability are re-derived) — so it must compare this against the\n\t * seed's and fall back to a full walk on ANY change. The CLI provider populates it on both paths; the\n\t * GitHub provider leaves it undefined.\n\t */\n\treadonly decorationFingerprint?: string;\n\n\t/** Canonical shallow boundary OIDs for this window. Empty means complete history; undefined means\n\t * unknown (or unsupported by the provider), so a CLI refresh cannot reuse ancestry-dependent data. */\n\treadonly shallowBoundary?: string;\n\n\t/**\n\t * SHAs on the first-parent chain from HEAD up to (excluding) the first merge commit — i.e. the\n\t * commits a plain interactive rebase can safely rewrite. Empty when HEAD itself is a merge. Used by\n\t * the graph's history-rewriting commands (squash/drop/reword/modify) to validate selections.\n\t */\n\treadonly rewriteableFromHEAD?: ReadonlySet<string>;\n\n\t/**\n\t * Shared, append-only reachability table for the loaded rows (the primary representation — rows\n\t * carry only a {@link GitGraphRowContexts.reachabilityIndex} into it, not per-row ref arrays).\n\t * Grows monotonically across {@link more} pagination within a graph session: indices already\n\t * assigned never change, so consumers can decode any row on demand and cache by index. Absent ⇒\n\t * no row in the graph has reachability. See {@link GraphReachabilityTable}.\n\t */\n\treadonly reachability?: GraphReachabilityTable;\n\n\t/** The rows for the set of commits requested */\n\treadonly rows: GitGraphRow[];\n\treadonly id?: string;\n\n\treadonly rowsStats?: GitGraphRowsStats;\n\treadonly rowsStatsDeferred?: { isLoaded: () => boolean; promise: Promise<void> };\n\n\treadonly paging?: {\n\t\treadonly limit: number | undefined;\n\t\treadonly startingCursor: string | undefined;\n\t\treadonly hasMore: boolean;\n\t};\n\n\t/**\n\t * Loads more commits for the graph.\n\t *\n\t * @param limit - The number of commits to load (page size)\n\t * @param id - Optional SHA to find\n\t * @param cancellation - Cancellation token\n\t *\n\t * **Behavior based on parameters:**\n\t *\n\t * - **`id` provided + `limit > 0`**: Find the commit with the given SHA, then ensure at least `limit` commits are loaded.\n\t * - If SHA is found early (e.g., at position 100), continues loading to reach `limit` total commits.\n\t * - If SHA is found late (e.g., at position 2000 when limit is 1000), loads all commits up to and including the SHA.\n\t * - This ensures the target commit is included AND provides a full page of context.\n\t *\n\t * - **`id` provided + `limit === 0`**: Find the commit with the given SHA and stop immediately.\n\t * - Loads only as many commits as needed to reach the target SHA.\n\t * - Used when you want to find a specific commit without loading extra commits.\n\t *\n\t * - **No `id` + `limit > 0`**: Load exactly `limit` commits (normal pagination).\n\t * - Standard page-based loading without a specific target.\n\t *\n\t * - **No `id` + `limit === 0`**: Load all remaining commits.\n\t * - Loads everything from the current position to the end of history.\n\t * - Use with caution as this can load a large number of commits.\n\t *\n\t * @example\n\t * // Load next page of 1000 commits\n\t * await graph.more(1000);\n\t *\n\t * @example\n\t * // Find a specific commit and ensure a full page is loaded\n\t * await graph.more(1000, 'abc123');\n\t *\n\t * @example\n\t * // Find a specific commit and stop (minimal loading)\n\t * await graph.more(0, 'abc123');\n\t */\n\tmore?(limit: number, id?: string, cancellation?: AbortSignal): Promise<GitGraph | undefined>;\n}\n\nexport type GitGraphRowsStats = Map<string, GitGraphRowStats>;\n\n/**\n * Seed for the R6b incremental head-walk fast path. Carries the prior generation's walk artifacts so a\n * repo-change rebuild can walk ONLY the changed head region, stitch the cached tail, and re-derive\n * flags/reachability in memory — instead of re-walking every loaded row.\n *\n * The CLI provider consumes this on its incremental fast path, degrading to the full ordered walk\n * whenever any gate below rejects the seed. The GitHub provider ignores it structurally (it never\n * lists the option).\n */\nexport interface GraphIncrementalSeed {\n\t/**\n\t * Prior generation's emitted rows, in walk order. R6b stitches the unchanged tail from these once the\n\t * streamed head region CONVERGES with them (K consecutive shas aligned at a stable offset), and reads\n\t * their parent lists to re-derive reachability/flags in memory (no git) over the stitched window.\n\t */\n\treadonly rows: readonly GitGraphRow[];\n\t/**\n\t * Ref tips as of the prior walk: canonical refname (e.g. `refs/heads/main`, `refs/remotes/origin/main`,\n\t * `refs/tags/v1`) → tip sha. R6b enumerates the new commits via `git log --all --not <these shas>`\n\t * (cheap, exact) and diffs this map against the current tips to detect the structural changes that force\n\t * a full fallback: any ref DELETION (key gone) or a NON-fast-forward move (old tip not an ancestor of the\n\t * new tip).\n\t */\n\treadonly tips: ReadonlyMap<string, string>;\n\t/**\n\t * Ordering the prior rows were walked in. The convergence + date-boundary reasoning R6b relies on is only\n\t * sound for `date` order in v1; a seed whose ordering is `author-date`/`topo`, or that disagrees with the\n\t * current walk's ordering, is discarded (full fallback).\n\t */\n\treadonly ordering: 'date' | 'author-date' | 'topo';\n\t/**\n\t * Prior generation's reachability table, to CONTINUE (same role as the sub-provider's `reachabilitySeed`)\n\t * so rows retained across the rebuild keep stable {@link GitGraphRowContexts.reachabilityIndex} values and\n\t * only appended entries ship. R6b decides whether the stitched window extends this builder or needs a\n\t * fresh generation; see `createReachabilityTableBuilder`.\n\t */\n\treadonly reachability?: GraphReachabilityTable;\n\t/**\n\t * Prior generation's per-sha stats. With unchanged ancestry the deferred query recomputes only new\n\t * shas; shallow-boundary or replacement changes invalidate the seed — same role as `rowsStatsSeed`.\n\t */\n\treadonly rowsStats?: GitGraphRowsStats;\n\t/**\n\t * Whether the prior generation had more rows below its loaded window (`paging.hasMore`). The fast path\n\t * can only reconstruct rows the seed carries; when the seed was a partial (paged) load and no new commit\n\t * pushes the window past its limit, `hasMore` must still be reported so the caller keeps paging. Absent ⇒\n\t * treated as `false` (the seed loaded the full history).\n\t */\n\treadonly hasMore?: boolean;\n\t/**\n\t * The `graph.onlyFollowFirstParent` setting the prior rows were walked under. When first-parent is on the\n\t * emitted rows carry sliced (first-parent-only) parents, which the in-memory re-derivation can't expand\n\t * back to the full parent set the walk propagates reachability through — so a seed built under (or a\n\t * current config of) first-parent forces a full fallback. Absent ⇒ treated as `false`.\n\t */\n\treadonly onlyFollowFirstParent?: boolean;\n\t/** The prior window's shallow boundary. Compare contents, since partial deepening stays shallow. */\n\treadonly shallowBoundary?: string;\n\t/**\n\t * {@link GitGraph.decorationFingerprint} of the prior walk. R6b falls back to a full walk on ANY change:\n\t * reused rows keep their embedded decorations (upstream/worktree/default/remote/user metadata), so a\n\t * metadata-only change — one that moves no ref tip — would otherwise ship stale pills indefinitely.\n\t * Optional because providers without the incremental machinery (e.g. GitHub) never populate it; absent ⇒\n\t * never matches ⇒ safe full fallback.\n\t */\n\treadonly decorationFingerprint?: string;\n\t/**\n\t * HEAD's tracking upstream (e.g. `origin/main`) as of the prior walk — carried separately from\n\t * {@link decorationFingerprint} so a session REBIND can neutralize it: moving HEAD to another\n\t * worktree's branch changes the fingerprint even though nothing in the repo did, so recomputing the\n\t * seed-comparable fingerprint from this value (old repoPath, everything else current) cancels exactly\n\t * that perspective move. Sound because it feeds only `remotes[].current` on a reused row, which the\n\t * rebind re-derives in memory. Absent compares as \"no upstream\", so an older seed with a real upstream\n\t * compares unequal ⇒ safe full fallback.\n\t */\n\treadonly headRefUpstreamName?: string;\n\t/** Whether {@link headRefUpstreamName} is a local branch rather than a remote-tracking one. */\n\treadonly headRefUpstreamLocal?: boolean;\n}\n\n/**\n * Which path a seeded {@link GitGraphSubProvider.getGraph} call took: the R6b incremental head-walk fast\n * path, or a full ordered walk (with the gate/boundary `reason` that forced it). Reported via the\n * `onIncrementalResult` option so the host can log it and the equivalence harness can assert it. Purely\n * observational — it never changes the returned graph.\n */\nexport interface IncrementalGraphOutcome {\n\treadonly path: 'fast' | 'fallback';\n\treadonly reason?: IncrementalGraphFallbackReason;\n\t/** Fast path only: how many NEW commit rows the incremental enumeration added at the head. */\n\treadonly added?: number;\n}\n\nexport type IncrementalGraphFallbackReason =\n\t| 'no-row-processor'\n\t| 'ordering-not-date'\n\t| 'rev-outside-seed'\n\t| 'first-parent'\n\t| 'limit-exceeds-seed'\n\t| 'ref-deleted'\n\t| 'ref-non-fast-forward'\n\t| 'replace-refs-changed'\n\t| 'shallow-changed'\n\t| 'stash-changed'\n\t| 'stash-window-conflict'\n\t| 'date-boundary'\n\t// A decoration side input changed without moving any ref tip (default branch, an upstream, a worktree\n\t// assignment, a remote's url/provider, the current user) — reused rows would keep stale embedded\n\t// decorations, so the walk must rebuild them. See `GitGraph.decorationFingerprint`.\n\t| 'metadata-changed'\n\t// The fast path threw (spawn/arg limits on huge ref sets, queue overflow, transient git errors) —\n\t// never an eligibility gate. The fast path must never fail where the full walk it accelerates\n\t// would succeed, so any unexpected error degrades to the full walk (cancellation still propagates).\n\t| 'error';\n\n/**\n * Processes a single graph row — mutates the row in place.\n *\n * Sets `row.contexts` and `row.message` (e.g., emojified), and resolves `remoteHead.avatarUrl`.\n * Also populates `context.avatars` with email → URL mappings.\n *\n * Per-ref contexts are NOT serialized here. The webview builds them from the structured ref fields\n * (`webviews/apps/plus/graph/utils/refContext.utils.ts`), where live state the host would have baked in\n * stale — whether a branch is starred, which ref is pinned — is actually visible. What remains here needs\n * something the webview cannot reach: the extension's asset URIs, or the whole-row grouping.\n *\n * Called inline during graph row iteration in the library's row-building\n * loop, once per row. Because it runs inside the loop, `more()` pagination\n * automatically gets processing for free — no wrapping needed.\n */\nexport interface GraphRowProcessor {\n\tprocessRow(row: GitGraphRow, context: GraphContext): void;\n\t/**\n\t * Rebuild a reused row's HOST-SERIALIZED contexts (`contexts.refGroups`, a stash row's `contexts.row`)\n\t * for a session rebind. The row's ref ids are already re-stamped by the walk (`restampGraphRowIds`)\n\t * before this runs — since this processor is optional, implementations must read ids as already\n\t * correct and must NOT touch them again, nor message/author (not idempotent).\n\t */\n\trestampRow?(row: GitGraphRow, context: GraphContext): void;\n}\n\nexport interface GraphContext {\n\treadonly repoPath: string;\n\treadonly useAvatars: boolean;\n\treadonly branches: ReadonlyMap<string, GitBranch>;\n\treadonly remotes: ReadonlyMap<string, GitRemote>;\n\treadonly worktreesByBranch: ReadonlyMap<string, GitWorktree> | undefined;\n\treadonly branchIdOfMainWorktree: string | undefined;\n\treadonly stashes: ReadonlyMap<string, GitStashCommit> | undefined;\n\treadonly reachableFromHEAD: ReadonlySet<string>;\n\t/** SHAs on the first-parent chain from HEAD up to (excluding) the first merge commit — the commits\n\t * a plain interactive rebase can safely rewrite. Empty when HEAD is a merge. Sets the\n\t * {@link GitGraphRowContextFlags.RewriteableFromHead} flag, gating squash/drop/reword/modify. */\n\treadonly rewriteableFromHEAD: ReadonlySet<string>;\n\t/** The subset of undo-eligible tip shas (active HEAD + worktree HEADs) that have at least one\n\t * child — i.e. are NOT leaves. Scoped to tips (not all commits) for performance; do not treat as\n\t * a general has-children signal. Sets the {@link GitGraphRowContextFlags.HasChildren} flag, which\n\t * gates Undo Commit to leaf tips. */\n\treadonly tipShasWithChildren: ReadonlySet<string>;\n\t/** SHAs reachable from HEAD's tracking-upstream tip, or `undefined` when HEAD has no upstream.\n\t * A commit reachable from HEAD but NOT from this set is unpushed (`+unpublished`); `undefined`\n\t * means there's no upstream to be ahead of, so nothing is flagged. */\n\treadonly reachableFromHeadUpstream: ReadonlySet<string> | undefined;\n\treadonly avatars: Map<string, string>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6FA,IAAkB,0BAAX,yBAAA,yBAAA;CACN,wBAAA,wBAAA,UAAA,KAAA;CACA,wBAAA,wBAAA,uBAAA,KAAA;CACA,wBAAA,wBAAA,oBAAA,KAAA;CACA,wBAAA,wBAAA,iBAAA,KAAA;CACA,wBAAA,wBAAA,iBAAA,KAAA;CACA,wBAAA,wBAAA,yBAAA,MAAA;CACA,wBAAA,wBAAA,cAAA,MAAA;;AACD,EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"graph.js","names":[],"sources":["../../../../git/src/models/graph.ts"],"sourcesContent":["import type { GitCommitReachability } from '../providers/commits.js';\nimport type { GitBranch } from './branch.js';\nimport type { GitStashCommit } from './commit.js';\nimport type { GitRemote } from './remote.js';\nimport type { GkProviderId } from './repositoryIdentities.js';\nimport type { GitWorktree } from './worktree.js';\n\nexport type GitGraphRowKind = 'commit' | 'merge' | 'stash' | 'workdir';\n\nexport interface GitGraphRowHead {\n\t/**\n\t * Stable ref id. **Its presence is the provider-tier marker** — the one signal separating a ref that\n\t * can be acted on from a lean, name-only one, now that neither carries a serialized context.\n\t *\n\t * The CLI provider stamps an id on every ref it emits (`git-cli/providers/graph.ts:781`, `:805`,\n\t * `:836`); the GitHub provider never does, because it has no branch metadata to key\n\t * (`git-github/providers/github/graph.ts:231`, `:239`). So `id == null` means \"this ref came from a\n\t * provider that computes nothing beyond a name\", and every id-keyed feature — ref metadata, exclusions,\n\t * pinning, PR/issue lookup — must degrade rather than guess. Consumers already do this; it is written\n\t * down here because until now it was an accident of two providers rather than a stated contract.\n\t *\n\t * ⚠ An id means the ref is **identifiable and actionable** — it does NOT mean its enrichment is\n\t * complete. The CLI resolves branches, remotes and worktrees with `Promise.allSettled`\n\t * (`git-cli/providers/graph.ts:546`) and still synthesizes ids when any of those settle rejected, so an\n\t * id-bearing ref can carry a missing `starred`/`upstream` that means \"not computed\" rather than \"no\".\n\t * Treat every optional field as enrichment that may be absent, and never report a capability from its\n\t * absence. If a consumer ever needs to tell \"unavailable\" from \"false\", that wants one graph-level\n\t * completeness flag, not a per-ref field on every row.\n\t */\n\tid?: string;\n\tname: string;\n\tisCurrentHead: boolean;\n\t/**\n\t * The tracked upstream. `missing`/`state` are optional here while {@link GitTrackingUpstream} makes\n\t * them required, and the difference is meaningful: absent means the producer did NOT compute them\n\t * (the GitHub provider has no branch metadata at all), NOT \"present and false/zero\". Consumers must\n\t * treat `undefined` as unknown rather than folding it into the negative case.\n\t */\n\tupstream?: { name: string; id: string; missing?: boolean; state?: { ahead: number; behind: number } };\n\t/** Starred (a GitKraken branch disposition). Structured so `+starred` stops being baked into the\n\t * serialized context at row-build time, where starring a branch left the label stale. */\n\tstarred?: boolean;\n\t/** Set when this branch is checked out in ANY worktree, including the default one. Grouped so\n\t * producers can't half-populate id-without-path or vice versa. Consumers that mean \"checked out\n\t * somewhere other than here\" — the ref-ordering tier and the worktree glyph — must test\n\t * `isDefault` too; the default worktree's checkout is the ordinary case, not a worktree badge.\n\t * Note `isDefault` here describes the WORKTREE; the sibling `isDefault` below describes the BRANCH. */\n\tworktree?: { id: string; path: string; isDefault: boolean };\n\t/** True when this head is the repository's default branch. */\n\tisDefault?: boolean;\n}\n\nexport interface GitGraphRowRemoteHead {\n\t/** Stable ref id; see {@link GitGraphRowHead.id} — its presence is the provider-tier marker. */\n\tid?: string;\n\tname: string;\n\turl?: string;\n\towner: string;\n\tavatarUrl?: string;\n\tcurrent?: boolean;\n\t/** True when this remote ref IS the repository's default branch and no local branch tracks it (no\n\t * local checkout) — so the default-branch tier still applies for remote-only defaults. */\n\tisDefault?: boolean;\n\thostingServiceType?: GkProviderId;\n\t/** See {@link GitGraphRowHead.starred}. */\n\tstarred?: boolean;\n}\n\nexport interface GitGraphRowTag {\n\t/** Stable ref id; see {@link GitGraphRowHead.id} — its presence is the provider-tier marker. */\n\tid?: string;\n\tname: string;\n\tannotated: boolean;\n}\n\n/**\n * Compact, host-computed flags for a commit/stash row, shipped instead of the bulky serialized\n * `contexts.row`/`contexts.avatar` blobs (which duplicated sha/message/repoPath already on the row).\n * The webview reconstructs the full webview-item contexts from these flags + row fields + repoPath.\n * Bit 0: reachable-from-HEAD (`+current`); Bit 1: unique-to-one-local-branch (`+unique`);\n * Bit 2: has-children — set ONLY on undo-eligible tip rows (active HEAD + worktree HEADs) that have a\n * child, to gate Undo Commit to leaf tips (undoing a commit other work is stacked on is unsafe). It is\n * NOT a general has-children signal: non-tip rows never carry it (the host only computes it for tips);\n * Bit 3: unpushed/ahead-of-upstream (`+unpublished`).\n * Bit 4: history-rewriteable (`+rewriteable`) — on the first-parent chain from HEAD up to (excluding)\n * the first merge commit, so a plain (non-`--rebase-merges`) interactive rebase can safely rewrite it;\n * gates squash/drop/reword/modify. Strictly narrower than `+current` (reachable-from-HEAD includes a\n * merge's other-parent ancestry, which is NOT safely rewriteable).\n * Bit 5: unpulled/behind-the-upstream — the exact mirror of bit 3: on HEAD's upstream tip but NOT on HEAD\n * (i.e. `HEAD..@{u}`). Drives the graph's read-only unpulled indicator; it has no `webviewItem` segment\n * (no command gates on it). Mutually exclusive with `Unpublished` by construction.\n * (`+HEAD` derives from `row.heads[].isCurrentHead`; contributor `+current` from `row.isCurrentUser`.)\n */\nexport const enum GitGraphRowContextFlags {\n\tNone = 0,\n\tReachableFromHead = 1 << 0,\n\tUniqueToBranch = 1 << 1,\n\tHasChildren = 1 << 2,\n\tUnpublished = 1 << 3,\n\tRewriteableFromHead = 1 << 4,\n\tUnpulled = 1 << 5,\n}\n\n/** Context data attached to graph rows for command/menu handling. */\nexport interface GitGraphRowContexts {\n\t/** Compact replacement for the serialized commit `row`/`avatar` contexts; see {@link GitGraphRowContextFlags}. */\n\tflags?: GitGraphRowContextFlags;\n\t/**\n\t * Index into the per-graph `GraphReachabilityTable.sets` for this row's reachable-refs set,\n\t * shipped instead of the per-row `reachability` object (which dominated the graph payload). The\n\t * webview rebuilds `row.reachability` from the shared table. Absent ⇒ no reachability for this row.\n\t */\n\treachabilityIndex?: number;\n\t/** Serialized right-click context. Built here only for stash rows; commit rows ship {@link flags}\n\t * instead and have theirs rebuilt on demand (see `rowContext.utils`). */\n\trow?: string | object;\n\t/** Serialized context per grouped-ref name, for the group's own menu. */\n\trefGroups?: Record<string, string | object>;\n}\n\nexport interface GitGraphRowStats {\n\tfiles: number;\n\tadditions: number;\n\tdeletions: number;\n}\n\n/**\n * Wire encoding for per-row reachability, shipped once per graph payload instead of inline on every\n * row. Git reachability is monotone (adjacent commits share ref-sets), so the rows collapse to a\n * relatively small number of distinct sets over the repo's ref universe — `dictionary` (the shared\n * ref list) + `sets` (distinct membership bitmaps, base64; bit i ⇒ `dictionary[i]` reachable) + a\n * per-row index (`GitGraphRowContexts.reachabilityIndex`) reconstructs every row's `reachability`\n * client-side for a fraction of the bytes the inline objects cost. `current` is a per-ref property\n * (the checked-out HEAD branch) and lives in the dictionary entry.\n *\n * The table is append-only within a graph generation, so the host ships only the entries appended\n * since its last push (a delta) on same-generation pagination and the full table on a new generation;\n * `id` lets the webview tell the two apart (same `id` ⇒ append the delta, new `id` ⇒ replace + reset\n * its decode cache). A fresh `getGraph` walk mints a new `id`; `more()` keeps the same one.\n */\nexport interface GraphReachabilityTable {\n\t/** Generation id — stable across `more()` pagination, new per fresh graph walk. */\n\treadonly id: number;\n\treadonly dictionary: GitCommitReachability['refs'];\n\t/** Distinct ref-membership bitmaps, base64-encoded `Uint8Array` of `ceil(dictionary.length/8)` bytes. */\n\treadonly sets: string[];\n}\n\n/** Library-owned graph row type. */\nexport interface GitGraphRow {\n\tsha: string;\n\tparents: string[];\n\tauthor: string;\n\temail: string;\n\tdate: number;\n\tcommitDate?: number;\n\tmessage: string;\n\tkind: GitGraphRowKind;\n\theads?: GitGraphRowHead[];\n\tremotes?: GitGraphRowRemoteHead[];\n\ttags?: GitGraphRowTag[];\n\tcontexts?: GitGraphRowContexts;\n\tstats?: GitGraphRowStats;\n\t/** Stash rows only: the `{n}` of `stash@{n}`, so consumers stop parsing it back out of the message. */\n\tstashNumber?: string;\n\t/**\n\t * Transient, set only for the duration of {@link GraphRowProcessor.processRow} (the row processor's\n\t * `+unique` decision reads it). The provider strips it before pushing the row and records the\n\t * reachable-ref set into the shared {@link GitGraph.reachability} table instead (see\n\t * {@link GitGraphRowContexts.reachabilityIndex}), so emitted rows do NOT retain the per-row arrays.\n\t */\n\treachability?: GitCommitReachability;\n\tisCurrentUser?: boolean;\n}\n\nexport interface GitGraph {\n\treadonly repoPath: string;\n\t/** A map of all avatar urls */\n\treadonly avatars: Map<string, string>;\n\t/** A set of all \"seen\" commit ids */\n\treadonly ids: Set<string>;\n\treadonly includes: { stats?: boolean } | undefined;\n\treadonly branches: ReadonlyMap<string, GitBranch>;\n\treadonly remotes: ReadonlyMap<string, GitRemote>;\n\treadonly downstreams: ReadonlyMap<string, string[]>;\n\treadonly stashes: ReadonlyMap<string, GitStashCommit> | undefined;\n\treadonly worktrees: ReadonlyArray<GitWorktree> | undefined;\n\treadonly worktreesByBranch: ReadonlyMap<string, GitWorktree> | undefined;\n\n\t/** SHAs reachable from HEAD (for enrichment: marking commits on the current branch) */\n\treadonly reachableFromHEAD?: ReadonlySet<string>;\n\n\t/**\n\t * Ref tips as of this walk: canonical refname (`refs/heads/…`, `refs/remotes/…`, `refs/tags/…`) →\n\t * PEELED tip sha (annotated tags map to the commit their badge sits on). Captured so the host can seed\n\t * the NEXT rebuild's {@link GraphIncrementalSeed.tips} — the map the R6b fast path diffs against to find\n\t * the structural changes that force a full fallback. The CLI provider populates it on both paths (full\n\t * walk + fast path); the GitHub provider leaves it undefined.\n\t */\n\treadonly refTips?: ReadonlyMap<string, string>;\n\n\t/**\n\t * Fingerprint of every SIDE INPUT row construction embeds into row decorations as of this walk —\n\t * default branch, per-branch upstreams, HEAD's upstream, remote urls/providers, worktree assignments,\n\t * and the current user. These can all change WITHOUT moving any ref tip (`git remote set-head`,\n\t * `branch --set-upstream-to`, `worktree add`, remote/user config edits), and the R6b fast path reuses\n\t * prior rows wholesale (only flags/reachability are re-derived) — so it must compare this against the\n\t * seed's and fall back to a full walk on ANY change. The CLI provider populates it on both paths; the\n\t * GitHub provider leaves it undefined.\n\t */\n\treadonly decorationFingerprint?: string;\n\n\t/** Canonical shallow boundary OIDs for this window. Empty means complete history; undefined means\n\t * unknown (or unsupported by the provider), so a CLI refresh cannot reuse ancestry-dependent data. */\n\treadonly shallowBoundary?: string;\n\n\t/**\n\t * SHAs on the first-parent chain from HEAD up to (excluding) the first merge commit — i.e. the\n\t * commits a plain interactive rebase can safely rewrite. Empty when HEAD itself is a merge. Used by\n\t * the graph's history-rewriting commands (squash/drop/reword/modify) to validate selections.\n\t */\n\treadonly rewriteableFromHEAD?: ReadonlySet<string>;\n\n\t/**\n\t * Shared, append-only reachability table for the loaded rows (the primary representation — rows\n\t * carry only a {@link GitGraphRowContexts.reachabilityIndex} into it, not per-row ref arrays).\n\t * Grows monotonically across {@link more} pagination within a graph session: indices already\n\t * assigned never change, so consumers can decode any row on demand and cache by index. Absent ⇒\n\t * no row in the graph has reachability. See {@link GraphReachabilityTable}.\n\t */\n\treadonly reachability?: GraphReachabilityTable;\n\n\t/** The rows for the set of commits requested */\n\treadonly rows: GitGraphRow[];\n\treadonly id?: string;\n\n\treadonly rowsStats?: GitGraphRowsStats;\n\treadonly rowsStatsDeferred?: { isLoaded: () => boolean; promise: Promise<void> };\n\n\treadonly paging?: {\n\t\treadonly limit: number | undefined;\n\t\treadonly startingCursor: string | undefined;\n\t\treadonly hasMore: boolean;\n\t};\n\n\t/**\n\t * Loads more commits for the graph.\n\t *\n\t * @param limit - The number of commits to load (page size)\n\t * @param id - Optional SHA to find\n\t * @param cancellation - Cancellation token\n\t *\n\t * **Behavior based on parameters:**\n\t *\n\t * - **`id` provided + `limit > 0`**: Find the commit with the given SHA, then ensure at least `limit` commits are loaded.\n\t * - If SHA is found early (e.g., at position 100), continues loading to reach `limit` total commits.\n\t * - If SHA is found late (e.g., at position 2000 when limit is 1000), loads all commits up to and including the SHA.\n\t * - This ensures the target commit is included AND provides a full page of context.\n\t *\n\t * - **`id` provided + `limit === 0`**: Find the commit with the given SHA and stop immediately.\n\t * - Loads only as many commits as needed to reach the target SHA.\n\t * - Used when you want to find a specific commit without loading extra commits.\n\t *\n\t * - **No `id` + `limit > 0`**: Load exactly `limit` commits (normal pagination).\n\t * - Standard page-based loading without a specific target.\n\t *\n\t * - **No `id` + `limit === 0`**: Load all remaining commits.\n\t * - Loads everything from the current position to the end of history.\n\t * - Use with caution as this can load a large number of commits.\n\t *\n\t * @example\n\t * // Load next page of 1000 commits\n\t * await graph.more(1000);\n\t *\n\t * @example\n\t * // Find a specific commit and ensure a full page is loaded\n\t * await graph.more(1000, 'abc123');\n\t *\n\t * @example\n\t * // Find a specific commit and stop (minimal loading)\n\t * await graph.more(0, 'abc123');\n\t */\n\tmore?(limit: number, id?: string, cancellation?: AbortSignal): Promise<GitGraph | undefined>;\n}\n\nexport type GitGraphRowsStats = Map<string, GitGraphRowStats>;\n\n/**\n * Seed for the R6b incremental head-walk fast path. Carries the prior generation's walk artifacts so a\n * repo-change rebuild can walk ONLY the changed head region, stitch the cached tail, and re-derive\n * flags/reachability in memory — instead of re-walking every loaded row.\n *\n * The CLI provider consumes this on its incremental fast path, degrading to the full ordered walk\n * whenever any gate below rejects the seed. The GitHub provider ignores it structurally (it never\n * lists the option).\n */\nexport interface GraphIncrementalSeed {\n\t/**\n\t * Prior generation's emitted rows, in walk order. R6b stitches the unchanged tail from these once the\n\t * streamed head region CONVERGES with them (K consecutive shas aligned at a stable offset), and reads\n\t * their parent lists to re-derive reachability/flags in memory (no git) over the stitched window.\n\t */\n\treadonly rows: readonly GitGraphRow[];\n\t/**\n\t * Ref tips as of the prior walk: canonical refname (e.g. `refs/heads/main`, `refs/remotes/origin/main`,\n\t * `refs/tags/v1`) → tip sha. R6b enumerates the new commits via `git log --all --not <these shas>`\n\t * (cheap, exact) and diffs this map against the current tips to detect the structural changes that force\n\t * a full fallback: any ref DELETION (key gone) or a NON-fast-forward move (old tip not an ancestor of the\n\t * new tip).\n\t */\n\treadonly tips: ReadonlyMap<string, string>;\n\t/**\n\t * Ordering the prior rows were walked in. The convergence + date-boundary reasoning R6b relies on is only\n\t * sound for `date` order in v1; a seed whose ordering is `author-date`/`topo`, or that disagrees with the\n\t * current walk's ordering, is discarded (full fallback).\n\t */\n\treadonly ordering: 'date' | 'author-date' | 'topo';\n\t/**\n\t * Prior generation's reachability table, to CONTINUE (same role as the sub-provider's `reachabilitySeed`)\n\t * so rows retained across the rebuild keep stable {@link GitGraphRowContexts.reachabilityIndex} values and\n\t * only appended entries ship. R6b decides whether the stitched window extends this builder or needs a\n\t * fresh generation; see `createReachabilityTableBuilder`.\n\t */\n\treadonly reachability?: GraphReachabilityTable;\n\t/**\n\t * Prior generation's per-sha stats. With unchanged ancestry the deferred query recomputes only new\n\t * shas; shallow-boundary or replacement changes invalidate the seed — same role as `rowsStatsSeed`.\n\t */\n\treadonly rowsStats?: GitGraphRowsStats;\n\t/**\n\t * Whether the prior generation had more rows below its loaded window (`paging.hasMore`). The fast path\n\t * can only reconstruct rows the seed carries; when the seed was a partial (paged) load and no new commit\n\t * pushes the window past its limit, `hasMore` must still be reported so the caller keeps paging. Absent ⇒\n\t * treated as `false` (the seed loaded the full history).\n\t */\n\treadonly hasMore?: boolean;\n\t/**\n\t * The `graph.onlyFollowFirstParent` setting the prior rows were walked under. When first-parent is on the\n\t * emitted rows carry sliced (first-parent-only) parents, which the in-memory re-derivation can't expand\n\t * back to the full parent set the walk propagates reachability through — so a seed built under (or a\n\t * current config of) first-parent forces a full fallback. Absent ⇒ treated as `false`.\n\t */\n\treadonly onlyFollowFirstParent?: boolean;\n\treadonly hiddenRefsKey?: string;\n\t/** The prior window's shallow boundary. Compare contents, since partial deepening stays shallow. */\n\treadonly shallowBoundary?: string;\n\t/**\n\t * {@link GitGraph.decorationFingerprint} of the prior walk. R6b falls back to a full walk on ANY change:\n\t * reused rows keep their embedded decorations (upstream/worktree/default/remote/user metadata), so a\n\t * metadata-only change — one that moves no ref tip — would otherwise ship stale pills indefinitely.\n\t * Optional because providers without the incremental machinery (e.g. GitHub) never populate it; absent ⇒\n\t * never matches ⇒ safe full fallback.\n\t */\n\treadonly decorationFingerprint?: string;\n\t/**\n\t * HEAD's tracking upstream (e.g. `origin/main`) as of the prior walk — carried separately from\n\t * {@link decorationFingerprint} so a session REBIND can neutralize it: moving HEAD to another\n\t * worktree's branch changes the fingerprint even though nothing in the repo did, so recomputing the\n\t * seed-comparable fingerprint from this value (old repoPath, everything else current) cancels exactly\n\t * that perspective move. Sound because it feeds only `remotes[].current` on a reused row, which the\n\t * rebind re-derives in memory. Absent compares as \"no upstream\", so an older seed with a real upstream\n\t * compares unequal ⇒ safe full fallback.\n\t */\n\treadonly headRefUpstreamName?: string;\n\t/** Whether {@link headRefUpstreamName} is a local branch rather than a remote-tracking one. */\n\treadonly headRefUpstreamLocal?: boolean;\n}\n\n/**\n * Which path a seeded {@link GitGraphSubProvider.getGraph} call took: the R6b incremental head-walk fast\n * path, or a full ordered walk (with the gate/boundary `reason` that forced it). Reported via the\n * `onIncrementalResult` option so the host can log it and the equivalence harness can assert it. Purely\n * observational — it never changes the returned graph.\n */\nexport interface IncrementalGraphOutcome {\n\treadonly path: 'fast' | 'fallback';\n\treadonly reason?: IncrementalGraphFallbackReason;\n\t/** Fast path only: how many NEW commit rows the incremental enumeration added at the head. */\n\treadonly added?: number;\n}\n\nexport type IncrementalGraphFallbackReason =\n\t| 'no-row-processor'\n\t| 'ordering-not-date'\n\t| 'rev-outside-seed'\n\t| 'first-parent'\n\t| 'hidden-refs-changed'\n\t| 'limit-exceeds-seed'\n\t| 'ref-deleted'\n\t| 'ref-non-fast-forward'\n\t| 'replace-refs-changed'\n\t| 'shallow-changed'\n\t| 'stash-changed'\n\t| 'stash-window-conflict'\n\t| 'date-boundary'\n\t// A decoration side input changed without moving any ref tip (default branch, an upstream, a worktree\n\t// assignment, a remote's url/provider, the current user) — reused rows would keep stale embedded\n\t// decorations, so the walk must rebuild them. See `GitGraph.decorationFingerprint`.\n\t| 'metadata-changed'\n\t// The fast path threw (spawn/arg limits on huge ref sets, queue overflow, transient git errors) —\n\t// never an eligibility gate. The fast path must never fail where the full walk it accelerates\n\t// would succeed, so any unexpected error degrades to the full walk (cancellation still propagates).\n\t| 'error';\n\n/**\n * Processes a single graph row — mutates the row in place.\n *\n * Sets `row.contexts` and `row.message` (e.g., emojified), and resolves `remoteHead.avatarUrl`.\n * Also populates `context.avatars` with email → URL mappings.\n *\n * Per-ref contexts are NOT serialized here. The webview builds them from the structured ref fields\n * (`webviews/apps/plus/graph/utils/refContext.utils.ts`), where live state the host would have baked in\n * stale — whether a branch is starred, which ref is pinned — is actually visible. What remains here needs\n * something the webview cannot reach: the extension's asset URIs, or the whole-row grouping.\n *\n * Called inline during graph row iteration in the library's row-building\n * loop, once per row. Because it runs inside the loop, `more()` pagination\n * automatically gets processing for free — no wrapping needed.\n */\nexport interface GraphRowProcessor {\n\tprocessRow(row: GitGraphRow, context: GraphContext): void;\n\t/**\n\t * Rebuild a reused row's HOST-SERIALIZED contexts (`contexts.refGroups`, a stash row's `contexts.row`)\n\t * for a session rebind. The row's ref ids are already re-stamped by the walk (`restampGraphRowIds`)\n\t * before this runs — since this processor is optional, implementations must read ids as already\n\t * correct and must NOT touch them again, nor message/author (not idempotent).\n\t */\n\trestampRow?(row: GitGraphRow, context: GraphContext): void;\n}\n\nexport interface GraphContext {\n\treadonly repoPath: string;\n\treadonly useAvatars: boolean;\n\treadonly branches: ReadonlyMap<string, GitBranch>;\n\treadonly remotes: ReadonlyMap<string, GitRemote>;\n\treadonly worktreesByBranch: ReadonlyMap<string, GitWorktree> | undefined;\n\treadonly branchIdOfMainWorktree: string | undefined;\n\treadonly stashes: ReadonlyMap<string, GitStashCommit> | undefined;\n\treadonly reachableFromHEAD: ReadonlySet<string>;\n\t/** SHAs on the first-parent chain from HEAD up to (excluding) the first merge commit — the commits\n\t * a plain interactive rebase can safely rewrite. Empty when HEAD is a merge. Sets the\n\t * {@link GitGraphRowContextFlags.RewriteableFromHead} flag, gating squash/drop/reword/modify. */\n\treadonly rewriteableFromHEAD: ReadonlySet<string>;\n\t/** The subset of undo-eligible tip shas (active HEAD + worktree HEADs) that have at least one\n\t * child — i.e. are NOT leaves. Scoped to tips (not all commits) for performance; do not treat as\n\t * a general has-children signal. Sets the {@link GitGraphRowContextFlags.HasChildren} flag, which\n\t * gates Undo Commit to leaf tips. */\n\treadonly tipShasWithChildren: ReadonlySet<string>;\n\t/** SHAs reachable from HEAD's tracking-upstream tip, or `undefined` when HEAD has no upstream.\n\t * A commit reachable from HEAD but NOT from this set is unpushed (`+unpublished`); `undefined`\n\t * means there's no upstream to be ahead of, so nothing is flagged. */\n\treadonly reachableFromHeadUpstream: ReadonlySet<string> | undefined;\n\treadonly avatars: Map<string, string>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6FA,IAAkB,0BAAX,yBAAA,yBAAA;CACN,wBAAA,wBAAA,UAAA,KAAA;CACA,wBAAA,wBAAA,uBAAA,KAAA;CACA,wBAAA,wBAAA,oBAAA,KAAA;CACA,wBAAA,wBAAA,iBAAA,KAAA;CACA,wBAAA,wBAAA,iBAAA,KAAA;CACA,wBAAA,wBAAA,yBAAA,MAAA;CACA,wBAAA,wBAAA,cAAA,MAAA;;AACD,EAAA,CAAA,CAAA"}
|
|
@@ -59,8 +59,16 @@ export interface GitGraphSession {
|
|
|
59
59
|
* full walk only when a genuine structural/metadata change happened concurrently.
|
|
60
60
|
*/
|
|
61
61
|
rebind(repoPath: string, cancellation?: AbortSignal): Promise<GitGraphSessionRefreshResult>;
|
|
62
|
+
getCommitVisibility?(sha: string, cancellation?: AbortSignal): Promise<GitGraphCommitVisibility>;
|
|
63
|
+
getUnreachableCommits?(shas: readonly string[], cancellation?: AbortSignal): Promise<Set<string>>;
|
|
62
64
|
dispose(): void;
|
|
63
65
|
}
|
|
66
|
+
export type GitGraphCommitVisibility = {
|
|
67
|
+
readonly status: 'visible' | 'outside' | 'missing';
|
|
68
|
+
} | {
|
|
69
|
+
readonly status: 'hidden';
|
|
70
|
+
readonly pattern?: string;
|
|
71
|
+
};
|
|
64
72
|
export interface GitGraphSessionRefreshOptions {
|
|
65
73
|
/** Rebuild anchor / find target — the loaded window's bottom sha (pins the walk's bottom boundary),
|
|
66
74
|
* or a selection/centering hint. Mirrors the `rev` the host passed to `getGraph` today. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphSession.js","names":[],"sources":["../../../../git/src/models/graphSession.ts"],"sourcesContent":["import type { GitGraph, GitGraphRow, IncrementalGraphFallbackReason } from './graph.js';\n\n/**\n * A provider-owned, stateful graph window for a single repo. It is the canonical accumulated window and\n * the single builder of the incremental rebuild seed — the host no longer mirrors loaded rows, stamps\n * ref tips, or hand-assembles the {@link GraphIncrementalSeed}; the session owns its own walk shape and\n * cannot be handed a lying seed.\n *\n * R7a is a behavior-neutral ownership move: {@link refresh} is a facade over the provider's existing\n * `getGraph` incremental machinery (it internally builds the seed from the accumulated window, tips, and\n * prior artifacts, with the same shape gating), {@link more} delegates to the prior result's `more()`,\n * and {@link current} mirrors today's `GitGraph` result shape so the publisher/wire semantics stay\n * byte-identical. R7b (refresh-result-driven channel marking) extends this without breaking —\n * {@link refresh} returns a result object, never a bare `GitGraph`.\n *\n * CONCURRENCY — the session is SINGLE-WRITER: {@link refresh}, {@link rebind} and {@link more} serialize\n * in call order, so `repoPath` and every row in `window` always describe the last completed operation,\n * never a torn mix of two. A page queued when a refresh/rebind REPLACES the window it targets is refused\n * (`more` answers `'superseded'`) rather than spliced onto a cursor that no longer fits — see {@link more}.\n *\n * READS are not serialized: a caller that must not observe a half-rebuilt window gates its own read.\n */\nexport interface GitGraphSession {\n\t/** The CURRENT bound path — the repo the session was opened for, or the worktree it was last\n\t * {@link rebind}-ed onto. */\n\treadonly repoPath: string;\n\n\t/** Canonical accumulated window (the FULL loaded rows, never page-scoped after pagination). */\n\treadonly window: readonly GitGraphRow[];\n\n\t/**\n\t * True while {@link window}/{@link current} are known CORRUPT from a walk that failed part-way through\n\t * mutating them in place. Clears on the next (forced) rebuild. A caller that would SERVE these rows\n\t * must check this first — reads bypass the write queue, so nothing else enforces it.\n\t */\n\treadonly tainted: boolean;\n\n\t/**\n\t * Last-operation view mirroring today's `GitGraph` result shape: page-scoped `rows` after a\n\t * {@link more}, the full window after a {@link refresh}. Keeps the publisher's `getRows`/`getPaging`\n\t * and every graph-level read (`branches`, `remotes`, `stashes`, `ids`, `avatars`, `rowsStats`, …)\n\t * exactly as they read `_graph` today.\n\t */\n\treadonly current: GitGraph;\n\n\t/**\n\t * Re-walk the repo, accumulating the fresh full window. Internally seeds the incremental head-walk\n\t * fast path from the prior window/tips/artifacts (same shape gating as the host did) and falls back\n\t * to a full walk on any structural change; the result surfaces which path ran so a later stage can\n\t * mark channels precisely.\n\t */\n\trefresh(options?: GitGraphSessionRefreshOptions, cancellation?: AbortSignal): Promise<GitGraphSessionRefreshResult>;\n\n\t/**\n\t * Page more rows into the window (accumulates; `current` becomes the page view). See\n\t * {@link GitGraphSessionMoreResult} — a caller MUST distinguish `'superseded'` (retry) from `'none'`\n\t * (don't).\n\t */\n\tmore(limit?: number, targetId?: string, cancellation?: AbortSignal): Promise<GitGraphSessionMoreResult>;\n\n\t/**\n\t * Re-perspective the session onto another worktree of the SAME repo family without discarding\n\t * the accumulated window. Rides the incremental fast path: unchanged tips, HEAD endpoints\n\t * refetched, flags/reachability replayed, ref ids re-stamped to the new path. Falls back to a\n\t * full walk only when a genuine structural/metadata change happened concurrently.\n\t */\n\trebind(repoPath: string, cancellation?: AbortSignal): Promise<GitGraphSessionRefreshResult>;\n\n\tdispose(): void;\n}\n\nexport interface GitGraphSessionRefreshOptions {\n\t/** Rebuild anchor / find target — the loaded window's bottom sha (pins the walk's bottom boundary),\n\t * or a selection/centering hint. Mirrors the `rev` the host passed to `getGraph` today. */\n\trev?: string;\n\tlimit?: number;\n\tinclude?: { stats?: boolean };\n\t/**\n\t * Force a FULL walk (skip the incremental seed) so every row's decorations — including the\n\t * host-serialized webview-item contexts reused rows otherwise keep — are rebuilt from fresh inputs.\n\t * For host-known invalidations the provider can't observe (pinned-ref changes, integration\n\t * connections); rare events, so the full-walk cost is acceptable.\n\t */\n\trebuild?: boolean;\n}\n\n/**\n * Outcome of a {@link GitGraphSession.refresh}. `path` is `'fast'` only when the incremental head-walk\n * fast path ran; a seeded fallback and an unseeded full walk both report `'full'` — a seeded fallback\n * additionally carries `reason` (an unseeded full walk carries none), so a consumer can distinguish the\n * two exactly as the host's `[graph] incremental walk` log did (log on `'fast'` or a `reason`, silent\n * otherwise).\n */\nexport interface GitGraphSessionRefreshResult {\n\treadonly path: 'fast' | 'full';\n\t/** Present only on a SEEDED refresh that fell back to the full walk — the gate/boundary that forced it. */\n\treadonly reason?: IncrementalGraphFallbackReason;\n\t/** Fast path only: how many NEW commit rows the incremental enumeration added at the head. */\n\treadonly added?: number;\n\t/**\n\t * Which rows-plane channels this refresh actually changed, so the host marks the publisher precisely\n\t * instead of dirtying all six on every refresh. Filled by BOTH paths: the full path reports every\n\t * channel changed (a fresh walk replaces all); the fast path derives each honestly from its own work.\n\t * Correctness rule: a false negative is data loss, so a channel is reported `false` only when it\n\t * PROVABLY didn't change — never merely when uncertain. Excludes `refsMetadata`, which the session\n\t * doesn't produce (the host marks it via its own dedicated enrichment path).\n\t */\n\treadonly changed: GitGraphSessionChangedChannels;\n}\n\n/** Per-channel change flags a {@link GitGraphSession.refresh} reports (see {@link GitGraphSessionRefreshResult.changed}). */\nexport interface GitGraphSessionChangedChannels {\n\t/** The loaded rows window — always `true` on a refresh (a head-walk reshapes it; the publisher's ledger\n\t * diff derives the precise splice, including reused-row flag/reachability-index changes). */\n\treadonly rows: boolean;\n\t/** The shared reachability table grew (new dictionary/set entries appended) or started a new generation. */\n\treadonly reachability: boolean;\n\t/** New commit shas were introduced whose stats will be (re)queried. */\n\treadonly rowsStats: boolean;\n\t/** A refresh invalidated stats for already-shipped shas because ancestry changed\n\t * (shallow boundary / replace refs), or asynchronous error recovery could observe different ancestry.\n\t * The host must replace rows and stats together with a snapshot: same-sha row reuse can retain\n\t * stale parents, and stats deduplication can retain stale values. */\n\treadonly rowsStatsRecomputed?: boolean;\n\t/** New avatar emails appeared in the map (value replacements ride the host's dedicated avatar path). */\n\treadonly avatars: boolean;\n\t/** The downstreams map (upstream name → tracking branch names) changed. */\n\treadonly downstreams: boolean;\n}\n\n/**\n * The outcome of a {@link GitGraphSession.more}. Three states, not a boolean, because the caller's correct\n * response to two of them differs: a page that was REFUSED must be retried, while a page that found\n * nothing must not (retrying it spins).\n */\nexport type GitGraphSessionMoreResult =\n\t/** Rows were paged in — `current` is the page view and `window` grew. */\n\t| 'added'\n\t/** Nothing to add: history is exhausted, or the walk came back empty. Terminal for this request. */\n\t| 'none'\n\t/**\n\t * REFUSED, having walked nothing and changed nothing: a {@link GitGraphSession.refresh} or\n\t * {@link GitGraphSession.rebind} replaced the window this page targeted while it was queued. The\n\t * caller must RE-REQUEST against the current window (re-deriving cursor/limit) rather than treat this\n\t * as terminal — the rows are still there to page.\n\t */\n\t| 'superseded';\n\n/**\n * The concurrency contract every {@link GitGraphSession} implementation shares — compose it\n * (`private readonly writes = new GraphSessionWriteQueue()`) rather than reimplementing it, so the two\n * implementations cannot drift apart.\n *\n * {@link run} makes every mutating op single-writer: no interleaving, no torn window. {@link generation}\n * (via {@link runPage}) separately answers whether a QUEUED page still targets the window that exists,\n * since queueing alone can't. READS are not covered — `current`/`window` are plain getters, readable at\n * any time including mid-walk; a caller that must not observe a half-rebuilt window gates its own read.\n *\n * DEADLOCK-FREEDOM requires the function handed to {@link run} to await only its own walk, never a\n * promise a caller might be waiting on — sequencing waits belong strictly BEFORE the op enters the queue.\n */\nexport class GraphSessionWriteQueue {\n\t/** Tail of the queue. Starts settled so the first op runs immediately. */\n\tprivate _tail: Promise<unknown> = Promise.resolve();\n\tprivate _generation = 0;\n\tprivate _tainted = false;\n\n\t/**\n\t * The window is known-CORRUPT and must not be served until a rebuild repairs it — see {@link taint}.\n\t * Consulted by readers, which is the point: the queue keeps writers apart, but a reader of `current`\n\t * never enters it, so the only way a corrupt window can be kept off screen is for the reader to ask.\n\t */\n\tget tainted(): boolean {\n\t\treturn this._tainted;\n\t}\n\n\t/** Monotonic id of the CURRENT window. See {@link invalidate}. */\n\tget generation(): number {\n\t\treturn this._generation;\n\t}\n\n\t/**\n\t * Call when the window has been REPLACED (a full/incremental rebuild), never when merely extended —\n\t * appending a page leaves every held cursor valid. Also the REPAIR for a tainted window, so it clears\n\t * {@link tainted}.\n\t */\n\tinvalidate(): void {\n\t\tthis._generation++;\n\t\tthis._tainted = false;\n\t}\n\n\t/**\n\t * Call when a walk failed PART-WAY THROUGH mutating the window in place, leaving some rows re-stamped\n\t * and some not. Advances the generation, same as {@link invalidate}, so a queued page is refused rather\n\t * than appended to a corrupt window — and additionally raises {@link tainted}, since refusing pages\n\t * doesn't stop a reader from serving the window directly.\n\t */\n\ttaint(): void {\n\t\tthis._generation++;\n\t\tthis._tainted = true;\n\t}\n\n\t/** Runs `op` after every op queued before it has settled. */\n\trun<T>(op: () => Promise<T>): Promise<T> {\n\t\t// `.catch` BEFORE `.then` so a rejected predecessor can't wedge the queue — without it every later\n\t\t// op would inherit the rejection and never run its body at all.\n\t\tconst next = this._tail.catch(() => undefined).then(op);\n\t\t// The caller's promise IS the tail, so a rejection the caller handles is never ALSO an unhandled\n\t\t// rejection on a derived promise nobody holds a reference to.\n\t\tthis._tail = next;\n\t\treturn next;\n\t}\n\n\t/**\n\t * Runs a PAGE. Captures {@link generation} synchronously HERE, before queueing, and refuses the page\n\t * without running `op` if the window has been replaced by the time it reaches the front — the\n\t * `'superseded'` half of {@link GitGraphSessionMoreResult}.\n\t */\n\trunPage(op: () => Promise<GitGraphSessionMoreResult>): Promise<GitGraphSessionMoreResult> {\n\t\tconst generation = this._generation;\n\t\treturn this.run(() => {\n\t\t\t// Two ways a page can go stale by now, both answering `'superseded'`: the window it was cut from\n\t\t\t// was REPLACED (generation moved), or it's TAINTED — generation alone can't catch the latter, since\n\t\t\t// a page requested AFTER the corruption still sees a stable generation.\n\t\t\tif (this._tainted || this._generation !== generation) return Promise.resolve('superseded' as const);\n\n\t\t\treturn op();\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAiKA,IAAa,yBAAb,MAAoC;;CAEnC,QAAkC,QAAQ,QAAQ;CAClD,cAAsB;CACtB,WAAmB;;;;;;CAOnB,IAAI,UAAmB;EACtB,OAAO,KAAK;CACb;;CAGA,IAAI,aAAqB;EACxB,OAAO,KAAK;CACb;;;;;;CAOA,aAAmB;EAClB,KAAK;EACL,KAAK,WAAW;CACjB;;;;;;;CAQA,QAAc;EACb,KAAK;EACL,KAAK,WAAW;CACjB;;CAGA,IAAO,IAAkC;EAGxC,MAAM,OAAO,KAAK,MAAM,YAAY,KAAA,CAAS,CAAC,CAAC,KAAK,EAAE;EAGtD,KAAK,QAAQ;EACb,OAAO;CACR;;;;;;CAOA,QAAQ,IAAkF;EACzF,MAAM,aAAa,KAAK;EACxB,OAAO,KAAK,UAAU;GAIrB,IAAI,KAAK,YAAY,KAAK,gBAAgB,YAAY,OAAO,QAAQ,QAAQ,YAAqB;GAElG,OAAO,GAAG;EACX,CAAC;CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"graphSession.js","names":[],"sources":["../../../../git/src/models/graphSession.ts"],"sourcesContent":["import type { GitGraph, GitGraphRow, IncrementalGraphFallbackReason } from './graph.js';\n\n/**\n * A provider-owned, stateful graph window for a single repo. It is the canonical accumulated window and\n * the single builder of the incremental rebuild seed — the host no longer mirrors loaded rows, stamps\n * ref tips, or hand-assembles the {@link GraphIncrementalSeed}; the session owns its own walk shape and\n * cannot be handed a lying seed.\n *\n * R7a is a behavior-neutral ownership move: {@link refresh} is a facade over the provider's existing\n * `getGraph` incremental machinery (it internally builds the seed from the accumulated window, tips, and\n * prior artifacts, with the same shape gating), {@link more} delegates to the prior result's `more()`,\n * and {@link current} mirrors today's `GitGraph` result shape so the publisher/wire semantics stay\n * byte-identical. R7b (refresh-result-driven channel marking) extends this without breaking —\n * {@link refresh} returns a result object, never a bare `GitGraph`.\n *\n * CONCURRENCY — the session is SINGLE-WRITER: {@link refresh}, {@link rebind} and {@link more} serialize\n * in call order, so `repoPath` and every row in `window` always describe the last completed operation,\n * never a torn mix of two. A page queued when a refresh/rebind REPLACES the window it targets is refused\n * (`more` answers `'superseded'`) rather than spliced onto a cursor that no longer fits — see {@link more}.\n *\n * READS are not serialized: a caller that must not observe a half-rebuilt window gates its own read.\n */\nexport interface GitGraphSession {\n\t/** The CURRENT bound path — the repo the session was opened for, or the worktree it was last\n\t * {@link rebind}-ed onto. */\n\treadonly repoPath: string;\n\n\t/** Canonical accumulated window (the FULL loaded rows, never page-scoped after pagination). */\n\treadonly window: readonly GitGraphRow[];\n\n\t/**\n\t * True while {@link window}/{@link current} are known CORRUPT from a walk that failed part-way through\n\t * mutating them in place. Clears on the next (forced) rebuild. A caller that would SERVE these rows\n\t * must check this first — reads bypass the write queue, so nothing else enforces it.\n\t */\n\treadonly tainted: boolean;\n\n\t/**\n\t * Last-operation view mirroring today's `GitGraph` result shape: page-scoped `rows` after a\n\t * {@link more}, the full window after a {@link refresh}. Keeps the publisher's `getRows`/`getPaging`\n\t * and every graph-level read (`branches`, `remotes`, `stashes`, `ids`, `avatars`, `rowsStats`, …)\n\t * exactly as they read `_graph` today.\n\t */\n\treadonly current: GitGraph;\n\n\t/**\n\t * Re-walk the repo, accumulating the fresh full window. Internally seeds the incremental head-walk\n\t * fast path from the prior window/tips/artifacts (same shape gating as the host did) and falls back\n\t * to a full walk on any structural change; the result surfaces which path ran so a later stage can\n\t * mark channels precisely.\n\t */\n\trefresh(options?: GitGraphSessionRefreshOptions, cancellation?: AbortSignal): Promise<GitGraphSessionRefreshResult>;\n\n\t/**\n\t * Page more rows into the window (accumulates; `current` becomes the page view). See\n\t * {@link GitGraphSessionMoreResult} — a caller MUST distinguish `'superseded'` (retry) from `'none'`\n\t * (don't).\n\t */\n\tmore(limit?: number, targetId?: string, cancellation?: AbortSignal): Promise<GitGraphSessionMoreResult>;\n\n\t/**\n\t * Re-perspective the session onto another worktree of the SAME repo family without discarding\n\t * the accumulated window. Rides the incremental fast path: unchanged tips, HEAD endpoints\n\t * refetched, flags/reachability replayed, ref ids re-stamped to the new path. Falls back to a\n\t * full walk only when a genuine structural/metadata change happened concurrently.\n\t */\n\trebind(repoPath: string, cancellation?: AbortSignal): Promise<GitGraphSessionRefreshResult>;\n\n\tgetCommitVisibility?(sha: string, cancellation?: AbortSignal): Promise<GitGraphCommitVisibility>;\n\tgetUnreachableCommits?(shas: readonly string[], cancellation?: AbortSignal): Promise<Set<string>>;\n\n\tdispose(): void;\n}\n\nexport type GitGraphCommitVisibility =\n\t| { readonly status: 'visible' | 'outside' | 'missing' }\n\t| { readonly status: 'hidden'; readonly pattern?: string };\n\nexport interface GitGraphSessionRefreshOptions {\n\t/** Rebuild anchor / find target — the loaded window's bottom sha (pins the walk's bottom boundary),\n\t * or a selection/centering hint. Mirrors the `rev` the host passed to `getGraph` today. */\n\trev?: string;\n\tlimit?: number;\n\tinclude?: { stats?: boolean };\n\t/**\n\t * Force a FULL walk (skip the incremental seed) so every row's decorations — including the\n\t * host-serialized webview-item contexts reused rows otherwise keep — are rebuilt from fresh inputs.\n\t * For host-known invalidations the provider can't observe (pinned-ref changes, integration\n\t * connections); rare events, so the full-walk cost is acceptable.\n\t */\n\trebuild?: boolean;\n}\n\n/**\n * Outcome of a {@link GitGraphSession.refresh}. `path` is `'fast'` only when the incremental head-walk\n * fast path ran; a seeded fallback and an unseeded full walk both report `'full'` — a seeded fallback\n * additionally carries `reason` (an unseeded full walk carries none), so a consumer can distinguish the\n * two exactly as the host's `[graph] incremental walk` log did (log on `'fast'` or a `reason`, silent\n * otherwise).\n */\nexport interface GitGraphSessionRefreshResult {\n\treadonly path: 'fast' | 'full';\n\t/** Present only on a SEEDED refresh that fell back to the full walk — the gate/boundary that forced it. */\n\treadonly reason?: IncrementalGraphFallbackReason;\n\t/** Fast path only: how many NEW commit rows the incremental enumeration added at the head. */\n\treadonly added?: number;\n\t/**\n\t * Which rows-plane channels this refresh actually changed, so the host marks the publisher precisely\n\t * instead of dirtying all six on every refresh. Filled by BOTH paths: the full path reports every\n\t * channel changed (a fresh walk replaces all); the fast path derives each honestly from its own work.\n\t * Correctness rule: a false negative is data loss, so a channel is reported `false` only when it\n\t * PROVABLY didn't change — never merely when uncertain. Excludes `refsMetadata`, which the session\n\t * doesn't produce (the host marks it via its own dedicated enrichment path).\n\t */\n\treadonly changed: GitGraphSessionChangedChannels;\n}\n\n/** Per-channel change flags a {@link GitGraphSession.refresh} reports (see {@link GitGraphSessionRefreshResult.changed}). */\nexport interface GitGraphSessionChangedChannels {\n\t/** The loaded rows window — always `true` on a refresh (a head-walk reshapes it; the publisher's ledger\n\t * diff derives the precise splice, including reused-row flag/reachability-index changes). */\n\treadonly rows: boolean;\n\t/** The shared reachability table grew (new dictionary/set entries appended) or started a new generation. */\n\treadonly reachability: boolean;\n\t/** New commit shas were introduced whose stats will be (re)queried. */\n\treadonly rowsStats: boolean;\n\t/** A refresh invalidated stats for already-shipped shas because ancestry changed\n\t * (shallow boundary / replace refs), or asynchronous error recovery could observe different ancestry.\n\t * The host must replace rows and stats together with a snapshot: same-sha row reuse can retain\n\t * stale parents, and stats deduplication can retain stale values. */\n\treadonly rowsStatsRecomputed?: boolean;\n\t/** New avatar emails appeared in the map (value replacements ride the host's dedicated avatar path). */\n\treadonly avatars: boolean;\n\t/** The downstreams map (upstream name → tracking branch names) changed. */\n\treadonly downstreams: boolean;\n}\n\n/**\n * The outcome of a {@link GitGraphSession.more}. Three states, not a boolean, because the caller's correct\n * response to two of them differs: a page that was REFUSED must be retried, while a page that found\n * nothing must not (retrying it spins).\n */\nexport type GitGraphSessionMoreResult =\n\t/** Rows were paged in — `current` is the page view and `window` grew. */\n\t| 'added'\n\t/** Nothing to add: history is exhausted, or the walk came back empty. Terminal for this request. */\n\t| 'none'\n\t/**\n\t * REFUSED, having walked nothing and changed nothing: a {@link GitGraphSession.refresh} or\n\t * {@link GitGraphSession.rebind} replaced the window this page targeted while it was queued. The\n\t * caller must RE-REQUEST against the current window (re-deriving cursor/limit) rather than treat this\n\t * as terminal — the rows are still there to page.\n\t */\n\t| 'superseded';\n\n/**\n * The concurrency contract every {@link GitGraphSession} implementation shares — compose it\n * (`private readonly writes = new GraphSessionWriteQueue()`) rather than reimplementing it, so the two\n * implementations cannot drift apart.\n *\n * {@link run} makes every mutating op single-writer: no interleaving, no torn window. {@link generation}\n * (via {@link runPage}) separately answers whether a QUEUED page still targets the window that exists,\n * since queueing alone can't. READS are not covered — `current`/`window` are plain getters, readable at\n * any time including mid-walk; a caller that must not observe a half-rebuilt window gates its own read.\n *\n * DEADLOCK-FREEDOM requires the function handed to {@link run} to await only its own walk, never a\n * promise a caller might be waiting on — sequencing waits belong strictly BEFORE the op enters the queue.\n */\nexport class GraphSessionWriteQueue {\n\t/** Tail of the queue. Starts settled so the first op runs immediately. */\n\tprivate _tail: Promise<unknown> = Promise.resolve();\n\tprivate _generation = 0;\n\tprivate _tainted = false;\n\n\t/**\n\t * The window is known-CORRUPT and must not be served until a rebuild repairs it — see {@link taint}.\n\t * Consulted by readers, which is the point: the queue keeps writers apart, but a reader of `current`\n\t * never enters it, so the only way a corrupt window can be kept off screen is for the reader to ask.\n\t */\n\tget tainted(): boolean {\n\t\treturn this._tainted;\n\t}\n\n\t/** Monotonic id of the CURRENT window. See {@link invalidate}. */\n\tget generation(): number {\n\t\treturn this._generation;\n\t}\n\n\t/**\n\t * Call when the window has been REPLACED (a full/incremental rebuild), never when merely extended —\n\t * appending a page leaves every held cursor valid. Also the REPAIR for a tainted window, so it clears\n\t * {@link tainted}.\n\t */\n\tinvalidate(): void {\n\t\tthis._generation++;\n\t\tthis._tainted = false;\n\t}\n\n\t/**\n\t * Call when a walk failed PART-WAY THROUGH mutating the window in place, leaving some rows re-stamped\n\t * and some not. Advances the generation, same as {@link invalidate}, so a queued page is refused rather\n\t * than appended to a corrupt window — and additionally raises {@link tainted}, since refusing pages\n\t * doesn't stop a reader from serving the window directly.\n\t */\n\ttaint(): void {\n\t\tthis._generation++;\n\t\tthis._tainted = true;\n\t}\n\n\t/** Runs `op` after every op queued before it has settled. */\n\trun<T>(op: () => Promise<T>): Promise<T> {\n\t\t// `.catch` BEFORE `.then` so a rejected predecessor can't wedge the queue — without it every later\n\t\t// op would inherit the rejection and never run its body at all.\n\t\tconst next = this._tail.catch(() => undefined).then(op);\n\t\t// The caller's promise IS the tail, so a rejection the caller handles is never ALSO an unhandled\n\t\t// rejection on a derived promise nobody holds a reference to.\n\t\tthis._tail = next;\n\t\treturn next;\n\t}\n\n\t/**\n\t * Runs a PAGE. Captures {@link generation} synchronously HERE, before queueing, and refuses the page\n\t * without running `op` if the window has been replaced by the time it reaches the front — the\n\t * `'superseded'` half of {@link GitGraphSessionMoreResult}.\n\t */\n\trunPage(op: () => Promise<GitGraphSessionMoreResult>): Promise<GitGraphSessionMoreResult> {\n\t\tconst generation = this._generation;\n\t\treturn this.run(() => {\n\t\t\t// Two ways a page can go stale by now, both answering `'superseded'`: the window it was cut from\n\t\t\t// was REPLACED (generation moved), or it's TAINTED — generation alone can't catch the latter, since\n\t\t\t// a page requested AFTER the corruption still sees a stable generation.\n\t\t\tif (this._tainted || this._generation !== generation) return Promise.resolve('superseded' as const);\n\n\t\t\treturn op();\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAwKA,IAAa,yBAAb,MAAoC;;CAEnC,QAAkC,QAAQ,QAAQ;CAClD,cAAsB;CACtB,WAAmB;;;;;;CAOnB,IAAI,UAAmB;EACtB,OAAO,KAAK;CACb;;CAGA,IAAI,aAAqB;EACxB,OAAO,KAAK;CACb;;;;;;CAOA,aAAmB;EAClB,KAAK;EACL,KAAK,WAAW;CACjB;;;;;;;CAQA,QAAc;EACb,KAAK;EACL,KAAK,WAAW;CACjB;;CAGA,IAAO,IAAkC;EAGxC,MAAM,OAAO,KAAK,MAAM,YAAY,KAAA,CAAS,CAAC,CAAC,KAAK,EAAE;EAGtD,KAAK,QAAQ;EACb,OAAO;CACR;;;;;;CAOA,QAAQ,IAAkF;EACzF,MAAM,aAAa,KAAK;EACxB,OAAO,KAAK,UAAU;GAIrB,IAAI,KAAK,YAAY,KAAK,gBAAgB,YAAY,OAAO,QAAQ,QAAQ,YAAqB;GAElG,OAAO,GAAG;EACX,CAAC;CACF;AACD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readCQuotedString, unquoteCString } from "../../utils/string.js";
|
|
2
2
|
import { fileUri, joinUriPath } from "../../utils/uri.js";
|
|
3
3
|
import { normalizePath } from "../../utils/path.js";
|
|
4
|
-
import { GitFileIndexStatus } from "../models/fileStatus.js";
|
|
5
4
|
import { maybeStopWatch } from "../../utils/stopwatch.js";
|
|
5
|
+
import { GitFileIndexStatus } from "../models/fileStatus.js";
|
|
6
6
|
import _usingCtx from "../../_virtual/@oxc-project+runtime/helpers/esm/usingCtx.js";
|
|
7
7
|
import { GitFileChange } from "../models/fileChange.js";
|
|
8
8
|
//#region ../git/src/parsers/diffParser.ts
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region ../git/src/utils/hiddenRefs.utils.d.ts
|
|
2
|
+
export type HiddenRefRefusalReason = 'coreNamespace' | 'negation' | 'invalid';
|
|
3
|
+
export interface NormalizedHiddenRefPatterns {
|
|
4
|
+
readonly patterns: string[];
|
|
5
|
+
readonly key: string;
|
|
6
|
+
readonly refused: {
|
|
7
|
+
pattern: string;
|
|
8
|
+
reason: HiddenRefRefusalReason;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export declare function normalizeHiddenRefPatterns(raw: unknown): NormalizedHiddenRefPatterns;
|
|
12
|
+
export declare function getHiddenRefExcludeArgs(patterns: readonly string[]): string[];
|
|
13
|
+
export declare function getHiddenRefPatternGroups(patterns: readonly string[]): Map<string, string[]>;
|
|
14
|
+
export interface HiddenRefPatternValues {
|
|
15
|
+
readonly defaultValue?: Readonly<Record<string, boolean>>;
|
|
16
|
+
readonly globalValue?: Readonly<Record<string, boolean>>;
|
|
17
|
+
readonly workspaceValue?: Readonly<Record<string, boolean>>;
|
|
18
|
+
}
|
|
19
|
+
export interface HiddenRefPatternDisable {
|
|
20
|
+
readonly target: 'global' | 'workspace';
|
|
21
|
+
readonly keys: string[];
|
|
22
|
+
readonly value: Record<string, boolean>;
|
|
23
|
+
}
|
|
24
|
+
export declare function getHiddenRefPatternDisable(values: HiddenRefPatternValues, pattern: string): HiddenRefPatternDisable | undefined;
|
|
25
|
+
//#endregion
|
|
26
|
+
//# sourceMappingURL=hiddenRefs.utils.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//#region ../git/src/utils/hiddenRefs.utils.ts
|
|
2
|
+
const coreNamespaces = /* @__PURE__ */ new Set([
|
|
3
|
+
"heads",
|
|
4
|
+
"remotes",
|
|
5
|
+
"tags",
|
|
6
|
+
"stash"
|
|
7
|
+
]);
|
|
8
|
+
const namespacePattern = /^refs\/([^/*?[\]\\]+)(?:\/.+)?$/;
|
|
9
|
+
const globPattern = /[*?[]/;
|
|
10
|
+
function normalizeHiddenRefPatterns(raw) {
|
|
11
|
+
const output = /* @__PURE__ */ new Set();
|
|
12
|
+
const refused = [];
|
|
13
|
+
if (raw != null && typeof raw === "object" && !Array.isArray(raw)) for (const [pattern, enabled] of Object.entries(raw)) {
|
|
14
|
+
if (typeof enabled !== "boolean") {
|
|
15
|
+
refused.push({
|
|
16
|
+
pattern,
|
|
17
|
+
reason: "invalid"
|
|
18
|
+
});
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (!enabled) continue;
|
|
22
|
+
let key = pattern.trim().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
23
|
+
if (!key) continue;
|
|
24
|
+
if (key.startsWith("!")) {
|
|
25
|
+
refused.push({
|
|
26
|
+
pattern,
|
|
27
|
+
reason: "negation"
|
|
28
|
+
});
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (!key.startsWith("refs/")) key = `refs/${key}`;
|
|
32
|
+
const match = namespacePattern.exec(key);
|
|
33
|
+
if (match == null || coreNamespaces.has(match[1])) {
|
|
34
|
+
refused.push({
|
|
35
|
+
pattern,
|
|
36
|
+
reason: "coreNamespace"
|
|
37
|
+
});
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
output.add(key);
|
|
41
|
+
if (!globPattern.test(key)) output.add(`${key}/*`);
|
|
42
|
+
}
|
|
43
|
+
const patterns = [...output].sort();
|
|
44
|
+
return {
|
|
45
|
+
patterns,
|
|
46
|
+
key: JSON.stringify(patterns),
|
|
47
|
+
refused
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function getHiddenRefExcludeArgs(patterns) {
|
|
51
|
+
return patterns.map((p) => `--exclude=${p}`);
|
|
52
|
+
}
|
|
53
|
+
function getHiddenRefPatternGroups(patterns) {
|
|
54
|
+
const groups = /* @__PURE__ */ new Map();
|
|
55
|
+
for (const pattern of patterns) {
|
|
56
|
+
if (pattern.endsWith("/*")) {
|
|
57
|
+
const base = pattern.slice(0, -2);
|
|
58
|
+
if (!globPattern.test(base) && patterns.includes(base)) continue;
|
|
59
|
+
}
|
|
60
|
+
const nested = `${pattern}/*`;
|
|
61
|
+
groups.set(pattern, !globPattern.test(pattern) && patterns.includes(nested) ? [pattern, nested] : [pattern]);
|
|
62
|
+
}
|
|
63
|
+
return groups;
|
|
64
|
+
}
|
|
65
|
+
function getHiddenRefPatternDisable(values, pattern) {
|
|
66
|
+
const global = values.globalValue ?? {};
|
|
67
|
+
const workspace = values.workspaceValue ?? {};
|
|
68
|
+
const effective = {
|
|
69
|
+
...values.defaultValue,
|
|
70
|
+
...global,
|
|
71
|
+
...workspace
|
|
72
|
+
};
|
|
73
|
+
const members = getHiddenRefPatternGroups(normalizeHiddenRefPatterns(effective).patterns).get(pattern);
|
|
74
|
+
if (members == null) return void 0;
|
|
75
|
+
const keys = Object.keys(effective).filter((k) => effective[k] === true && normalizeHiddenRefPatterns({ [k]: true }).patterns.some((p) => members.includes(p)));
|
|
76
|
+
if (!keys.length) return void 0;
|
|
77
|
+
const target = keys.some((k) => workspace[k] === true) ? "workspace" : "global";
|
|
78
|
+
const value = { ...target === "workspace" ? workspace : global };
|
|
79
|
+
for (const k of keys) value[k] = false;
|
|
80
|
+
return {
|
|
81
|
+
target,
|
|
82
|
+
keys,
|
|
83
|
+
value
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { getHiddenRefExcludeArgs, getHiddenRefPatternDisable, getHiddenRefPatternGroups, normalizeHiddenRefPatterns };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=hiddenRefs.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hiddenRefs.utils.js","names":[],"sources":["../../../../git/src/utils/hiddenRefs.utils.ts"],"sourcesContent":["export type HiddenRefRefusalReason = 'coreNamespace' | 'negation' | 'invalid';\n\nexport interface NormalizedHiddenRefPatterns {\n\treadonly patterns: string[];\n\treadonly key: string;\n\treadonly refused: { pattern: string; reason: HiddenRefRefusalReason }[];\n}\n\nconst coreNamespaces = new Set(['heads', 'remotes', 'tags', 'stash']);\nconst namespacePattern = /^refs\\/([^/*?[\\]\\\\]+)(?:\\/.+)?$/;\nconst globPattern = /[*?[]/;\n\nexport function normalizeHiddenRefPatterns(raw: unknown): NormalizedHiddenRefPatterns {\n\tconst output = new Set<string>();\n\tconst refused: { pattern: string; reason: HiddenRefRefusalReason }[] = [];\n\n\tif (raw != null && typeof raw === 'object' && !Array.isArray(raw)) {\n\t\tfor (const [pattern, enabled] of Object.entries(raw)) {\n\t\t\tif (typeof enabled !== 'boolean') {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'invalid' });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!enabled) continue;\n\n\t\t\tlet key = pattern.trim().replace(/\\\\/g, '/').replace(/\\/+$/, '');\n\t\t\tif (!key) continue;\n\n\t\t\tif (key.startsWith('!')) {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'negation' });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!key.startsWith('refs/')) {\n\t\t\t\tkey = `refs/${key}`;\n\t\t\t}\n\n\t\t\tconst match = namespacePattern.exec(key);\n\t\t\tif (match == null || coreNamespaces.has(match[1])) {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'coreNamespace' });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toutput.add(key);\n\t\t\tif (!globPattern.test(key)) {\n\t\t\t\toutput.add(`${key}/*`);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst patterns = [...output].sort();\n\treturn { patterns: patterns, key: JSON.stringify(patterns), refused: refused };\n}\n\nexport function getHiddenRefExcludeArgs(patterns: readonly string[]): string[] {\n\treturn patterns.map(p => `--exclude=${p}`);\n}\n\nexport function getHiddenRefPatternGroups(patterns: readonly string[]): Map<string, string[]> {\n\tconst groups = new Map<string, string[]>();\n\tfor (const pattern of patterns) {\n\t\tif (pattern.endsWith('/*')) {\n\t\t\tconst base = pattern.slice(0, -2);\n\t\t\tif (!globPattern.test(base) && patterns.includes(base)) continue;\n\t\t}\n\n\t\tconst nested = `${pattern}/*`;\n\t\tgroups.set(pattern, !globPattern.test(pattern) && patterns.includes(nested) ? [pattern, nested] : [pattern]);\n\t}\n\treturn groups;\n}\n\nexport interface HiddenRefPatternValues {\n\treadonly defaultValue?: Readonly<Record<string, boolean>>;\n\treadonly globalValue?: Readonly<Record<string, boolean>>;\n\treadonly workspaceValue?: Readonly<Record<string, boolean>>;\n}\n\nexport interface HiddenRefPatternDisable {\n\treadonly target: 'global' | 'workspace';\n\treadonly keys: string[];\n\treadonly value: Record<string, boolean>;\n}\n\nexport function getHiddenRefPatternDisable(\n\tvalues: HiddenRefPatternValues,\n\tpattern: string,\n): HiddenRefPatternDisable | undefined {\n\tconst global = values.globalValue ?? {};\n\tconst workspace = values.workspaceValue ?? {};\n\tconst effective: Record<string, boolean> = { ...values.defaultValue, ...global, ...workspace };\n\n\tconst members = getHiddenRefPatternGroups(normalizeHiddenRefPatterns(effective).patterns).get(pattern);\n\tif (members == null) return undefined;\n\n\tconst keys = Object.keys(effective).filter(\n\t\tk => effective[k] === true && normalizeHiddenRefPatterns({ [k]: true }).patterns.some(p => members.includes(p)),\n\t);\n\tif (!keys.length) return undefined;\n\n\tconst target = keys.some(k => workspace[k] === true) ? 'workspace' : 'global';\n\tconst value: Record<string, boolean> = { ...(target === 'workspace' ? workspace : global) };\n\tfor (const k of keys) {\n\t\tvalue[k] = false;\n\t}\n\treturn { target: target, keys: keys, value: value };\n}\n"],"mappings":";AAQA,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAS;CAAW;CAAQ;AAAO,CAAC;AACpE,MAAM,mBAAmB;AACzB,MAAM,cAAc;AAEpB,SAAgB,2BAA2B,KAA2C;CACrF,MAAM,yBAAS,IAAI,IAAY;CAC/B,MAAM,UAAiE,CAAC;CAExE,IAAI,OAAO,QAAQ,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG,GAC/D,KAAK,MAAM,CAAC,SAAS,YAAY,OAAO,QAAQ,GAAG,GAAG;EACrD,IAAI,OAAO,YAAY,WAAW;GACjC,QAAQ,KAAK;IAAW;IAAS,QAAQ;GAAU,CAAC;GACpD;EACD;EACA,IAAI,CAAC,SAAS;EAEd,IAAI,MAAM,QAAQ,KAAK,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,QAAQ,EAAE;EAC/D,IAAI,CAAC,KAAK;EAEV,IAAI,IAAI,WAAW,GAAG,GAAG;GACxB,QAAQ,KAAK;IAAW;IAAS,QAAQ;GAAW,CAAC;GACrD;EACD;EAEA,IAAI,CAAC,IAAI,WAAW,OAAO,GAC1B,MAAM,QAAQ;EAGf,MAAM,QAAQ,iBAAiB,KAAK,GAAG;EACvC,IAAI,SAAS,QAAQ,eAAe,IAAI,MAAM,EAAE,GAAG;GAClD,QAAQ,KAAK;IAAW;IAAS,QAAQ;GAAgB,CAAC;GAC1D;EACD;EAEA,OAAO,IAAI,GAAG;EACd,IAAI,CAAC,YAAY,KAAK,GAAG,GACxB,OAAO,IAAI,GAAG,IAAI,GAAG;CAEvB;CAGD,MAAM,WAAW,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK;CAClC,OAAO;EAAY;EAAU,KAAK,KAAK,UAAU,QAAQ;EAAY;CAAQ;AAC9E;AAEA,SAAgB,wBAAwB,UAAuC;CAC9E,OAAO,SAAS,KAAI,MAAK,aAAa,GAAG;AAC1C;AAEA,SAAgB,0BAA0B,UAAoD;CAC7F,MAAM,yBAAS,IAAI,IAAsB;CACzC,KAAK,MAAM,WAAW,UAAU;EAC/B,IAAI,QAAQ,SAAS,IAAI,GAAG;GAC3B,MAAM,OAAO,QAAQ,MAAM,GAAG,EAAE;GAChC,IAAI,CAAC,YAAY,KAAK,IAAI,KAAK,SAAS,SAAS,IAAI,GAAG;EACzD;EAEA,MAAM,SAAS,GAAG,QAAQ;EAC1B,OAAO,IAAI,SAAS,CAAC,YAAY,KAAK,OAAO,KAAK,SAAS,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC;CAC5G;CACA,OAAO;AACR;AAcA,SAAgB,2BACf,QACA,SACsC;CACtC,MAAM,SAAS,OAAO,eAAe,CAAC;CACtC,MAAM,YAAY,OAAO,kBAAkB,CAAC;CAC5C,MAAM,YAAqC;EAAE,GAAG,OAAO;EAAc,GAAG;EAAQ,GAAG;CAAU;CAE7F,MAAM,UAAU,0BAA0B,2BAA2B,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,OAAO;CACrG,IAAI,WAAW,MAAM,OAAO,KAAA;CAE5B,MAAM,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,QACnC,MAAK,UAAU,OAAO,QAAQ,2BAA2B,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,SAAS,MAAK,MAAK,QAAQ,SAAS,CAAC,CAAC,CAC/G;CACA,IAAI,CAAC,KAAK,QAAQ,OAAO,KAAA;CAEzB,MAAM,SAAS,KAAK,MAAK,MAAK,UAAU,OAAO,IAAI,IAAI,cAAc;CACrE,MAAM,QAAiC,EAAE,GAAI,WAAW,cAAc,YAAY,OAAQ;CAC1F,KAAK,MAAM,KAAK,MACf,MAAM,KAAK;CAEZ,OAAO;EAAU;EAAc;EAAa;CAAM;AACnD"}
|
|
@@ -9,7 +9,9 @@ export declare function createSearchQueryForCommits(refs: string[]): string;
|
|
|
9
9
|
export declare function createSearchQueryForCommits(commits: GitRevisionReference[]): string;
|
|
10
10
|
export declare function rebuildSearchQueryFromParsed(parsed: ParsedSearchQuery): string;
|
|
11
11
|
export declare function parseSearchQuery(search: SearchQuery, validate?: boolean): ParsedSearchQuery;
|
|
12
|
-
export declare function parseSearchQueryGitCommand(search: SearchQuery, currentUser: GitUser | undefined
|
|
12
|
+
export declare function parseSearchQueryGitCommand(search: SearchQuery, currentUser: GitUser | undefined, options?: {
|
|
13
|
+
hiddenRefExcludes?: readonly string[];
|
|
14
|
+
}): SearchQueryGitCommand;
|
|
13
15
|
export declare function parseSearchQueryGitHubCommand(search: SearchQuery, currentUser: GitUser | undefined): SearchQueryGitHubCommand;
|
|
14
16
|
export declare function areSearchContextsEqual(a: GitCommitSearchContext | undefined, b: GitCommitSearchContext | undefined, deep: boolean): boolean;
|
|
15
17
|
export declare function areSearchQueriesEqual(a: SearchQuery | undefined, b: SearchQuery | undefined): boolean;
|