src/vs/workbench/contrib/scm/browser/scmViewService.ts/SCMViewService/onDidAddRepository
class SCMViewService:	private onDidAddRepository(repository: ISCMRepository): void {
		this.logService.trace('SCMViewService#onDidAddRepository', getProviderStorageKey(repository.provider));

		if (!this.didFinishLoading) {
			this.eventuallyFinishLoading();
		}

		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
				this.logService.trace('SCMViewService#onDidAddRepository', 'This is a new repository, so we stop the heuristics');

				const added: ISCMRepository[] = [];
				for (const repo of this.scmService.repositories) { // all should be visible
					if (!this._visibleRepositoriesSet.has(repo)) {
						added.push(repository);
					}
				}

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

			const visible = this.previousState.visible.indexOf(index) > -1;

			if (!visible) {
				if (this._visibleRepositories.length === 0) { // should make it visible, until other repos come along
					this.provisionalVisibleRepository = repository;
				} else {
					return;
				}
			} else {
				if (this.provisionalVisibleRepository) {
					this._visibleRepositories = [];
					this._visibleRepositoriesSet = new Set();
					removed = [this.provisionalVisibleRepository];
					this.provisionalVisibleRepository = undefined;
				}
			}
		}

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

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