Skip to content

Commit f396fe0

Browse files
authored
Git - refresh decorators when incoming/outgoing changes (microsoft#205282)
1 parent ed22015 commit f396fe0

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

extensions/git/src/decorationProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ class GitIncomingChangesFileDecorationProvider implements FileDecorationProvider
163163

164164
constructor(private readonly repository: Repository) {
165165
this.disposables.push(window.registerFileDecorationProvider(this));
166-
repository.historyProvider.onDidChangeCurrentHistoryItemGroupBase(this.onDidChangeCurrentHistoryItemGroupBase, this, this.disposables);
166+
repository.historyProvider.onDidChangeCurrentHistoryItemGroup(this.onDidChangeCurrentHistoryItemGroup, this, this.disposables);
167167
}
168168

169-
private async onDidChangeCurrentHistoryItemGroupBase(): Promise<void> {
169+
private async onDidChangeCurrentHistoryItemGroup(): Promise<void> {
170170
const newDecorations = new Map<string, FileDecoration>();
171171
await this.collectIncomingChangesFileDecorations(newDecorations);
172172
const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()]));

extensions/git/src/historyProvider.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
1717
private readonly _onDidChangeCurrentHistoryItemGroup = new EventEmitter<void>();
1818
readonly onDidChangeCurrentHistoryItemGroup: Event<void> = this._onDidChangeCurrentHistoryItemGroup.event;
1919

20-
private readonly _onDidChangeCurrentHistoryItemGroupBase = new EventEmitter<void>();
21-
readonly onDidChangeCurrentHistoryItemGroupBase: Event<void> = this._onDidChangeCurrentHistoryItemGroupBase.event;
22-
2320
private readonly _onDidChangeDecorations = new EventEmitter<Uri[]>();
2421
readonly onDidChangeFileDecorations: Event<Uri[]> = this._onDidChangeDecorations.event;
2522

@@ -29,8 +26,6 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
2926
set currentHistoryItemGroup(value: SourceControlHistoryItemGroup | undefined) {
3027
this._currentHistoryItemGroup = value;
3128
this._onDidChangeCurrentHistoryItemGroup.fire();
32-
33-
this.logger.trace('GitHistoryProvider:onDidRunGitStatus - currentHistoryItemGroup:', JSON.stringify(value));
3429
}
3530

3631
private historyItemDecorations = new Map<string, FileDecoration>();
@@ -59,12 +54,13 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
5954
return;
6055
}
6156

57+
this._HEAD = this.repository.HEAD;
58+
6259
// Check if HEAD does not support incoming/outgoing (detached commit, tag)
6360
if (!this.repository.HEAD?.name || !this.repository.HEAD?.commit || this.repository.HEAD.type === RefType.Tag) {
6461
this.logger.trace('GitHistoryProvider:onDidRunGitStatus - HEAD does not support incoming/outgoing');
6562

6663
this.currentHistoryItemGroup = undefined;
67-
this._HEAD = this.repository.HEAD;
6864
return;
6965
}
7066

@@ -78,16 +74,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
7874
} : undefined
7975
};
8076

81-
// Check if Upstream has changed
82-
if (force ||
83-
this._HEAD?.upstream?.name !== this.repository.HEAD?.upstream?.name ||
84-
this._HEAD?.upstream?.remote !== this.repository.HEAD?.upstream?.remote ||
85-
this._HEAD?.upstream?.commit !== this.repository.HEAD?.upstream?.commit) {
86-
this.logger.trace(`GitHistoryProvider:onDidRunGitStatus - Upstream has changed (${force})`);
87-
this._onDidChangeCurrentHistoryItemGroupBase.fire();
88-
}
89-
90-
this._HEAD = this.repository.HEAD;
77+
this.logger.trace(`GitHistoryProvider:onDidRunGitStatus - currentHistoryItemGroup (${force}): ${JSON.stringify(this.currentHistoryItemGroup)}`);
9178
}
9279

9380
async provideHistoryItems(historyItemGroupId: string, options: SourceControlHistoryOptions): Promise<SourceControlHistoryItem[]> {

0 commit comments

Comments
 (0)