SCM - remove more debt from the quick diff (#236318)

This commit is contained in:
Ladislau Szomoru
2024-12-17 10:14:27 +01:00
committed by GitHub
parent 9963eb06d9
commit f5e5ee4b29
2 changed files with 18 additions and 9 deletions

View File

@@ -1031,17 +1031,34 @@ export class Repository implements Disposable {
// Ignore path that is not inside the current repository
if (this.repositoryResolver.getRepository(uri) !== this) {
this.logger.trace(`[Repository][provideOriginalResource] Resource is not part of the repository: ${uri.toString()}`);
return undefined;
}
// Ignore path that is inside a merge group
if (this.mergeGroup.resourceStates.some(r => pathEquals(r.resourceUri.fsPath, uri.fsPath))) {
this.logger.trace(`[Repository][provideOriginalResource] Resource is part of a merge group: ${uri.toString()}`);
return undefined;
}
// Ignore path that is untracked
if (this.untrackedGroup.resourceStates.some(r => pathEquals(r.resourceUri.path, uri.path)) ||
this.workingTreeGroup.resourceStates.some(r => pathEquals(r.resourceUri.path, uri.path) && r.type === Status.UNTRACKED)) {
this.logger.trace(`[Repository][provideOriginalResource] Resource is untracked: ${uri.toString()}`);
return undefined;
}
const activeTabInput = window.tabGroups.activeTabGroup.activeTab?.input;
// Ignore file that is on the right-hand side of a diff editor
if (activeTabInput instanceof TabInputTextDiff && pathEquals(activeTabInput.modified.fsPath, uri.fsPath)) {
this.logger.trace(`[Repository][provideOriginalResource] Resource is on the right-hand side of a diff editor: ${uri.toString()}`);
return undefined;
}
// Ignore file that is on the right -hand side of a multi-file diff editor
if (activeTabInput instanceof TabInputTextMultiDiff && activeTabInput.textDiffs.some(diff => pathEquals(diff.modified.fsPath, uri.fsPath))) {
this.logger.trace(`[Repository][provideOriginalResource] Resource is on the right-hand side of a multi-file diff editor: ${uri.toString()}`);
return undefined;
}