diff --git a/extensions/git/src/decorationProvider.ts b/extensions/git/src/decorationProvider.ts index 943af377eb7..9e3e356628d 100644 --- a/extensions/git/src/decorationProvider.ts +++ b/extensions/git/src/decorationProvider.ts @@ -163,10 +163,10 @@ class GitIncomingChangesFileDecorationProvider implements FileDecorationProvider constructor(private readonly repository: Repository) { this.disposables.push(window.registerFileDecorationProvider(this)); - repository.historyProvider.onDidChangeCurrentHistoryItemGroupBase(this.onDidChangeCurrentHistoryItemGroupBase, this, this.disposables); + repository.historyProvider.onDidChangeCurrentHistoryItemGroup(this.onDidChangeCurrentHistoryItemGroup, this, this.disposables); } - private async onDidChangeCurrentHistoryItemGroupBase(): Promise { + private async onDidChangeCurrentHistoryItemGroup(): Promise { const newDecorations = new Map(); await this.collectIncomingChangesFileDecorations(newDecorations); const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()])); diff --git a/extensions/git/src/historyProvider.ts b/extensions/git/src/historyProvider.ts index 64230ecf46b..d7f547b6b03 100644 --- a/extensions/git/src/historyProvider.ts +++ b/extensions/git/src/historyProvider.ts @@ -17,9 +17,6 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec private readonly _onDidChangeCurrentHistoryItemGroup = new EventEmitter(); readonly onDidChangeCurrentHistoryItemGroup: Event = this._onDidChangeCurrentHistoryItemGroup.event; - private readonly _onDidChangeCurrentHistoryItemGroupBase = new EventEmitter(); - readonly onDidChangeCurrentHistoryItemGroupBase: Event = this._onDidChangeCurrentHistoryItemGroupBase.event; - private readonly _onDidChangeDecorations = new EventEmitter(); readonly onDidChangeFileDecorations: Event = this._onDidChangeDecorations.event; @@ -29,8 +26,6 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec set currentHistoryItemGroup(value: SourceControlHistoryItemGroup | undefined) { this._currentHistoryItemGroup = value; this._onDidChangeCurrentHistoryItemGroup.fire(); - - this.logger.trace('GitHistoryProvider:onDidRunGitStatus - currentHistoryItemGroup:', JSON.stringify(value)); } private historyItemDecorations = new Map(); @@ -59,12 +54,13 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec return; } + this._HEAD = this.repository.HEAD; + // Check if HEAD does not support incoming/outgoing (detached commit, tag) if (!this.repository.HEAD?.name || !this.repository.HEAD?.commit || this.repository.HEAD.type === RefType.Tag) { this.logger.trace('GitHistoryProvider:onDidRunGitStatus - HEAD does not support incoming/outgoing'); this.currentHistoryItemGroup = undefined; - this._HEAD = this.repository.HEAD; return; } @@ -78,16 +74,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec } : undefined }; - // Check if Upstream has changed - if (force || - this._HEAD?.upstream?.name !== this.repository.HEAD?.upstream?.name || - this._HEAD?.upstream?.remote !== this.repository.HEAD?.upstream?.remote || - this._HEAD?.upstream?.commit !== this.repository.HEAD?.upstream?.commit) { - this.logger.trace(`GitHistoryProvider:onDidRunGitStatus - Upstream has changed (${force})`); - this._onDidChangeCurrentHistoryItemGroupBase.fire(); - } - - this._HEAD = this.repository.HEAD; + this.logger.trace(`GitHistoryProvider:onDidRunGitStatus - currentHistoryItemGroup (${force}): ${JSON.stringify(this.currentHistoryItemGroup)}`); } async provideHistoryItems(historyItemGroupId: string, options: SourceControlHistoryOptions): Promise {