diff --git a/src/commands/git/coauthors.ts b/src/commands/git/coauthors.ts index 615c044..cdd35de 100644 --- a/src/commands/git/coauthors.ts +++ b/src/commands/git/coauthors.ts @@ -60,9 +60,7 @@ export class CoAuthorsGitCommand extends QuickCommand<State> { } async execute(state: CoAuthorStepState) { - const repo = (await GitService.getBuiltInGitApi())?.repositories.find( - r => Strings.normalizePath(r.rootUri.fsPath) === state.repo.path, - ); + const repo = await GitService.getBuiltInGitRepository(state.repo.path); if (repo == null) return; let message = repo.inputBox.value; diff --git a/src/commands/quickCommand.steps.ts b/src/commands/quickCommand.steps.ts index af724c5..b699286 100644 --- a/src/commands/quickCommand.steps.ts +++ b/src/commands/quickCommand.steps.ts @@ -959,9 +959,7 @@ export async function* pickContributorsStep< State extends PartialStepState & { repo: Repository }, Context extends { repos: Repository[]; title: string } >(state: State, context: Context, placeholder: string = 'Choose contributors'): StepResultGenerator<GitContributor[]> { - const message = (await GitService.getBuiltInGitApi())?.repositories.find( - r => Strings.normalizePath(r.rootUri.fsPath) === state.repo.path, - )?.inputBox.value; + const message = (await GitService.getBuiltInGitRepository(state.repo.path))?.inputBox.value; const step = QuickCommand.createPickStep<ContributorQuickPickItem>({ title: appendReposToTitle(context.title, state, context), diff --git a/src/git/gitService.ts b/src/git/gitService.ts index addfb3e..a09a48a 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -3339,12 +3339,10 @@ export class GitService implements Disposable { const normalizedPath = Strings.normalizePath(repoPath, { stripTrailingSlash: true }).toLowerCase(); - const repo = gitApi.repositories.find(r => { - const normalized = Strings.normalizePath(r.rootUri.fsPath, { - stripTrailingSlash: true, - }).toLowerCase(); - return normalized === normalizedPath; - }); + const repo = gitApi.repositories.find( + r => Strings.normalizePath(r.rootUri.fsPath, { stripTrailingSlash: true }).toLowerCase() === normalizedPath, + ); + return repo; }