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

Commit efb75e2

Browse files
authored
Merge branch 'master' into fixes/resizeable-peek-view
2 parents d20497f + 8432351 commit efb75e2

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

src/GitHub.App/Services/DialogService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Task<CloneDialogResult> ShowCloneDialog(IConnection connection)
3232
{
3333
var vm = x.View.ViewModel as IBaseCloneViewModel;
3434

35-
vm.Done.Subscribe(_ =>
35+
vm?.Done.Subscribe(_ =>
3636
{
3737
basePath = vm?.BaseRepositoryPath;
3838
repository = vm?.SelectedRepository;

src/GitHub.VisualStudio/Menus/LinkMenuBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ protected async Task<bool> IsCurrentFileInGitHubRepository()
3333

3434
protected Task<UriString> GenerateLink(LinkType linkType)
3535
{
36-
var repo = ActiveRepo;
3736
var activeDocument = ServiceProvider.TryGetService<IActiveDocumentSnapshot>();
3837
if (activeDocument == null)
3938
return null;
39+
40+
var repo = GetRepositoryByPath(activeDocument.Name);
41+
4042
return repo.GenerateUrl(linkType, activeDocument.Name, activeDocument.StartLine, activeDocument.EndLine);
4143
}
4244

src/GitHub.VisualStudio/Menus/MenuBase.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ protected MenuBase(IGitHubServiceProvider serviceProvider)
4646
apiFactory = new Lazy<ISimpleApiClientFactory>(() => ServiceProvider.TryGetService<ISimpleApiClientFactory>());
4747
}
4848

49+
protected ILocalRepositoryModel GetRepositoryByPath(string path)
50+
{
51+
try
52+
{
53+
if (!string.IsNullOrEmpty(path))
54+
{
55+
var repo = ServiceProvider.TryGetService<IGitService>().GetRepository(path);
56+
return new LocalRepositoryModel(repo.Info.WorkingDirectory.TrimEnd('\\'));
57+
}
58+
}
59+
catch (Exception ex)
60+
{
61+
VsOutputLogger.WriteLine(string.Format(CultureInfo.CurrentCulture, "Error loading the repository from '{0}'. {1}", path, ex));
62+
}
63+
64+
return null;
65+
}
66+
4967
protected ILocalRepositoryModel GetActiveRepo()
5068
{
5169
var activeRepo = ServiceProvider.TryGetService<ITeamExplorerServiceHolder>()?.ActiveRepo;

0 commit comments

Comments
 (0)