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

Commit d47c785

Browse files
committed
Don't append name of repository to clone path
We now specify the path to clone to rather than the parent directory.
1 parent c1f15e1 commit d47c785

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

src/GitHub.App/Services/RepositoryCloneService.cs

Lines changed: 3 additions & 7 deletions
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.Exports.Reactive/Services/IRepositoryCloneService.cs

Lines changed: 0 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 0 additions & 1 deletion
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();

0 commit comments

Comments
 (0)