Ver a proveniência

Adds modal to ask user to add remote

main
Eric Amodio há 1 ano
ascendente
cometimento
1f50ecab46
2 ficheiros alterados com 16 adições e 2 eliminações
  1. +9
    -1
      src/commands/ghpr/createWorktree.ts
  2. +7
    -1
      src/commands/gitCommands.actions.ts

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

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

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

Carregando…
Cancelar
Guardar