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,36 +35,38 @@ 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;
|
||||||
foreach (var repo in repos)
|
|
||||||
{
|
|
||||||
var node = pref.FindNode(repo);
|
|
||||||
if (node == null)
|
|
||||||
{
|
|
||||||
node = new RepositoryNode()
|
|
||||||
{
|
|
||||||
Id = repo,
|
|
||||||
Name = Path.GetFileName(repo),
|
|
||||||
Bookmark = 0,
|
|
||||||
IsRepository = true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenRepositoryInTab(node, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(startupRepo))
|
if (string.IsNullOrEmpty(startupRepo))
|
||||||
{
|
{
|
||||||
|
ActiveWorkspace = pref.GetActiveWorkspace();
|
||||||
|
|
||||||
|
var repos = ActiveWorkspace.Repositories.ToArray();
|
||||||
|
foreach (var repo in repos)
|
||||||
|
{
|
||||||
|
var node = pref.FindNode(repo);
|
||||||
|
if (node == null)
|
||||||
|
{
|
||||||
|
node = new RepositoryNode()
|
||||||
|
{
|
||||||
|
Id = repo,
|
||||||
|
Name = Path.GetFileName(repo),
|
||||||
|
Bookmark = 0,
|
||||||
|
IsRepository = true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenRepositoryInTab(node, null);
|
||||||
|
}
|
||||||
|
|
||||||
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