From bc99003bf5db4b29a8eb17dad868af18b0f265e8 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 9 Feb 2023 23:53:12 -0500 Subject: [PATCH] Adds an overload for better perf optimization --- src/commands/ghpr/createWorktree.ts | 4 +++- src/git/models/remote.ts | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/commands/ghpr/createWorktree.ts b/src/commands/ghpr/createWorktree.ts index cfdf04c..9571843 100644 --- a/src/commands/ghpr/createWorktree.ts +++ b/src/commands/ghpr/createWorktree.ts @@ -6,6 +6,7 @@ import { add as addRemote } from '../../git/actions/remote'; import { create as createWorktree } from '../../git/actions/worktree'; import { GitReference } from '../../git/models/reference'; import type { GitRemote } from '../../git/models/remote'; +import { parseGitRemoteUrl } from '../../git/parsers/remoteParser'; import { Logger } from '../../logger'; import { command } from '../../system/command'; import { waitUntilNextTick } from '../../system/promise'; @@ -79,9 +80,10 @@ export class CreateWorktreeCommand extends Command { } const remoteUrl = remoteUri.toString(); + const [, remoteDomain, remotePath] = parseGitRemoteUrl(remoteUrl); let remote: GitRemote | undefined; - [remote] = await repo.getRemotes({ filter: r => r.matches(remoteUrl) }); + [remote] = await repo.getRemotes({ filter: r => r.matches(remoteDomain, remotePath) }); if (remote == null) { const result = await window.showInformationMessage( `Unable to find a remote for '${remoteUrl}'. Would you like to add a new remote?`, diff --git a/src/git/models/remote.ts b/src/git/models/remote.ts index 009f92e..de5b86d 100644 --- a/src/git/models/remote.ts +++ b/src/git/models/remote.ts @@ -90,11 +90,15 @@ export class GitRemote