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

Commit a49e5de

Browse files
authored
Merge pull request #2202 from github/fixes/2199-reclone-using-new-open-clone-dialog
Use modern clone dialog when re-cloning a repository
2 parents fced2fe + 9102daf commit a49e5de

File tree

8 files changed

+4
-436
lines changed

8 files changed

+4
-436
lines changed

src/GitHub.App/SampleData/RepositoryRecloneViewModelDesigner.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/GitHub.App/Services/DialogService.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ public async Task<CloneDialogResult> ShowCloneDialog(IConnection connection, str
6969
}
7070
}
7171

72-
public async Task<string> ShowReCloneDialog(RepositoryModel repository)
73-
{
74-
Guard.ArgumentNotNull(repository, nameof(repository));
75-
76-
var viewModel = factory.CreateViewModel<IRepositoryRecloneViewModel>();
77-
viewModel.SelectedRepository = repository;
78-
return (string)await showDialog.ShowWithFirstConnection(viewModel);
79-
}
80-
8172
public async Task ShowCreateGist(IConnection connection)
8273
{
8374
var viewModel = factory.CreateViewModel<IGistCreationViewModel>();

src/GitHub.App/ViewModels/Dialog/RepositoryRecloneViewModel.cs

Lines changed: 0 additions & 162 deletions
This file was deleted.

src/GitHub.Exports.Reactive/ViewModels/Dialog/IRepositoryRecloneViewModel.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/GitHub.Exports/Services/IDialogService.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,6 @@ public interface IDialogService
2525
/// </returns>
2626
Task<CloneDialogResult> ShowCloneDialog(IConnection connection, string url = null);
2727

28-
/// <summary>
29-
/// Shows the re-clone dialog.
30-
/// </summary>
31-
/// <param name="repository">The repository to clone.</param>
32-
/// <returns>
33-
/// A task that returns the base path for the clone on success, or null if the dialog was
34-
/// cancelled.
35-
/// </returns>
36-
/// <remarks>
37-
/// The re-clone dialog is shown from the VS2017+ start page when the user wants to check
38-
/// out a repository that was previously checked out on another machine.
39-
/// </remarks>
40-
Task<string> ShowReCloneDialog(RepositoryModel repository);
41-
4228
/// <summary>
4329
/// Shows the Create Gist dialog.
4430
/// </summary>

src/GitHub.StartPage/StartPagePackage.cs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.IO;
32
using System.Runtime.InteropServices;
43
using System.Threading;
54
using System.Threading.Tasks;
@@ -90,39 +89,24 @@ static async Task<CloneDialogResult> ShowCloneDialog(
9089
var dialogService = gitHubServiceProvider.GetService<IDialogService>();
9190
var cloneService = gitHubServiceProvider.GetService<IRepositoryCloneService>();
9291
var usageTracker = gitHubServiceProvider.GetService<IUsageTracker>();
93-
CloneDialogResult result = null;
9492

95-
if (repository == null)
96-
{
97-
result = await dialogService.ShowCloneDialog(null);
98-
}
99-
else
100-
{
101-
var basePath = await dialogService.ShowReCloneDialog(repository);
102-
103-
if (basePath != null)
104-
{
105-
var path = Path.Combine(basePath, repository.Name);
106-
result = new CloneDialogResult(path, repository.CloneUrl);
107-
}
108-
}
109-
110-
if (result != null)
93+
var cloneUrl = repository?.CloneUrl;
94+
if (await dialogService.ShowCloneDialog(null, cloneUrl) is CloneDialogResult result)
11195
{
11296
try
11397
{
11498
await cloneService.CloneOrOpenRepository(result, progress, cancellationToken);
11599
usageTracker.IncrementCounter(x => x.NumberOfStartPageClones).Forget();
100+
return result;
116101
}
117102
catch
118103
{
119104
var teServices = gitHubServiceProvider.TryGetService<ITeamExplorerServices>();
120105
teServices.ShowError($"Failed to clone the repository '{result.Url.RepositoryName}'");
121-
result = null;
122106
}
123107
}
124108

125-
return result;
109+
return null;
126110
}
127111
}
128112
}

0 commit comments

Comments
 (0)