Skip to content

Commit a0b1af1

Browse files
authored
Make repo compare in activation case insensitive (#8223)
Fixes #8221
1 parent 5015549 commit a0b1af1

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/common/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ function isWindowsPath(path: string): boolean {
102102
return /^[a-zA-Z]:\\/.test(path);
103103
}
104104

105-
export function isDescendant(parent: string, descendant: string, separator: string = sep): boolean {
105+
export function isDescendant(parent: string, descendant: string, caseInsensitive: boolean = false, separator: string = sep): boolean {
106106
// Windows is case insensitive
107-
if (isWindowsPath(parent)) {
107+
if (isWindowsPath(parent) || caseInsensitive) {
108108
parent = parent.toLowerCase();
109109
descendant = descendant.toLowerCase();
110110
}

src/extension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ async function init(
232232
}
233233

234234
// Check if repo is in one of the workspace folders or vice versa
235-
if (workspaceFolders && !workspaceFolders.some(folder => isDescendant(folder.uri.fsPath, repo.rootUri.fsPath) || isDescendant(repo.rootUri.fsPath, folder.uri.fsPath))) {
235+
Logger.debug(`Checking if repo ${repo.rootUri.fsPath} is in a workspace folder.`, ACTIVATION);
236+
Logger.debug(`Workspace folders: ${workspaceFolders?.map(folder => folder.uri.fsPath).join(', ')}`, ACTIVATION);
237+
if (workspaceFolders && !workspaceFolders.some(folder => isDescendant(folder.uri.fsPath, repo.rootUri.fsPath, true) || isDescendant(repo.rootUri.fsPath, folder.uri.fsPath, true))) {
236238
Logger.appendLine(`Repo ${repo.rootUri} is not in a workspace folder, ignoring.`, ACTIVATION);
237239
return;
238240
}

src/github/pullRequestModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,7 @@ export class PullRequestModel extends IssueModel<PullRequest> implements IPullRe
21602160
async markFiles(filePathOrSubpaths: string[], event: boolean, state: 'viewed' | 'unviewed'): Promise<void> {
21612161
const allFilenames = filePathOrSubpaths
21622162
.map((f) =>
2163-
isDescendant(this.githubRepository.rootUri.path, f, '/')
2163+
isDescendant(this.githubRepository.rootUri.path, f, false, '/')
21642164
? f.substring(this.githubRepository.rootUri.path.length + 1)
21652165
: f
21662166
);

0 commit comments

Comments
 (0)