Skip to content

Support .git in repo cache and improve language - #275075

Merged
Alex Ross (alexr00) merged 2 commits into
mainfrom
alexr00/fit-trout
Nov 4, 2025
Merged

Support .git in repo cache and improve language#275075
Alex Ross (alexr00) merged 2 commits into
mainfrom
alexr00/fit-trout

Conversation

@alexr00

Copy link
Copy Markdown
Member

Done while testing #274930

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the Git repository caching mechanism by normalizing repository URLs to handle URL variations (with/without .git suffix and trailing slashes), and simplifies user-facing clone messages by removing redundant wording.

  • Adds URL normalization to the RepositoryCache class to ensure consistent cache key generation
  • Updates all cache operations (set, get, delete) to use normalized URLs
  • Simplifies clone completion messages by removing the word "cloned"

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
extensions/git/src/repositoryCache.ts Adds normalizeRepoUrl method to strip .git suffix and trailing slashes; updates cache operations to normalize URLs before use
extensions/git/src/cloneManager.ts Simplifies user-facing messages from "cloned repository" to "repository"
Comments suppressed due to low confidence (1)

extensions/git/src/repositoryCache.ts:158

  • The load method stores repository URLs without normalization, but cache operations now use normalized URLs. This creates a mismatch: URLs saved before this change (or loaded from persistent storage) won't be found by get/set/delete operations. Apply normalizeRepoUrl to the repo variable at line 156 before storing it in the LRU at line 173.
	private load(): void {
		try {
			const raw = this._globalState.get<[string, [string, RepositoryCacheInfo][]][]>(RepositoryCache.STORAGE_KEY);
			if (!Array.isArray(raw)) {
				return;
			}
			for (const [repo, storedFolders] of raw) {
				if (typeof repo !== 'string' || !Array.isArray(storedFolders)) {
					continue;

@alexr00
Alex Ross (alexr00) marked this pull request as ready for review November 4, 2025 11:03
@alexr00
Alex Ross (alexr00) merged commit d42b85f into main Nov 4, 2025
28 checks passed
@alexr00
Alex Ross (alexr00) deleted the alexr00/fit-trout branch November 4, 2025 15:48
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Dec 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants