diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ce4037..195e072 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Fixes [#436](https://github.com/eamodio/vscode-gitlens/issues/436) - Copy to clipboard not working - Fixes [#442](https://github.com/eamodio/vscode-gitlens/issues/442) - GitLens File History fails if name (or path) starts with - - Fixes issue where changed files count was wrong when the branch was behind the upstream +- Fixes issue where the *GitLens File History* explorer wasn't being updated automatically for working changes ## [8.4.1] - 2018-06-19 ### Fixed diff --git a/src/views/fileHistoryNode.ts b/src/views/fileHistoryNode.ts index 5d80803..2d97928 100644 --- a/src/views/fileHistoryNode.ts +++ b/src/views/fileHistoryNode.ts @@ -1,6 +1,6 @@ 'use strict'; import { Iterables } from '../system'; -import { TreeItem, TreeItemCollapsibleState } from 'vscode'; +import { Disposable, TreeItem, TreeItemCollapsibleState } from 'vscode'; import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode'; import { Container } from '../container'; import { Explorer, ExplorerNode, MessageNode, ResourceType } from './explorerNode'; @@ -11,7 +11,8 @@ import { GitUri, Repository, RepositoryChange, - RepositoryChangeEvent + RepositoryChangeEvent, + RepositoryFileSystemChangeEvent } from '../gitService'; import { Logger } from '../logger'; @@ -99,7 +100,15 @@ export class FileHistoryNode extends ExplorerNode { } private updateSubscription() { - this.disposable = this.disposable || this.repo.onDidChange(this.onRepoChanged, this); + if (this.disposable) return; + + this.disposable = Disposable.from( + this.repo.onDidChange(this.onRepoChanged, this), + this.repo.onDidChangeFileSystem(this.onRepoFileSystemChanged, this), + { dispose: () => this.repo.stopWatchingFileSystem() } + ); + + this.repo.startWatchingFileSystem(); } private onRepoChanged(e: RepositoryChangeEvent) { @@ -109,4 +118,12 @@ export class FileHistoryNode extends ExplorerNode { this.explorer.refreshNode(this); } + + private onRepoFileSystemChanged(e: RepositoryFileSystemChangeEvent) { + if (!e.uris.some(uri => uri.toString() === this.uri.toString())) return; + + Logger.log(`FileHistoryNode.onRepoFileSystemChanged; triggering node refresh`); + + this.explorer.refreshNode(this); + } }