Skip to content

Agents - use pathspec file when adding files to the temporary index to help with performance#309593

Merged
lszomoru merged 1 commit intomainfrom
lszomoru/rotten-pony
Apr 14, 2026
Merged

Agents - use pathspec file when adding files to the temporary index to help with performance#309593
lszomoru merged 1 commit intomainfrom
lszomoru/rotten-pony

Conversation

@lszomoru
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 13, 2026 19:27
@lszomoru lszomoru enabled auto-merge (squash) April 13, 2026 19:27
@lszomoru lszomoru self-assigned this Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 1eb30178 Current: bf3d9794

Changed (2)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves performance of Agent Sessions’ “temp index” workflows by staging only the set of uncommitted files (via a generated pathspec file) instead of staging the entire working directory when computing diffs/snapshots.

Changes:

  • Added getUncommittedFilePaths() helper to derive a deduped list of repo-relative changed paths.
  • Updated worktree/workspace diff collection to use git add -A --pathspec-from-file=... when untracked files are present.
  • Updated checkpoint creation to stage via a pathspec file rather than git add -A -- ..
Show a summary per file
File Description
extensions/copilot/src/platform/git/vscode-node/utils.ts Adds helper to compute repo-relative uncommitted paths for use in pathspec files.
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts Uses the helper + pathspec file when staging into the temp index for diff stats in worktree isolation mode.
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeCheckpointServiceImpl.ts Uses the helper + pathspec file when staging into the temp index for checkpoint snapshot creation.
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorkspaceFolderServiceImpl.ts Uses the helper + pathspec file when staging into the temp index for diff stats in workspace isolation mode.

Copilot's findings

Comments suppressed due to low confidence (1)

extensions/copilot/src/platform/git/vscode-node/utils.ts:121

  • The paths returned here are later passed to git add via --pathspec-from-file. Git pathspecs treat *, ?, and [] as glob characters by default, so a file name containing those characters can match unintended paths. Consider emitting literal pathspecs (e.g. prefix each entry with :(literal)), or otherwise ensure the entries are interpreted literally when written to the pathspec file.
	const relativePaths = coalesce(Array.from(resources)
		.map(uri => relativePath(repository.rootUri, uri)));

	// Git expects forward slashes even on Windows
	return relativePaths.map(p => p.replace(/\\/g, '/'));
  • Files reviewed: 4/4 changed files
  • Comments generated: 3

Comment thread extensions/copilot/src/platform/git/vscode-node/utils.ts
@lszomoru lszomoru merged commit 71a0253 into main Apr 14, 2026
44 of 45 checks passed
@lszomoru lszomoru deleted the lszomoru/rotten-pony branch April 14, 2026 05:22
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants