Skip to content

Comments

GitService - add barrier for setting the delegate#296631

Merged
lszomoru merged 1 commit intomainfrom
lszomoru/thundering-koala
Feb 20, 2026
Merged

GitService - add barrier for setting the delegate#296631
lszomoru merged 1 commit intomainfrom
lszomoru/thundering-koala

Conversation

@lszomoru
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 20, 2026 21:15
@lszomoru lszomoru enabled auto-merge (squash) February 20, 2026 21:15
@lszomoru lszomoru self-assigned this Feb 20, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 20, 2026
Copy link
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

This PR adds a synchronization barrier to the GitService to prevent race conditions when attempting to open repositories before the Git extension delegate has been initialized. The barrier will automatically open after 10 seconds if the delegate hasn't been set.

Changes:

  • Added AutoOpenBarrier to synchronize access to Git delegate initialization
  • Added ILogService dependency for better error and warning logging
  • Modified openRepository to wait for delegate initialization before proceeding
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/git/browser/gitService.ts:44

  • When the delegate is removed via the returned disposable, the barrier remains open permanently. If the disposable is invoked and then setDelegate is called again with a new delegate, the barrier will already be open from the first call and won't provide synchronization for the second delegate initialization. This violates the stated invariant that the delegate can only be set once. Either the barrier should be recreated when the delegate is disposed, or the disposable should not allow resetting the delegate to undefined.
		return toDisposable(() => {
			this._delegate = undefined;
		});

@lszomoru lszomoru merged commit b21a3cc into main Feb 20, 2026
23 checks passed
@lszomoru lszomoru deleted the lszomoru/thundering-koala branch February 20, 2026 23:08
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.

2 participants