mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
enhance: a more adaptable regular expression for remote URLs (#61)
This commit is contained in:
parent
040a6d4bba
commit
400d454478
1 changed files with 7 additions and 9 deletions
|
@ -4,19 +4,17 @@ namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
public partial class Remote
|
public partial class Remote
|
||||||
{
|
{
|
||||||
|
[GeneratedRegex(@"^http[s]?://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-/]+/[\w\-\.]+\.git$")]
|
||||||
[GeneratedRegex(@"^http[s]?://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-\.]+\.git$")]
|
private static partial Regex REG_HTTPS();
|
||||||
private static partial Regex regex1();
|
|
||||||
|
|
||||||
[GeneratedRegex(@"^[\w\-]+@[\w\.\-]+(\:[0-9]+)?:[\w\-]+/[\w\-\.]+\.git$")]
|
[GeneratedRegex(@"^[\w\-]+@[\w\.\-]+(\:[0-9]+)?:[\w\-]+/[\w\-\.]+\.git$")]
|
||||||
private static partial Regex regex2();
|
private static partial Regex REG_SSH1();
|
||||||
[GeneratedRegex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-\.]+\.git$")]
|
[GeneratedRegex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-\.]+\.git$")]
|
||||||
private static partial Regex regex3();
|
private static partial Regex REG_SSH2();
|
||||||
|
|
||||||
private static readonly Regex[] URL_FORMATS = [
|
private static readonly Regex[] URL_FORMATS = [
|
||||||
regex1(),
|
REG_HTTPS(),
|
||||||
regex2(),
|
REG_SSH1(),
|
||||||
regex3(),
|
REG_SSH2(),
|
||||||
];
|
];
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
Loading…
Reference in a new issue