Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/GitHub.Exports/Primitives/UriString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public UriString(string uriString) : base(NormalizePath(uriString))
}
}

static UriString ToUriString(Uri uri)
public static UriString ToUriString(Uri uri)
{
return uri == null ? null : new UriString(uri.ToString());
}
Expand Down
11 changes: 8 additions & 3 deletions src/GitHub.Exports/Services/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static T GetExportedValue<T>(this IServiceProvider serviceProvider)
}
}

public static Uri GetRepoUrlFromSolution(IVsSolution solution)
public static UriString GetRepoUrlFromSolution(IVsSolution solution)
{
string solutionDir, solutionFile, userFile;
if (!ErrorHandler.Succeeded(solution.GetSolutionInfo(out solutionDir, out solutionFile, out userFile)))
Expand All @@ -128,7 +128,7 @@ public static Uri GetRepoUrlFromSolution(IVsSolution solution)
return null;
using (var repo = new Repository(repoPath))
{
return GetUriFromRepository(repo)?.ToRepositoryUrl();
return repo.GetUri();
}
}

Expand All @@ -145,7 +145,12 @@ public static Repository GetRepoFromSolution(this IVsSolution solution)
return new Repository(repoPath);
}

public static UriString GetUriFromRepository(Repository repo)
public static UriString GetUri(this Repository repo)
{
return UriString.ToUriString(GetUriFromRepository(repo)?.ToRepositoryUrl());
}

static UriString GetUriFromRepository(Repository repo)
{
return repo
?.Network
Expand Down
4 changes: 2 additions & 2 deletions src/GitHub.VisualStudio/Base/TeamExplorerItemBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ protected virtual void RepoChanged()
if (repo != null)
{
var gitRepo = repo.GetRepoFromIGit();
var uri = Services.GetUriFromRepository(gitRepo);
var name = uri.RepositoryName;
var uri = gitRepo?.GetUri();
var name = uri?.RepositoryName;
if (name != null)
{
ActiveRepoUri = uri;
Expand Down