Explorar el Código

Adds modal to ask user to add remote

main
Eric Amodio hace 1 año
padre
commit
1f50ecab46
Se han modificado 2 ficheros con 16 adiciones y 2 borrados
  1. +9
    -1
      src/commands/ghpr/createWorktree.ts
  2. +7
    -1
      src/commands/gitCommands.actions.ts

+ 9
- 1
src/commands/ghpr/createWorktree.ts Ver fichero

@ -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 {

+ 7
- 1
src/commands/gitCommands.actions.ts Ver fichero

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

Cargando…
Cancelar
Guardar