-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
# Conflicts: # nuspec/nuget/TfsUrlParser.nuspec
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,9 +28,17 @@ public RepositoryDescription(Uri repoUrl) | |
|
||
var gitSeparator = new[] { "/_git/" }; | ||
var splitPath = repoUrl.AbsolutePath.Split(gitSeparator, StringSplitOptions.None); | ||
if (splitPath.Length < 2) | ||
if (repoUrl.ToString().Contains("/_git/")) | ||
{ | ||
throw new UriFormatException("No valid Git repository URL."); | ||
this.IsRepository = true; | ||
if (splitPath.Length < 2) | ||
{ | ||
throw new UriFormatException("No valid Git repository URL."); | ||
} | ||
} | ||
else | ||
{ | ||
this.IsRepository = false; | ||
} | ||
|
||
this.ServerUrl = new Uri(repoUrl.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)); | ||
|
@@ -56,11 +64,13 @@ public RepositoryDescription(Uri repoUrl) | |
{ | ||
throw new UriFormatException("No valid Git repository URL containing default collection and project name."); | ||
} | ||
Check warning on line 66 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
Check warning on line 66 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
Check warning on line 66 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
Check warning on line 66 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
Check warning on line 66 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
|
||
|
||
var splitLastPart = splitPath[1].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | ||
|
||
this.ProjectName = splitFirstPart.Last(); | ||
this.RepositoryName = splitLastPart.First(); | ||
|
||
if (this.IsRepository) | ||
{ | ||
var splitLastPart = splitPath[1].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | ||
this.RepositoryName = splitLastPart.First(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
|
@@ -94,6 +104,11 @@ public RepositoryDescription(Uri repoUrl) | |
/// </summary> | ||
public Uri RepositoryUrl { get; private set; } | ||
|
||
/// <summary> | ||
/// Get a value that indicates if this is a Git Repo or another TFS URL. | ||
/// </summary> | ||
public bool IsRepository { get; private set; } | ||
Check warning on line 110 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
Check warning on line 110 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
Check warning on line 110 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
Check warning on line 110 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
Check warning on line 110 in src/TfsUrlParser/RepositoryDescription.cs GitHub Actions / build (ubuntu-latest)
|
||
|
||
/// <summary> | ||
/// Converts the repository URL to a supported scheme if possible. | ||
/// </summary> | ||
|