@@ -67,11 +67,13 @@ public RepositoryCloneViewModel(
67
67
68
68
var canClone = Observable . CombineLatest (
69
69
repository , this . WhenAnyValue ( x => x . Path ) ,
70
- ( repo , path ) => repo != null && ! service . DestinationFileExists ( path ) && ! service . DestinationDirectoryExists ( path ) ) ;
70
+ ( repo , path ) => repo != null && ! service . DestinationFileExists ( path ) &&
71
+ ( ! service . DestinationDirectoryExists ( path ) ) || service . DestinationDirectoryEmpty ( path ) ) ;
71
72
72
73
var canOpen = Observable . CombineLatest (
73
74
repository , this . WhenAnyValue ( x => x . Path ) ,
74
- ( repo , path ) => repo != null && ! service . DestinationFileExists ( path ) && service . DestinationDirectoryExists ( path ) ) ;
75
+ ( repo , path ) => repo != null && ! service . DestinationFileExists ( path ) && service . DestinationDirectoryExists ( path )
76
+ && ! service . DestinationDirectoryEmpty ( path ) ) ;
75
77
76
78
Browse = ReactiveCommand . Create ( ( ) => BrowseForDirectory ( ) ) ;
77
79
Clone = ReactiveCommand . CreateFromObservable (
@@ -236,13 +238,13 @@ string ValidatePathWarning(RepositoryModel repositoryModel, string path)
236
238
return Resources . DestinationAlreadyExists ;
237
239
}
238
240
239
- if ( service . DestinationDirectoryExists ( path ) )
241
+ if ( service . DestinationDirectoryExists ( path ) && ! service . DestinationDirectoryEmpty ( path ) )
240
242
{
241
243
using ( var repository = gitService . GetRepository ( path ) )
242
244
{
243
245
if ( repository == null )
244
246
{
245
- return Resources . CantFindARepositoryAtLocalPath ;
247
+ return Resources . DirectoryAtDestinationNotEmpty ;
246
248
}
247
249
248
250
var localUrl = gitService . GetRemoteUri ( repository ) ? . ToRepositoryUrl ( ) ;
@@ -254,7 +256,8 @@ string ValidatePathWarning(RepositoryModel repositoryModel, string path)
254
256
var targetUrl = repositoryModel . CloneUrl ? . ToRepositoryUrl ( ) ;
255
257
if ( localUrl != targetUrl )
256
258
{
257
- return string . Format ( CultureInfo . CurrentCulture , Resources . LocalRepositoryHasARemoteOf , localUrl ) ;
259
+ return string . Format ( CultureInfo . CurrentCulture , Resources . LocalRepositoryHasARemoteOf ,
260
+ localUrl ) ;
258
261
}
259
262
260
263
return Resources . YouHaveAlreadyClonedToThisLocation ;
0 commit comments