File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ public bool TryOpenRepositoryFromPath(string repo)
8787 {
8888 var node = Preferences . Instance . FindOrAddNodeByRepositoryPath ( repo , null , false ) ;
8989 Welcome . Instance . Refresh ( ) ;
90+ TrySwitchToContainingWorkspace ( node ) ;
9091 OpenRepositoryInTab ( node , null ) ;
9192 return true ;
9293 }
@@ -96,6 +97,7 @@ public bool TryOpenRepositoryFromPath(string repo)
9697 {
9798 var node = Preferences . Instance . FindOrAddNodeByRepositoryPath ( test . StdOut . Trim ( ) , null , false ) ;
9899 Welcome . Instance . Refresh ( ) ;
100+ TrySwitchToContainingWorkspace ( node ) ;
99101 OpenRepositoryInTab ( node , null ) ;
100102 return true ;
101103 }
@@ -112,6 +114,16 @@ public bool TryOpenRepositoryFromPath(string repo)
112114 return false ;
113115 }
114116
117+ private void TrySwitchToContainingWorkspace ( RepositoryNode node )
118+ {
119+ if ( ActiveWorkspace . Repositories . Contains ( node . Id ) )
120+ return ;
121+
122+ var owner = Preferences . Instance . Workspaces . Find ( w => w . Repositories . Contains ( node . Id ) ) ;
123+ if ( owner != null )
124+ SwitchWorkspace ( owner ) ;
125+ }
126+
115127 public void CloseAll ( )
116128 {
117129 _ignoreIndexChange = true ;
You can’t perform that action at this time.
0 commit comments