diff --git a/src/commands/ghpr/createWorktree.ts b/src/commands/ghpr/createWorktree.ts index e1a087b..b184479 100644 --- a/src/commands/ghpr/createWorktree.ts +++ b/src/commands/ghpr/createWorktree.ts @@ -76,7 +76,15 @@ export class CreateWorktreeCommand extends Command { let remote: GitRemote | undefined; [remote] = await repo.getRemotes({ filter: r => r.url === remoteUrl }); if (remote == null) { - await GitActions.Remote.add(repo, remoteOwner, remoteUrl, { fetch: true }); + const result = await window.showInformationMessage( + `Unable to find a remote for '${remoteUrl}'. Would you like to add a new remote?`, + { modal: true }, + { title: 'Yes' }, + { title: 'No', isCloseAffordance: true }, + ); + if (result?.title !== 'Yes') return; + + await GitActions.Remote.add(repo, remoteOwner, remoteUrl, { confirm: false, fetch: true }); [remote] = await repo.getRemotes({ filter: r => r.url === remoteUrl }); if (remote == null) return; } else { diff --git a/src/commands/gitCommands.actions.ts b/src/commands/gitCommands.actions.ts index 1ed3282..a76c342 100644 --- a/src/commands/gitCommands.actions.ts +++ b/src/commands/gitCommands.actions.ts @@ -822,9 +822,15 @@ export namespace GitActions { } export namespace Remote { - export function add(repo?: string | Repository, name?: string, url?: string, options?: { fetch?: boolean }) { + export function add( + repo?: string | Repository, + name?: string, + url?: string, + options?: { confirm?: boolean; fetch?: boolean }, + ) { return executeGitCommand({ command: 'remote', + confirm: options?.confirm, state: { repo: repo, subcommand: 'add',