Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/ViewModels/Launcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public bool TryOpenRepositoryFromPath(string repo)
{
var node = Preferences.Instance.FindOrAddNodeByRepositoryPath(repo, null, false);
Welcome.Instance.Refresh();
TrySwitchToContainingWorkspace(node);
OpenRepositoryInTab(node, null);
return true;
}
Expand All @@ -96,6 +97,7 @@ public bool TryOpenRepositoryFromPath(string repo)
{
var node = Preferences.Instance.FindOrAddNodeByRepositoryPath(test.StdOut.Trim(), null, false);
Welcome.Instance.Refresh();
TrySwitchToContainingWorkspace(node);
OpenRepositoryInTab(node, null);
return true;
}
Expand All @@ -112,6 +114,16 @@ public bool TryOpenRepositoryFromPath(string repo)
return false;
}

private void TrySwitchToContainingWorkspace(RepositoryNode node)
{
if (ActiveWorkspace.Repositories.Contains(node.Id))
return;

var owner = Preferences.Instance.Workspaces.Find(w => w.Repositories.Contains(node.Id));
if (owner != null)
SwitchWorkspace(owner);
}

public void CloseAll()
{
_ignoreIndexChange = true;
Expand Down