Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 211148f

Browse files
committed
Merge branch 'shana/fix-repo-uri-parsing' into beta-1.0.12
2 parents 7fdad7d + d532154 commit 211148f

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/GitHub.Exports/Primitives/UriString.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public UriString(string uriString) : base(NormalizePath(uriString))
5151
}
5252
}
5353

54-
static UriString ToUriString(Uri uri)
54+
public static UriString ToUriString(Uri uri)
5555
{
5656
return uri == null ? null : new UriString(uri.ToString());
5757
}

src/GitHub.Exports/Services/Services.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static T GetExportedValue<T>(this IServiceProvider serviceProvider)
116116
}
117117
}
118118

119-
public static Uri GetRepoUrlFromSolution(IVsSolution solution)
119+
public static UriString GetRepoUrlFromSolution(IVsSolution solution)
120120
{
121121
string solutionDir, solutionFile, userFile;
122122
if (!ErrorHandler.Succeeded(solution.GetSolutionInfo(out solutionDir, out solutionFile, out userFile)))
@@ -128,7 +128,7 @@ public static Uri GetRepoUrlFromSolution(IVsSolution solution)
128128
return null;
129129
using (var repo = new Repository(repoPath))
130130
{
131-
return GetUriFromRepository(repo)?.ToRepositoryUrl();
131+
return repo.GetUri();
132132
}
133133
}
134134

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

148-
public static UriString GetUriFromRepository(Repository repo)
148+
public static UriString GetUri(this Repository repo)
149+
{
150+
return UriString.ToUriString(GetUriFromRepository(repo)?.ToRepositoryUrl());
151+
}
152+
153+
static UriString GetUriFromRepository(Repository repo)
149154
{
150155
return repo
151156
?.Network

src/GitHub.VisualStudio/Base/TeamExplorerItemBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ protected virtual void RepoChanged()
4848
if (repo != null)
4949
{
5050
var gitRepo = repo.GetRepoFromIGit();
51-
var uri = Services.GetUriFromRepository(gitRepo);
52-
var name = uri.RepositoryName;
51+
var uri = gitRepo?.GetUri();
52+
var name = uri?.RepositoryName;
5353
if (name != null)
5454
{
5555
ActiveRepoUri = uri;

0 commit comments

Comments
 (0)