浏览代码

Fixes issue where file history wasn't auto updated

main
Eric Amodio 6 年前
父节点
当前提交
d81f4f4339
共有 2 个文件被更改,包括 21 次插入3 次删除
  1. +1
    -0
      CHANGELOG.md
  2. +20
    -3
      src/views/fileHistoryNode.ts

+ 1
- 0
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

+ 20
- 3
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);
}
}

正在加载...
取消
保存