mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
Merge branch 'hotfix/v8.22.1'
This commit is contained in:
commit
41dfbb3754
16 changed files with 68 additions and 74 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
8.22
|
8.22.1
|
|
@ -520,7 +520,7 @@ namespace SourceGit
|
||||||
desktop.MainWindow = new Views.Launcher() { DataContext = _launcher };
|
desktop.MainWindow = new Views.Launcher() { DataContext = _launcher };
|
||||||
|
|
||||||
var pref = ViewModels.Preference.Instance;
|
var pref = ViewModels.Preference.Instance;
|
||||||
if (pref.ShouldCheck4UpdateOnStartup)
|
if (pref.ShouldCheck4UpdateOnStartup())
|
||||||
{
|
{
|
||||||
pref.Save();
|
pref.Save();
|
||||||
Check4Update();
|
Check4Update();
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace SourceGit.Commands
|
||||||
|
|
||||||
// If an SSH private key was provided, sets the environment.
|
// If an SSH private key was provided, sets the environment.
|
||||||
if (!string.IsNullOrEmpty(SSHKey))
|
if (!string.IsNullOrEmpty(SSHKey))
|
||||||
start.Environment.Add("GIT_SSH_COMMAND", $"ssh -i '{SSHKey}'");
|
start.Environment.Add("GIT_SSH_COMMAND", $"ssh -o StrictHostKeyChecking=accept-new -i '{SSHKey}'");
|
||||||
else
|
else
|
||||||
start.Arguments += "-c credential.helper=manager ";
|
start.Arguments += "-c credential.helper=manager ";
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace SourceGit.Commands
|
||||||
branch.IsCurrent = parts[2] == "*";
|
branch.IsCurrent = parts[2] == "*";
|
||||||
branch.Upstream = parts[3];
|
branch.Upstream = parts[3];
|
||||||
|
|
||||||
if (branch.IsLocal && !parts[4].Equals("=", StringComparison.Ordinal))
|
if (branch.IsLocal && !string.IsNullOrEmpty(parts[4]) && !parts[4].Equals("=", StringComparison.Ordinal))
|
||||||
_needQueryTrackStatus.Add(branch);
|
_needQueryTrackStatus.Add(branch);
|
||||||
else
|
else
|
||||||
branch.TrackStatus = new Models.BranchTrackStatus();
|
branch.TrackStatus = new Models.BranchTrackStatus();
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace SourceGit.ViewModels
|
||||||
CallUIThread(() =>
|
CallUIThread(() =>
|
||||||
{
|
{
|
||||||
var normalizedPath = path.Replace("\\", "/");
|
var normalizedPath = path.Replace("\\", "/");
|
||||||
var node = Preference.FindOrAddNodeByRepositoryPath(normalizedPath, null, true);
|
var node = Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, null, true);
|
||||||
_launcher.OpenRepositoryInTab(node, _page);
|
_launcher.OpenRepositoryInTab(node, _page);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public override Task<bool> Sure()
|
public override Task<bool> Sure()
|
||||||
{
|
{
|
||||||
Preference.AddNode(new RepositoryNode()
|
Preference.Instance.AddNode(new RepositoryNode()
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid().ToString(),
|
Id = Guid.NewGuid().ToString(),
|
||||||
Name = _name,
|
Name = _name,
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public override Task<bool> Sure()
|
public override Task<bool> Sure()
|
||||||
{
|
{
|
||||||
Preference.RemoveNode(_node);
|
Preference.Instance.RemoveNode(_node);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace SourceGit.ViewModels
|
||||||
_node.Bookmark = _bookmark;
|
_node.Bookmark = _bookmark;
|
||||||
|
|
||||||
if (needSort)
|
if (needSort)
|
||||||
Preference.SortByRenamedNode(_node);
|
Preference.Instance.SortByRenamedNode(_node);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace SourceGit.ViewModels
|
||||||
CallUIThread(() =>
|
CallUIThread(() =>
|
||||||
{
|
{
|
||||||
var normalizedPath = _targetPath.Replace("\\", "/");
|
var normalizedPath = _targetPath.Replace("\\", "/");
|
||||||
Preference.FindOrAddNodeByRepositoryPath(normalizedPath, _parentNode, true);
|
Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, _parentNode, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
@ -34,6 +32,7 @@ namespace SourceGit.ViewModels
|
||||||
Pages = new AvaloniaList<LauncherPage>();
|
Pages = new AvaloniaList<LauncherPage>();
|
||||||
AddNewTab();
|
AddNewTab();
|
||||||
|
|
||||||
|
var pref = Preference.Instance;
|
||||||
if (!string.IsNullOrEmpty(startupRepo))
|
if (!string.IsNullOrEmpty(startupRepo))
|
||||||
{
|
{
|
||||||
var root = new Commands.QueryRepositoryRootPath(startupRepo).Result();
|
var root = new Commands.QueryRepositoryRootPath(startupRepo).Result();
|
||||||
|
@ -48,14 +47,14 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
var normalized = root.Replace("\\", "/");
|
var normalized = root.Replace("\\", "/");
|
||||||
var node = Preference.FindOrAddNodeByRepositoryPath(normalized, null, false);
|
var node = pref.FindOrAddNodeByRepositoryPath(normalized, null, false);
|
||||||
OpenRepositoryInTab(node, null);
|
OpenRepositoryInTab(node, null);
|
||||||
}
|
}
|
||||||
else if (Preference.Instance.RestoreTabs)
|
else if (pref.RestoreTabs)
|
||||||
{
|
{
|
||||||
foreach (var id in Preference.Instance.OpenedTabs)
|
foreach (var id in pref.OpenedTabs)
|
||||||
{
|
{
|
||||||
var node = Preference.FindNode(id);
|
var node = pref.FindNode(id);
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
node = new RepositoryNode()
|
node = new RepositoryNode()
|
||||||
|
@ -70,7 +69,7 @@ namespace SourceGit.ViewModels
|
||||||
OpenRepositoryInTab(node, null);
|
OpenRepositoryInTab(node, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastActiveIdx = Preference.Instance.LastActiveTabIdx;
|
var lastActiveIdx = pref.LastActiveTabIdx;
|
||||||
if (lastActiveIdx >= 0 && lastActiveIdx < Pages.Count)
|
if (lastActiveIdx >= 0 && lastActiveIdx < Pages.Count)
|
||||||
ActivePage = Pages[lastActiveIdx];
|
ActivePage = Pages[lastActiveIdx];
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace SourceGit.ViewModels
|
||||||
if (_instance.MonospaceFont == null)
|
if (_instance.MonospaceFont == null)
|
||||||
_instance.MonospaceFont = new FontFamily("fonts:SourceGit#JetBrains Mono");
|
_instance.MonospaceFont = new FontFamily("fonts:SourceGit#JetBrains Mono");
|
||||||
|
|
||||||
if (!_instance.IsGitConfigured)
|
if (!_instance.IsGitConfigured())
|
||||||
_instance.GitInstallPath = Native.OS.FindGitExecutable();
|
_instance.GitInstallPath = Native.OS.FindGitExecutable();
|
||||||
|
|
||||||
return _instance;
|
return _instance;
|
||||||
|
@ -213,12 +213,6 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _commitChangeViewMode, value);
|
set => SetProperty(ref _commitChangeViewMode, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool IsGitConfigured
|
|
||||||
{
|
|
||||||
get => !string.IsNullOrEmpty(GitInstallPath) && File.Exists(GitInstallPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GitInstallPath
|
public string GitInstallPath
|
||||||
{
|
{
|
||||||
get => Native.OS.GitExecutable;
|
get => Native.OS.GitExecutable;
|
||||||
|
@ -326,28 +320,30 @@ namespace SourceGit.ViewModels
|
||||||
set;
|
set;
|
||||||
} = 0;
|
} = 0;
|
||||||
|
|
||||||
[JsonIgnore]
|
public bool IsGitConfigured()
|
||||||
public bool ShouldCheck4UpdateOnStartup
|
|
||||||
{
|
{
|
||||||
get
|
var path = GitInstallPath;
|
||||||
{
|
return !string.IsNullOrEmpty(path) && File.Exists(path);
|
||||||
if (!_check4UpdatesOnStartup)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var lastCheck = DateTime.UnixEpoch.AddSeconds(LastCheckUpdateTime).ToLocalTime();
|
|
||||||
var now = DateTime.Now;
|
|
||||||
|
|
||||||
if (lastCheck.Year == now.Year && lastCheck.Month == now.Month && lastCheck.Day == now.Day)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
LastCheckUpdateTime = now.Subtract(DateTime.UnixEpoch.ToLocalTime()).TotalSeconds;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddNode(RepositoryNode node, RepositoryNode to = null)
|
public bool ShouldCheck4UpdateOnStartup()
|
||||||
{
|
{
|
||||||
var collection = to == null ? _instance._repositoryNodes : to.SubNodes;
|
if (!_check4UpdatesOnStartup)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var lastCheck = DateTime.UnixEpoch.AddSeconds(LastCheckUpdateTime).ToLocalTime();
|
||||||
|
var now = DateTime.Now;
|
||||||
|
|
||||||
|
if (lastCheck.Year == now.Year && lastCheck.Month == now.Month && lastCheck.Day == now.Day)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
LastCheckUpdateTime = now.Subtract(DateTime.UnixEpoch.ToLocalTime()).TotalSeconds;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddNode(RepositoryNode node, RepositoryNode to = null)
|
||||||
|
{
|
||||||
|
var collection = to == null ? _repositoryNodes : to.SubNodes;
|
||||||
var list = new List<RepositoryNode>();
|
var list = new List<RepositoryNode>();
|
||||||
list.AddRange(collection);
|
list.AddRange(collection);
|
||||||
list.Add(node);
|
list.Add(node);
|
||||||
|
@ -364,14 +360,14 @@ namespace SourceGit.ViewModels
|
||||||
collection.Add(one);
|
collection.Add(one);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RepositoryNode FindNode(string id)
|
public RepositoryNode FindNode(string id)
|
||||||
{
|
{
|
||||||
return FindNodeRecursive(id, _instance.RepositoryNodes);
|
return FindNodeRecursive(id, RepositoryNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RepositoryNode FindOrAddNodeByRepositoryPath(string repo, RepositoryNode parent, bool shouldMoveNode)
|
public RepositoryNode FindOrAddNodeByRepositoryPath(string repo, RepositoryNode parent, bool shouldMoveNode)
|
||||||
{
|
{
|
||||||
var node = FindNodeRecursive(repo, _instance.RepositoryNodes);
|
var node = FindNodeRecursive(repo, RepositoryNodes);
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
node = new RepositoryNode()
|
node = new RepositoryNode()
|
||||||
|
@ -392,9 +388,9 @@ namespace SourceGit.ViewModels
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MoveNode(RepositoryNode node, RepositoryNode to = null)
|
public void MoveNode(RepositoryNode node, RepositoryNode to = null)
|
||||||
{
|
{
|
||||||
if (to == null && _instance._repositoryNodes.Contains(node))
|
if (to == null && _repositoryNodes.Contains(node))
|
||||||
return;
|
return;
|
||||||
if (to != null && to.SubNodes.Contains(node))
|
if (to != null && to.SubNodes.Contains(node))
|
||||||
return;
|
return;
|
||||||
|
@ -403,14 +399,14 @@ namespace SourceGit.ViewModels
|
||||||
AddNode(node, to);
|
AddNode(node, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RemoveNode(RepositoryNode node)
|
public void RemoveNode(RepositoryNode node)
|
||||||
{
|
{
|
||||||
RemoveNodeRecursive(node, _instance._repositoryNodes);
|
RemoveNodeRecursive(node, _repositoryNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SortByRenamedNode(RepositoryNode node)
|
public void SortByRenamedNode(RepositoryNode node)
|
||||||
{
|
{
|
||||||
var container = FindNodeContainer(node, _instance._repositoryNodes);
|
var container = FindNodeContainer(node, _repositoryNodes);
|
||||||
if (container == null)
|
if (container == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -435,7 +431,7 @@ namespace SourceGit.ViewModels
|
||||||
File.WriteAllText(_savePath, data);
|
File.WriteAllText(_savePath, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RepositoryNode FindNodeRecursive(string id, AvaloniaList<RepositoryNode> collection)
|
private RepositoryNode FindNodeRecursive(string id, AvaloniaList<RepositoryNode> collection)
|
||||||
{
|
{
|
||||||
foreach (var node in collection)
|
foreach (var node in collection)
|
||||||
{
|
{
|
||||||
|
@ -450,7 +446,7 @@ namespace SourceGit.ViewModels
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AvaloniaList<RepositoryNode> FindNodeContainer(RepositoryNode node, AvaloniaList<RepositoryNode> collection)
|
private AvaloniaList<RepositoryNode> FindNodeContainer(RepositoryNode node, AvaloniaList<RepositoryNode> collection)
|
||||||
{
|
{
|
||||||
foreach (var sub in collection)
|
foreach (var sub in collection)
|
||||||
{
|
{
|
||||||
|
@ -465,7 +461,7 @@ namespace SourceGit.ViewModels
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool RemoveNodeRecursive(RepositoryNode node, AvaloniaList<RepositoryNode> collection)
|
private bool RemoveNodeRecursive(RepositoryNode node, AvaloniaList<RepositoryNode> collection)
|
||||||
{
|
{
|
||||||
if (collection.Contains(node))
|
if (collection.Contains(node))
|
||||||
{
|
{
|
||||||
|
|
|
@ -965,7 +965,7 @@ namespace SourceGit.ViewModels
|
||||||
var root = Path.GetFullPath(Path.Combine(_fullpath, submodule));
|
var root = Path.GetFullPath(Path.Combine(_fullpath, submodule));
|
||||||
var normalizedPath = root.Replace("\\", "/");
|
var normalizedPath = root.Replace("\\", "/");
|
||||||
|
|
||||||
var node = Preference.FindNode(normalizedPath);
|
var node = Preference.Instance.FindNode(normalizedPath);
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
node = new RepositoryNode()
|
node = new RepositoryNode()
|
||||||
|
@ -996,7 +996,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public void OpenWorktree(Models.Worktree worktree)
|
public void OpenWorktree(Models.Worktree worktree)
|
||||||
{
|
{
|
||||||
var node = Preference.FindNode(worktree.FullPath);
|
var node = Preference.Instance.FindNode(worktree.FullPath);
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
node = new RepositoryNode()
|
node = new RepositoryNode()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
@ -23,13 +24,13 @@ namespace SourceGit.ViewModels
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _searchFilter, value))
|
if (SetProperty(ref _searchFilter, value))
|
||||||
Referesh();
|
Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitRepository(string path, RepositoryNode parent)
|
public void InitRepository(string path, RepositoryNode parent)
|
||||||
{
|
{
|
||||||
if (!Preference.Instance.IsGitConfigured)
|
if (!Preference.Instance.IsGitConfigured())
|
||||||
{
|
{
|
||||||
App.RaiseException(PopupHost.Active.GetId(), App.Text("NotConfigured"));
|
App.RaiseException(PopupHost.Active.GetId(), App.Text("NotConfigured"));
|
||||||
return;
|
return;
|
||||||
|
@ -43,7 +44,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public void Clone()
|
public void Clone()
|
||||||
{
|
{
|
||||||
if (!Preference.Instance.IsGitConfigured)
|
if (!Preference.Instance.IsGitConfigured())
|
||||||
{
|
{
|
||||||
App.RaiseException(string.Empty, App.Text("NotConfigured"));
|
App.RaiseException(string.Empty, App.Text("NotConfigured"));
|
||||||
return;
|
return;
|
||||||
|
@ -58,7 +59,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public void OpenTerminal()
|
public void OpenTerminal()
|
||||||
{
|
{
|
||||||
if (!Preference.Instance.IsGitConfigured)
|
if (!Preference.Instance.IsGitConfigured())
|
||||||
{
|
{
|
||||||
App.RaiseException(PopupHost.Active.GetId(), App.Text("NotConfigured"));
|
App.RaiseException(PopupHost.Active.GetId(), App.Text("NotConfigured"));
|
||||||
}
|
}
|
||||||
|
@ -81,7 +82,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public void MoveNode(RepositoryNode from, RepositoryNode to)
|
public void MoveNode(RepositoryNode from, RepositoryNode to)
|
||||||
{
|
{
|
||||||
Preference.MoveNode(from, to);
|
Preference.Instance.MoveNode(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContextMenu CreateContextMenu(RepositoryNode node)
|
public ContextMenu CreateContextMenu(RepositoryNode node)
|
||||||
|
@ -166,7 +167,7 @@ namespace SourceGit.ViewModels
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Referesh()
|
private void Refresh()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(_searchFilter))
|
if (string.IsNullOrWhiteSpace(_searchFilter))
|
||||||
{
|
{
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace SourceGit.Views
|
||||||
});
|
});
|
||||||
|
|
||||||
var ver = string.Empty;
|
var ver = string.Empty;
|
||||||
if (pref.IsGitConfigured)
|
if (pref.IsGitConfigured())
|
||||||
{
|
{
|
||||||
var config = new Commands.Config(null).ListAll();
|
var config = new Commands.Config(null).ListAll();
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void OnTreeNodeContextRequested(object sender, ContextRequestedEventArgs e)
|
private void OnTreeNodeContextRequested(object sender, ContextRequestedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is Grid grid && DataContext is ViewModels.Welcome vm)
|
if (sender is Grid grid)
|
||||||
{
|
{
|
||||||
var menu = vm.CreateContextMenu(grid.DataContext as ViewModels.RepositoryNode);
|
var menu = ViewModels.Welcome.Instance.CreateContextMenu(grid.DataContext as ViewModels.RepositoryNode);
|
||||||
grid.OpenContextMenu(menu);
|
grid.OpenContextMenu(menu);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
@ -109,9 +109,7 @@ namespace SourceGit.Views
|
||||||
if (e.Data.Get("MovedRepositoryTreeNode") is ViewModels.RepositoryNode moved)
|
if (e.Data.Get("MovedRepositoryTreeNode") is ViewModels.RepositoryNode moved)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
ViewModels.Welcome.Instance.MoveNode(moved, null);
|
||||||
if (DataContext is ViewModels.Welcome vm)
|
|
||||||
vm.MoveNode(moved, null);
|
|
||||||
}
|
}
|
||||||
else if (e.Data.Contains(DataFormats.Files))
|
else if (e.Data.Contains(DataFormats.Files))
|
||||||
{
|
{
|
||||||
|
@ -173,8 +171,8 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|
||||||
if (to != moved && DataContext is ViewModels.Welcome vm)
|
if (to != moved)
|
||||||
vm.MoveNode(moved, to);
|
ViewModels.Welcome.Instance.MoveNode(moved, to);
|
||||||
}
|
}
|
||||||
else if (e.Data.Contains(DataFormats.Files))
|
else if (e.Data.Contains(DataFormats.Files))
|
||||||
{
|
{
|
||||||
|
@ -222,12 +220,12 @@ namespace SourceGit.Views
|
||||||
var root = new Commands.QueryRepositoryRootPath(path).Result();
|
var root = new Commands.QueryRepositoryRootPath(path).Result();
|
||||||
if (string.IsNullOrEmpty(root))
|
if (string.IsNullOrEmpty(root))
|
||||||
{
|
{
|
||||||
(DataContext as ViewModels.Welcome)?.InitRepository(path, parent);
|
ViewModels.Welcome.Instance.InitRepository(path, parent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var normalizedPath = root.Replace("\\", "/");
|
var normalizedPath = root.Replace("\\", "/");
|
||||||
var node = ViewModels.Preference.FindOrAddNodeByRepositoryPath(normalizedPath, parent, true);
|
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, parent, true);
|
||||||
var launcher = this.FindAncestorOfType<Launcher>()?.DataContext as ViewModels.Launcher;
|
var launcher = this.FindAncestorOfType<Launcher>()?.DataContext as ViewModels.Launcher;
|
||||||
launcher?.OpenRepositoryInTab(node, launcher.ActivePage);
|
launcher?.OpenRepositoryInTab(node, launcher.ActivePage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,12 +44,12 @@ namespace SourceGit.Views
|
||||||
var root = new Commands.QueryRepositoryRootPath(path).Result();
|
var root = new Commands.QueryRepositoryRootPath(path).Result();
|
||||||
if (string.IsNullOrEmpty(root))
|
if (string.IsNullOrEmpty(root))
|
||||||
{
|
{
|
||||||
(DataContext as ViewModels.Welcome)?.InitRepository(path, parent);
|
ViewModels.Welcome.Instance.InitRepository(path, parent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var normalizedPath = root.Replace("\\", "/");
|
var normalizedPath = root.Replace("\\", "/");
|
||||||
var node = ViewModels.Preference.FindOrAddNodeByRepositoryPath(normalizedPath, parent, true);
|
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, parent, true);
|
||||||
var launcher = this.FindAncestorOfType<Launcher>()?.DataContext as ViewModels.Launcher;
|
var launcher = this.FindAncestorOfType<Launcher>()?.DataContext as ViewModels.Launcher;
|
||||||
launcher?.OpenRepositoryInTab(node, launcher.ActivePage);
|
launcher?.OpenRepositoryInTab(node, launcher.ActivePage);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue