Git - adjust branch base computation (#204585)

This commit is contained in:
Ladislau Szomoru 2024-02-07 12:43:16 +01:00 committed by GitHub
parent 614c5437cb
commit 0679fa72d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -182,6 +182,13 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
private async resolveHistoryItemGroupBase(historyItemId: string): Promise<UpstreamRef | undefined> {
try {
// Upstream
const branch = await this.repository.getBranch(historyItemId);
if (branch.upstream) {
return branch.upstream;
}
// Base (config -> reflog -> default)
const remoteBranch = await this.repository.getBranchBase(historyItemId);
if (!remoteBranch?.remote || !remoteBranch?.name || !remoteBranch?.commit || remoteBranch?.type !== RefType.RemoteHead) {
return undefined;

View File

@ -1484,11 +1484,6 @@ export class Repository implements Disposable {
async getBranchBase(ref: string): Promise<Branch | undefined> {
const branch = await this.getBranch(ref);
const branchUpstream = await this.getUpstreamBranch(branch);
if (branchUpstream) {
return branchUpstream;
}
// Git config
const mergeBaseConfigKey = `branch.${branch.name}.vscode-merge-base`;