Sfoglia il codice sorgente

Fixes #2553 allows remote formats we can parse

main
Eric Amodio 1 anno fa
parent
commit
056512bfc3
2 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. +2
    -1
      src/commands/quickCommand.steps.ts
  2. +2
    -2
      src/git/parsers/remoteParser.ts

+ 2
- 1
src/commands/quickCommand.steps.ts Vedi File

@ -37,6 +37,7 @@ import type { GitStatus } from '../git/models/status';
import type { GitTag, TagSortOptions } from '../git/models/tag';
import { sortTags } from '../git/models/tag';
import type { GitWorktree } from '../git/models/worktree';
import { remoteUrlRegex } from '../git/parsers/remoteParser';
import {
CommitApplyFileChangesCommandQuickPickItem,
CommitBrowseRepositoryFromHereCommandQuickPickItem,
@ -606,7 +607,7 @@ export async function* inputRemoteUrlStep<
value = value.trim();
if (value.length === 0) return [false, 'Please enter a valid remote URL'];
const valid = /^(https?|git|ssh|rsync):\/\//.test(value);
const valid = remoteUrlRegex.test(value);
return [valid, valid ? undefined : `'${value}' isn't a valid remote URL`];
},
});

+ 2
- 2
src/git/parsers/remoteParser.ts Vedi File

@ -109,11 +109,11 @@ user:password@host.xz:project.git
user:password@host.xz:/path/to/repo.git
user:password@host.xz:/path/to/repo.git/
*/
const urlRegex =
export const remoteUrlRegex =
/^(?:(git:\/\/)(.*?)\/|(https?:\/\/)(?:.*?@)?(.*?)\/|git@(.*):|(ssh:\/\/)(?:.*@)?(.*?)(?::.*?)?(?:\/|(?=~))|(?:.*?@)(.*?):)(.*)$/;
export function parseGitRemoteUrl(url: string): [scheme: string, domain: string, path: string] {
const match = urlRegex.exec(url);
const match = remoteUrlRegex.exec(url);
if (match == null) return [emptyStr, emptyStr, url];
return [

Caricamento…
Annulla
Salva