@@ -67,11 +67,13 @@ public RepositoryCloneViewModel(
6767
6868 var canClone = Observable . CombineLatest (
6969 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 ) ) ;
7172
7273 var canOpen = Observable . CombineLatest (
7374 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 ) ) ;
7577
7678 Browse = ReactiveCommand . Create ( ( ) => BrowseForDirectory ( ) ) ;
7779 Clone = ReactiveCommand . CreateFromObservable (
@@ -236,13 +238,13 @@ string ValidatePathWarning(RepositoryModel repositoryModel, string path)
236238 return Resources . DestinationAlreadyExists ;
237239 }
238240
239- if ( service . DestinationDirectoryExists ( path ) )
241+ if ( service . DestinationDirectoryExists ( path ) && ! service . DestinationDirectoryEmpty ( path ) )
240242 {
241243 using ( var repository = gitService . GetRepository ( path ) )
242244 {
243245 if ( repository == null )
244246 {
245- return Resources . CantFindARepositoryAtLocalPath ;
247+ return Resources . DirectoryAtDestinationNotEmpty ;
246248 }
247249
248250 var localUrl = gitService . GetRemoteUri ( repository ) ? . ToRepositoryUrl ( ) ;
@@ -254,7 +256,8 @@ string ValidatePathWarning(RepositoryModel repositoryModel, string path)
254256 var targetUrl = repositoryModel . CloneUrl ? . ToRepositoryUrl ( ) ;
255257 if ( localUrl != targetUrl )
256258 {
257- return string . Format ( CultureInfo . CurrentCulture , Resources . LocalRepositoryHasARemoteOf , localUrl ) ;
259+ return string . Format ( CultureInfo . CurrentCulture , Resources . LocalRepositoryHasARemoteOf ,
260+ localUrl ) ;
258261 }
259262
260263 return Resources . YouHaveAlreadyClonedToThisLocation ;
0 commit comments