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

Commit 68d7c8f

Browse files
Simplifying logic
1 parent cb81d03 commit 68d7c8f

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/GitHub.App/ViewModels/Dialog/Clone/RepositoryCloneViewModel.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -242,23 +242,22 @@ string ValidatePathWarning(RepositoryModel repositoryModel, string path)
242242
{
243243
using (var repository = gitService.GetRepository(path))
244244
{
245-
if (repository != null)
245+
if (repository == null)
246246
{
247-
var localUrl = gitService.GetRemoteUri(repository)?.ToRepositoryUrl();
248-
if (localUrl == null)
249-
{
250-
return Resources.LocalRepositoryDoesntHaveARemoteOrigin;
251-
}
252-
253-
var targetUrl = repositoryModel.CloneUrl?.ToRepositoryUrl();
254-
if (localUrl != targetUrl)
255-
{
256-
return string.Format(CultureInfo.CurrentCulture, Resources.LocalRepositoryHasARemoteOf, localUrl);
257-
}
247+
return Resources.DirectoryAtDestinationNotEmpty;
258248
}
259-
else
249+
250+
var localUrl = gitService.GetRemoteUri(repository)?.ToRepositoryUrl();
251+
if (localUrl == null)
260252
{
261-
return Resources.DirectoryAtDestinationNotEmpty;
253+
return Resources.LocalRepositoryDoesntHaveARemoteOrigin;
254+
}
255+
256+
var targetUrl = repositoryModel.CloneUrl?.ToRepositoryUrl();
257+
if (localUrl != targetUrl)
258+
{
259+
return string.Format(CultureInfo.CurrentCulture, Resources.LocalRepositoryHasARemoteOf,
260+
localUrl);
262261
}
263262

264263
return Resources.YouHaveAlreadyClonedToThisLocation;

0 commit comments

Comments
 (0)