Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions extensions/git/src/historyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
this.logger.trace(`[GitHistoryProvider][onDidRunWriteOperation] currentHistoryItemBaseRef: ${JSON.stringify(this._currentHistoryItemBaseRef)}`);

// Refs (alphabetically)
const refs = await this.repository.getRefs({ sort: 'alphabetically' });
const historyItemRefs = refs.map(ref => toSourceControlHistoryItemRef(ref));
const historyItemRefs = this.repository.refs
.map(ref => toSourceControlHistoryItemRef(ref))
.sort((a, b) => a.id.localeCompare(b.id));

// Auto-fetch
const silent = result.operation.kind === OperationKind.Fetch && result.operation.showProgress === false;
Expand Down Expand Up @@ -227,7 +228,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
await ensureEmojis();

return commits.map(commit => {
const references = this.resolveHistoryItemRefs(commit);
const references = this._resolveHistoryItemRefs(commit);

return {
id: commit.hash,
Expand Down Expand Up @@ -320,7 +321,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
return this.historyItemDecorations.get(uri.toString());
}

private resolveHistoryItemRefs(commit: Commit): SourceControlHistoryItemRef[] {
private _resolveHistoryItemRefs(commit: Commit): SourceControlHistoryItemRef[] {
const references: SourceControlHistoryItemRef[] = [];

for (const ref of commit.refNames) {
Expand Down
12 changes: 11 additions & 1 deletion extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,11 @@ export class Repository implements Disposable {
return this._HEAD;
}

private _refs: Ref[] = [];
get refs(): Ref[] {
return this._refs;
}

get headShortName(): string | undefined {
if (!this.HEAD) {
return;
Expand Down Expand Up @@ -2176,7 +2181,12 @@ export class Repository implements Disposable {
this._sourceControl.commitTemplate = commitTemplate;

// Execute cancellable long-running operation
const resourceGroups = await this.getStatus(cancellationToken);
const [resourceGroups, refs] =
await Promise.all([
this.getStatus(cancellationToken),
this.getRefs({}, cancellationToken)]);

this._refs = refs;
this._updateResourceGroupsState(resourceGroups);

this._onDidChangeStatus.fire();
Expand Down