message: Extract observable creation.
diff: @@ -24,12 +24,8 @@ async function getState(directory: string): Promise<GitState> {
  }
  }
  -export class GitService {
  - private observables: Map<string, Observable<GitState>> = new Map();
  -
  - observableFor(directory: string): Observable<GitState> {
  - if (!this.observables.has(directory)) {
  - const observable = Observable
  +function createObservable(directory: string) {
  + return Observable
  .timer(0, INTERVAL)
  .concatMap(() => getState(directory))
  // Don't emit if a value didn't change.
  @@ -38,8 +34,14 @@ export class GitService {
  .multicast(new BehaviorSubject<GitState>({kind: "not-repository"}))
  // Automatically stop checking git status when there are no subscriptions anymore.
  .refCount();
  +}
  - this.observables.set(directory, observable);
  +export class GitService {
  + private observables: Map<string, Observable<GitState>> = new Map();
  +
  + observableFor(directory: string): Observable<GitState> {
  + if (!this.observables.has(directory)) {
  + this.observables.set(directory, createObservable(directory));
  }
  return this.observables.get(directory)!;
  