src/vs/workbench/contrib/scm/browser/scmViewService.ts/SCMViewService/onDidAddRepository
class SCMViewService:	private onDidAddRepository(repository: ISCMRepository): void {
		if (!this.didFinishLoading) {
			this.eventuallyFinishLoading();
		}

		this.insertRepository(this._repositories, repository);
		let removed: Iterable<ISCMRepository> = Iterable.empty();

		if (this.previousState) {
			const index = this.previousState.all.indexOf(getProviderStorageKey(repository.provider));

			if (index === -1) { // saw a repo we did not expect
				const added: ISCMRepository[] = [];
				for (const repo of this.scmService.repositories) { // all should be visible
					if (!this._visibleRepositoriesSet.has(repo)) {
						added.push(repository);
					}
				}

				this._visibleRepositoriesSet = new Set(this.scmService.repositories);
				this._visibleRepositories = [...this.scmService.repositories.sort(this._compareRepositories)];
				this._onDidChangeRepositories.fire({ added, removed: Iterable.empty() });
				this.finishLoading();
				return;
			}

			if (this.previousState.visible.indexOf(index) > -1) {
				// First visible repository
				if (!this.didSelectRepository) {
					removed = this._visibleRepositories;

					this._visibleRepositories = [];
					this._visibleRepositoriesSet = new Set();
					this.didSelectRepository = true;
				}
			} else {
				// Explicit selection started
				if (this.didSelectRepository) {
					this._onDidChangeRepositories.fire({ added: Iterable.empty(), removed: Iterable.empty() });
					return;
				}
			}
		}

		this._visibleRepositoriesSet.add(repository);
		this.insertRepository(this._visibleRepositories, repository);
		this._onDidChangeRepositories.fire({ added: [repository], removed });

		if (!this._focusedRepository) {
			this.focus(repository);
		}
	}