@@ -479,6 +479,12 @@ private void SetChildPresenterSourceControlProviders(ISourceControlProvider prov
479
479
{
480
480
ViewModel_ErrorThrown ( null ,
481
481
new ErrorEventArgs ( RubberduckUI . SourceControl_NoBranchesTitle , RubberduckUI . SourceControl_NoBranchesMessage , NotificationType . Error ) ) ;
482
+
483
+ _config . Repositories . Remove ( _config . Repositories . FirstOrDefault ( repo => repo . Id == _vbe . ActiveVBProject . HelpFile ) ) ;
484
+ _configService . Save ( _config ) ;
485
+
486
+ _provider = null ;
487
+ Status = RubberduckUI . Offline ;
482
488
return ;
483
489
}
484
490
@@ -550,13 +556,14 @@ private void CloneRepo()
550
556
{
551
557
_provider = _providerFactory . CreateProvider ( _vbe . ActiveVBProject ) ;
552
558
var repo = _provider . Clone ( CloneRemotePath , LocalDirectory ) ;
553
- Provider = _providerFactory . CreateProvider ( _vbe . ActiveVBProject , repo , _wrapperFactory ) ;
554
559
AddOrUpdateLocalPathConfig ( new Repository
555
560
{
556
561
Id = _vbe . ActiveVBProject . HelpFile ,
557
562
LocalLocation = repo . LocalLocation ,
558
563
RemoteLocation = repo . RemoteLocation
559
564
} ) ;
565
+
566
+ Provider = _providerFactory . CreateProvider ( _vbe . ActiveVBProject , repo , _wrapperFactory ) ;
560
567
}
561
568
catch ( SourceControlException ex )
562
569
{
@@ -566,25 +573,23 @@ private void CloneRepo()
566
573
567
574
OnOpenRepoCompleted ( ) ;
568
575
CloseCloneRepoGrid ( ) ;
569
-
570
- SetChildPresenterSourceControlProviders ( _provider ) ;
576
+
571
577
Status = RubberduckUI . Online ;
572
578
}
573
579
574
580
private void CreateNewRemoteRepo ( )
575
581
{
576
- try
582
+ if ( Provider == null )
577
583
{
578
- if ( Provider == null )
579
- {
580
- ViewModel_ErrorThrown ( null ,
581
- new ErrorEventArgs ( RubberduckUI . SourceControl_CreateNewRemoteRepo_FailureTitle ,
582
- RubberduckUI . SourceControl_CreateNewRemoteRepo_NoOpenRepo , NotificationType . Error ) ) ;
583
- return ;
584
- }
584
+ ViewModel_ErrorThrown ( null ,
585
+ new ErrorEventArgs ( RubberduckUI . SourceControl_CreateNewRemoteRepo_FailureTitle ,
586
+ RubberduckUI . SourceControl_CreateNewRemoteRepo_NoOpenRepo , NotificationType . Error ) ) ;
587
+ return ;
588
+ }
585
589
590
+ try
591
+ {
586
592
Provider . AddOrigin ( CreateNewRemoteRemotePath , RemoteBranchName ) ;
587
-
588
593
Provider . Publish ( RemoteBranchName ) ;
589
594
}
590
595
catch ( SourceControlException ex )
0 commit comments