mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Git - wire up event for changing artifact groups (#274261)
* Git - wire up event for changing artifact groups * Remove code that was commented out * Swap code order * Dispose listener * Dispose event emitter as well
This commit is contained in:
@@ -8,8 +8,8 @@ import { dispose, IDisposable } from './util';
|
||||
import { Repository } from './repository';
|
||||
|
||||
export class GitArtifactProvider implements SourceControlArtifactProvider, IDisposable {
|
||||
private readonly _onDidChangeArtifacts = new EventEmitter<string>();
|
||||
readonly onDidChangeArtifacts: Event<string> = this._onDidChangeArtifacts.event;
|
||||
private readonly _onDidChangeArtifacts = new EventEmitter<string[]>();
|
||||
readonly onDidChangeArtifacts: Event<string[]> = this._onDidChangeArtifacts.event;
|
||||
|
||||
private readonly _groups: SourceControlArtifactGroup[];
|
||||
private readonly _disposables: Disposable[] = [];
|
||||
@@ -24,6 +24,18 @@ export class GitArtifactProvider implements SourceControlArtifactProvider, IDisp
|
||||
];
|
||||
|
||||
this._disposables.push(this._onDidChangeArtifacts);
|
||||
this._disposables.push(repository.historyProvider.onDidChangeHistoryItemRefs(e => {
|
||||
const groups = new Set<string>();
|
||||
for (const ref of e.added.concat(e.modified).concat(e.removed)) {
|
||||
if (ref.id.startsWith('refs/heads/')) {
|
||||
groups.add('branches');
|
||||
} else if (ref.id.startsWith('refs/tags/')) {
|
||||
groups.add('tags');
|
||||
}
|
||||
}
|
||||
|
||||
this._onDidChangeArtifacts.fire(Array.from(groups));
|
||||
}));
|
||||
}
|
||||
|
||||
provideArtifactGroups(): SourceControlArtifactGroup[] {
|
||||
|
||||
Reference in New Issue
Block a user