mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
enhance: when open repository from commandline, create a new workspace Unnamed
for it, and never add it to preference (#445)
This commit is contained in:
parent
0190c2111d
commit
e63034acd5
1 changed files with 23 additions and 21 deletions
|
@ -35,13 +35,15 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public Launcher(string startupRepo)
|
public Launcher(string startupRepo)
|
||||||
{
|
{
|
||||||
var pref = Preference.Instance;
|
|
||||||
|
|
||||||
Pages = new AvaloniaList<LauncherPage>();
|
Pages = new AvaloniaList<LauncherPage>();
|
||||||
ActiveWorkspace = pref.GetActiveWorkspace();
|
|
||||||
AddNewTab();
|
AddNewTab();
|
||||||
|
|
||||||
var repos = _activeWorkspace.Repositories.ToArray();
|
var pref = Preference.Instance;
|
||||||
|
if (string.IsNullOrEmpty(startupRepo))
|
||||||
|
{
|
||||||
|
ActiveWorkspace = pref.GetActiveWorkspace();
|
||||||
|
|
||||||
|
var repos = ActiveWorkspace.Repositories.ToArray();
|
||||||
foreach (var repo in repos)
|
foreach (var repo in repos)
|
||||||
{
|
{
|
||||||
var node = pref.FindNode(repo);
|
var node = pref.FindNode(repo);
|
||||||
|
@ -59,12 +61,12 @@ namespace SourceGit.ViewModels
|
||||||
OpenRepositoryInTab(node, null);
|
OpenRepositoryInTab(node, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(startupRepo))
|
|
||||||
{
|
|
||||||
ActivePage = Pages[0];
|
ActivePage = Pages[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ActiveWorkspace = new Workspace() { Name = "Unnamed", Color = 4278221015 };
|
||||||
|
|
||||||
var test = new Commands.QueryRepositoryRootPath(startupRepo).ReadToEnd();
|
var test = new Commands.QueryRepositoryRootPath(startupRepo).ReadToEnd();
|
||||||
if (!test.IsSuccess || string.IsNullOrEmpty(test.StdOut))
|
if (!test.IsSuccess || string.IsNullOrEmpty(test.StdOut))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue