Git - fix race condition with computing teh branch base (#251374)

This commit is contained in:
Ladislau Szomoru
2025-06-13 13:41:51 +02:00
committed by GitHub
parent f0aef94f97
commit ea92c32109
3 changed files with 4 additions and 3 deletions

View File

@@ -16,7 +16,6 @@ import { CancellationError, CancellationToken, ConfigurationChangeEvent, LogOutp
import { Commit as ApiCommit, Ref, RefType, Branch, Remote, ForcePushMode, GitErrorCodes, LogOptions, Change, Status, CommitOptions, RefQuery as ApiRefQuery, InitOptions } from './api/git';
import * as byline from 'byline';
import { StringDecoder } from 'string_decoder';
import { sequentialize } from './decorators';
// https://github.com/microsoft/vscode/issues/65693
const MAX_CLI_LENGTH = 30000;
@@ -1242,7 +1241,6 @@ export class Repository {
return this.git.spawn(args, options);
}
@sequentialize
async config(command: string, scope: string, key: string, value: any = null, options: SpawnOptions = {}): Promise<string> {
const args = ['config', `--${command}`];

View File

@@ -13,6 +13,7 @@ import { emojify, ensureEmojis } from './emoji';
import { Commit } from './git';
import { OperationKind, OperationResult } from './operation';
import { ISourceControlHistoryItemDetailsProviderRegistry, provideSourceControlHistoryItemAvatar, provideSourceControlHistoryItemMessageLinks } from './historyItemDetailsProvider';
import { throttle } from './decorators';
function compareSourceControlHistoryItemRef(ref1: SourceControlHistoryItemRef, ref2: SourceControlHistoryItemRef): number {
const getOrder = (ref: SourceControlHistoryItemRef): number => {
@@ -87,6 +88,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
this.commitShortHashLength = config.get<number>('commitShortHashLength', 7);
}
@throttle
private async onDidRunWriteOperation(result: OperationResult): Promise<void> {
if (!this.repository.HEAD) {
this.logger.trace('[GitHistoryProvider][onDidRunWriteOperation] repository.HEAD is undefined');

View File

@@ -13,7 +13,7 @@ import { ApiRepository } from './api/api1';
import { Branch, BranchQuery, Change, CommitOptions, FetchOptions, ForcePushMode, GitErrorCodes, LogOptions, Ref, RefType, Remote, Status } from './api/git';
import { AutoFetcher } from './autofetch';
import { GitBranchProtectionProvider, IBranchProtectionProviderRegistry } from './branchProtection';
import { debounce, memoize, throttle } from './decorators';
import { debounce, memoize, sequentialize, throttle } from './decorators';
import { Repository as BaseRepository, BlameInformation, Commit, GitError, LogFileOptions, LsTreeElement, PullOptions, RefQuery, Stash, Submodule } from './git';
import { GitHistoryProvider } from './historyProvider';
import { Operation, OperationKind, OperationManager, OperationResult } from './operation';
@@ -1554,6 +1554,7 @@ export class Repository implements Disposable {
});
}
@sequentialize
async getBranchBase(ref: string): Promise<Branch | undefined> {
const branch = await this.getBranch(ref);