Skip to content

Commit 7f33502

Browse files
authored
Files changed doesn't properly reflect changes against non base branch (#5547)
Fixes #5545
1 parent 3e18a16 commit 7f33502

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/view/createPullRequestDataModel.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ export class CreatePullRequestDataModel {
133133
public async gitFiles(): Promise<Change[]> {
134134
await this._constructed;
135135
if (this._gitFiles === undefined) {
136-
this._gitFiles = await this.folderRepositoryManager.repository.diffBetween(this._baseBranch, this._compareBranch);
136+
const startBase = this._baseBranch;
137+
const startCompare = this._compareBranch;
138+
const result = await this.folderRepositoryManager.repository.diffBetween(this._baseBranch, this._compareBranch);
139+
if (startBase !== this._baseBranch || startCompare !== this._compareBranch) {
140+
// The branches have changed while we were waiting for the diff. We can use the result, but we shouldn't save it
141+
return result;
142+
} else {
143+
this._gitFiles = result;
144+
}
137145
}
138146
return this._gitFiles;
139147
}

0 commit comments

Comments
 (0)