Files
vscode/extensions/git
Copilot 1872cb3854 Add garbage collection for unused content-addressed askpass directories (#289723)
* Initial plan

* Add garbage collection for old content-addressed askpass directories

- Implement updateDirectoryMtime to update folder mtime when used
- Add garbageCollectOldDirectories to remove folders older than 7 days
- Update ensureAskpassScripts to call GC on every activation
- Add comprehensive test coverage for GC functionality

Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>

* Remove GC from fast path to keep it fast

Only run garbage collection when creating new directories, not when reusing existing ones. Old folders only accumulate when creating new content-addressed directories.

Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>

* Hoist askpassBaseDir variable to avoid duplication

Declare askpassBaseDir once at the top of the function and reuse it when constructing askpassDir and when calling garbageCollectOldDirectories.

Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>

* Fix test failures and address bot review comments

- Export ensureAskpassScripts for testing to avoid dependency on isWindowsUserOrSystemSetup check
- Remove redundant success log after directory removal
- Update tests to call ensureAskpassScripts directly instead of getAskpassPaths
- Remove Windows-only restrictions from tests to make them cross-platform
- Remove setTimeout workarounds - tests now properly await async operations

Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>

* formatting

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>
Co-authored-by: João Moreno <joaomoreno@users.noreply.github.com>
2026-01-29 10:35:40 +00:00
..

Git integration for Visual Studio Code

Notice: This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.

Features

See Git support in VS Code to learn about the features of this extension.

API

The Git extension exposes an API, reachable by any other extension.

  1. Copy src/api/git.d.ts to your extension's sources;

  2. Include git.d.ts in your extension's compilation.

  3. Get a hold of the API with the following snippet:

    const gitExtension = vscode.extensions.getExtension<GitExtension>('vscode.git').exports;
    const git = gitExtension.getAPI(1);
    

    Note: To ensure that the vscode.git extension is activated before your extension, add extensionDependencies (docs) into the package.json of your extension:

    "extensionDependencies": [
    	"vscode.git"
    ]