Git - fix data shape issue for the merge base (#242544)

This commit is contained in:
Ladislau Szomoru
2025-03-04 12:16:09 +01:00
committed by GitHub
parent 56a04994d4
commit e4e03ebce9
2 changed files with 6 additions and 2 deletions

View File

@@ -163,7 +163,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
// Compute base if the branch has changed
const mergeBase = await this.resolveHEADMergeBase();
this._currentHistoryItemBaseRef = mergeBase &&
this._currentHistoryItemBaseRef = mergeBase && mergeBase.name && mergeBase.remote &&
(mergeBase.remote !== this.repository.HEAD.upstream?.remote ||
mergeBase.name !== this.repository.HEAD.upstream?.name) ? {
id: `refs/remotes/${mergeBase.remote}/${mergeBase.name}`,

View File

@@ -1533,7 +1533,11 @@ export class Repository implements Disposable {
try {
const mergeBase = await this.getConfig(mergeBaseConfigKey);
const branchFromConfig = mergeBase !== '' ? await this.getBranch(mergeBase) : undefined;
if (branchFromConfig) {
// There was a brief period of time when we would consider local branches as a valid
// merge base. Since then we have fixed the issue and only remote branches can be used
// as a merge base so we are adding an additional check.
if (branchFromConfig && branchFromConfig.remote) {
return branchFromConfig;
}
} catch (err) { }