worktreeIsolation.ts ×4

Frontier kind: Code frontier

unlabeled · c_db0d29e4a6bd

5 tests · 24571 LOC · 98 files · introduces 0 tests · 51 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
4 ranges51 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2089 ranges24571 lines · 98 files · Browse complete extent
All tests (intent)
5 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 51 introduced LOC across 4 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/worktreeIsolation.ts 51 introduced LOC · 4 ranges

Open complete file

323 let worktreeIncludeFilesProperty: ISchemaProperty<readonly string[]> | undefined;
324 if (gitInfo) {
325 > const branchReadOnly = isolationValue === 'folder'; worktreeIsolation.ts
326 > branchDefault = isolationValue === 'worktree' ? gitInfo.defaultBranch.name : gitInfo.currentBranch;
327 > branchValue = isolationValue === 'worktree' && typeof request.config?.[SessionConfigKey.Branch] === 'string'
328 ? request.config[SessionConfigKey.Branch] as string
329 : branchDefault;
330 > branchProperty = schemaProperty<string>({ worktreeIsolation.ts
331 > type: 'string',
332 > title: localize('agentHost.sessionConfig.branch', "Branch"),
333 > description: localize('agentHost.sessionConfig.branchDescription', "Base branch to work from"),
334 > enum: [branchDefault],
335 > enumLabels: [branchDefault],
336 > default: branchDefault,
337 > enumDynamic: !branchReadOnly,
338 > readOnly: branchReadOnly,
339 > sessionMutable: false,
340 > });
341 >
342 > // Carrier for the client's `git.branchPrefix`: the host prepends it
343 > // to the branch it creates for an isolated worktree. Declared for
344 > // both isolations (like `branch`), so the value rides
345 > // `_config.values` and survives isolation toggles — a user who flips
346 > // worktree → folder → worktree keeps the prefix. It has no
347 > // `enum`/`enumDynamic`, so the config picker treats it as
348 > // non-pickable and never surfaces it as a chip: the client seeds it
349 > // (from `git.branchPrefix`), the user never edits it, and the host
350 > // only *consumes* it for worktree isolation (see
351 > // {@link resolveWorkingDirectory}).
352 > worktreeBranchPrefixProperty = schemaProperty<string>({
353 > type: 'string',
354 > title: localize('agentHost.sessionConfig.worktreeBranchPrefix', "Worktree Branch Prefix"),
355 > description: localize('agentHost.sessionConfig.worktreeBranchPrefixDescription', "Prefix applied to the branch created for an isolated worktree."),
356 > readOnly: true,
357 > sessionMutable: false,
358 > });
359 >
360 > worktreeIncludeFilesProperty = schemaProperty<readonly string[]>({
361 > type: 'array',
362 > title: localize('agentHost.sessionConfig.worktreeIncludeFiles', "Worktree Include Files"),
363 > description: localize('agentHost.sessionConfig.worktreeIncludeFilesDescription', "Glob patterns for git-ignored files to copy into the isolated worktree."),
364 > items: {
365 > type: 'string',
366 > title: localize('agentHost.sessionConfig.worktreeIncludeFilesItem', "Pattern"),
367 > },
368 > readOnly: true,
369 > sessionMutable: false,
370 > });
371 > }
372
373 return { isolationProperty, branchProperty, worktreeBranchPrefixProperty, worktreeIncludeFilesProperty, isolationValue, branchDefault, branchValue };
719 return undefined;
720 }
722 > // Skip worktree isolation for a repo with no commits yet (unborn HEAD); `git worktree add` would fail.
723 > const headCommit = await this._gitService.revParse(repositoryRoot, 'HEAD').catch(() => undefined);
724 > if (!headCommit) {
725 return undefined;
726 }
728 > const currentBranch = await this._gitService.getCurrentBranch(repositoryRoot) ?? 'HEAD';
729 const defaultBranch = await this._gitService.getDefaultBranch(repositoryRoot) ?? { name: currentBranch, startPoint: currentBranch };
730 return { currentBranch, defaultBranch };