src/vs/workbench/contrib/scm/common/scmService.ts/SCMInput/constructor
class SCMInput:	constructor(
		readonly repository: ISCMRepository,
		@IStorageService private storageService: IStorageService
	) {
		SCMInput.migrateAndGarbageCollectStorage(storageService);

		const key = this.repository.provider.rootUri ? `scm/input:${this.repository.provider.label}:${this.repository.provider.rootUri?.path}` : undefined;
		let history: string[] | undefined;

		if (key) {
			try {
				history = JSON.parse(this.storageService.get(key, StorageScope.APPLICATION, '')).history;
				history = history?.map(s => s ?? '');
			} catch {
				// noop
			}
		}

		if (!Array.isArray(history) || history.length === 0) {
			history = [this._value];
		} else {
			this._value = history[history.length - 1];
		}

		this.historyNavigator = new HistoryNavigator2(history, 50);
		this.didChangeHistory = false;

		if (key) {
			this.storageService.onWillSaveState(_ => {
				if (this.historyNavigator.isAtEnd()) {
					this.saveValue();
				}

				if (!this.didChangeHistory) {
					return;
				}

				const history = [...this.historyNavigator].map(s => s ?? '');

				if (history.length === 0 || (history.length === 1 && history[0] === '')) {
					storageService.remove(key, StorageScope.APPLICATION);
				} else {
					storageService.store(key, JSON.stringify({ timestamp: new Date().getTime(), history }), StorageScope.APPLICATION, StorageTarget.MACHINE);
				}
				this.didChangeHistory = false;
			});
		}
	}