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

Commit 1e4e8c7

Browse files
committed
Merge branch 'master' into i18n-merge-resources
Conflicts: crowdin.yml
2 parents 7542c70 + c7fcdee commit 1e4e8c7

File tree

8 files changed

+12
-18
lines changed

8 files changed

+12
-18
lines changed

crowdin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
files:
22
- source: /src/GitHub.Resources/Resources.resx
3-
translation: /%original_path%/Resources.%locale%.resx
3+
translation: /%original_path%/Resources.%locale%.resx

src/GitHub.App/Services/RepositoryCloneService.cs

+3-7
Original file line numberDiff line numberDiff line change
@@ -105,30 +105,26 @@ public async Task<ViewerRepositoriesModel> ReadViewerRepositories(HostAddress ad
105105
/// <inheritdoc/>
106106
public async Task CloneRepository(
107107
string cloneUrl,
108-
string repositoryName,
109108
string repositoryPath,
110109
object progress = null)
111110
{
112111
Guard.ArgumentNotEmptyString(cloneUrl, nameof(cloneUrl));
113-
Guard.ArgumentNotEmptyString(repositoryName, nameof(repositoryName));
114112
Guard.ArgumentNotEmptyString(repositoryPath, nameof(repositoryPath));
115113

116-
string path = Path.Combine(repositoryPath, repositoryName);
117-
118114
// Switch to a thread pool thread for IO then back to the main thread to call
119115
// vsGitServices.Clone() as this must be called on the main thread.
120116
await ThreadingHelper.SwitchToPoolThreadAsync();
121-
operatingSystem.Directory.CreateDirectory(path);
117+
operatingSystem.Directory.CreateDirectory(repositoryPath);
122118
await ThreadingHelper.SwitchToMainThreadAsync();
123119

124120
try
125121
{
126-
await vsGitServices.Clone(cloneUrl, path, true, progress);
122+
await vsGitServices.Clone(cloneUrl, repositoryPath, true, progress);
127123
await usageTracker.IncrementCounter(x => x.NumberOfClones);
128124
}
129125
catch (Exception ex)
130126
{
131-
log.Error(ex, "Could not clone {CloneUrl} to {Path}", cloneUrl, path);
127+
log.Error(ex, "Could not clone {CloneUrl} to {Path}", cloneUrl, repositoryPath);
132128
throw;
133129
}
134130
}

src/GitHub.App/Services/RepositoryCreationService.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.IO;
23
using System.ComponentModel.Composition;
34
using System.Reactive;
45
using System.Reactive.Linq;
@@ -36,7 +37,7 @@ public IObservable<Unit> CreateRepository(
3637
Guard.ArgumentNotEmptyString(directory, nameof(directory));
3738

3839
return apiClient.CreateRepository(newRepository, account.Login, account.IsUser)
39-
.Select(repository => cloneService.CloneRepository(repository.CloneUrl, repository.Name, directory))
40+
.Select(repository => cloneService.CloneRepository(repository.CloneUrl, Path.Combine(directory, repository.Name)))
4041
.SelectUnit();
4142
}
4243
}

src/GitHub.Exports.Reactive/Services/IRepositoryCloneService.cs

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public interface IRepositoryCloneService
2121
/// Clones the specificed repository into the specified directory.
2222
/// </summary>
2323
/// <param name="cloneUrl">The url of the repository to clone.</param>
24-
/// <param name="repositoryName">The name of the repository to clone.</param>
2524
/// <param name="repositoryPath">The directory that will contain the repository directory.</param>
2625
/// <param name="progress">
2726
/// An object through which to report progress. This must be of type
@@ -31,7 +30,6 @@ public interface IRepositoryCloneService
3130
/// <returns></returns>
3231
Task CloneRepository(
3332
string cloneUrl,
34-
string repositoryName,
3533
string repositoryPath,
3634
object progress = null);
3735

src/GitHub.StartPage/StartPagePackage.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ async Task<CloneDialogResult> ShowCloneDialog(
132132

133133
if (basePath != null)
134134
{
135-
result = new CloneDialogResult(basePath, repository);
135+
var path = Path.Combine(basePath, repository.Name);
136+
result = new CloneDialogResult(path, repository);
136137
}
137138
}
138139

@@ -142,7 +143,6 @@ async Task<CloneDialogResult> ShowCloneDialog(
142143
{
143144
await cloneService.CloneRepository(
144145
result.Repository.CloneUrl,
145-
result.Repository.Name,
146146
result.Path,
147147
progress);
148148

src/GitHub.TeamFoundation.14/Connect/GitHubConnectSection.cs

-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ async Task DoClone()
153153
var cloneService = ServiceProvider.GetService<IRepositoryCloneService>();
154154
await cloneService.CloneRepository(
155155
result.Repository.CloneUrl,
156-
result.Repository.Name,
157156
result.Path);
158157

159158
usageTracker.IncrementCounter(x => x.NumberOfGitHubConnectSectionClones).Forget();

src/GitHub.VisualStudio/Commands/OpenFromUrlCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public override async Task Execute(string url)
9494
switch (result)
9595
{
9696
case VSConstants.MessageBoxResult.IDYES:
97-
await repositoryCloneService.Value.CloneRepository(cloneUrl, repositoryDirName, targetDir);
97+
await repositoryCloneService.Value.CloneRepository(cloneUrl, repositoryDir);
9898
// Open the cloned repository
9999
dte.Value.ExecuteCommand("File.OpenFolder", repositoryDir);
100100
dte.Value.ExecuteCommand("View.TfsTeamExplorer");

test/GitHub.App.UnitTests/Services/RepositoryCloneServiceTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task ClonesToRepositoryPathAsync()
2121
var vsGitServices = serviceProvider.GetVSGitServices();
2222
var cloneService = serviceProvider.GetRepositoryCloneService();
2323

24-
await cloneService.CloneRepository("https://github.com/foo/bar", "bar", @"c:\dev");
24+
await cloneService.CloneRepository("https://github.com/foo/bar", @"c:\dev\bar");
2525

2626
operatingSystem.Directory.Received().CreateDirectory(@"c:\dev\bar");
2727
await vsGitServices.Received().Clone("https://github.com/foo/bar", @"c:\dev\bar", true);
@@ -37,11 +37,11 @@ public async Task UpdatesMetricsWhenRepositoryClonedAsync()
3737
var usageTracker = Substitute.For<IUsageTracker>();
3838
var cloneService = new RepositoryCloneService(operatingSystem, vsGitServices, graphqlFactory, usageTracker);
3939

40-
await cloneService.CloneRepository("https://github.com/foo/bar", "bar", @"c:\dev");
40+
await cloneService.CloneRepository("https://github.com/foo/bar", @"c:\dev\bar");
4141
var model = UsageModel.Create(Guid.NewGuid());
4242

4343
await usageTracker.Received().IncrementCounter(
44-
Arg.Is<Expression<Func<UsageModel.MeasuresModel, int>>>(x =>
44+
Arg.Is<Expression<Func<UsageModel.MeasuresModel, int>>>(x =>
4545
((MemberExpression)x.Body).Member.Name == nameof(model.Measures.NumberOfClones)));
4646
}
4747
}

0 commit comments

Comments
 (0)