Browse Source

Uses getBuiltInGitRepository

main
Eric Amodio 4 years ago
parent
commit
6b89cee49d
3 changed files with 6 additions and 12 deletions
  1. +1
    -3
      src/commands/git/coauthors.ts
  2. +1
    -3
      src/commands/quickCommand.steps.ts
  3. +4
    -6
      src/git/gitService.ts

+ 1
- 3
src/commands/git/coauthors.ts View File

@ -60,9 +60,7 @@ export class CoAuthorsGitCommand extends QuickCommand {
}
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;

+ 1
- 3
src/commands/quickCommand.steps.ts View File

@ -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),

+ 4
- 6
src/git/gitService.ts View File

@ -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;
}

||||||
x
 
000:0
Loading…
Cancel
Save