mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-11 23:57:21 -08:00
refactor: add repository
This commit is contained in:
parent
52fba29613
commit
275a52eb5c
6 changed files with 12 additions and 13 deletions
|
@ -129,8 +129,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
CallUIThread(() =>
|
||||
{
|
||||
var normalizedPath = path.Replace("\\", "/");
|
||||
var node = Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, null, true);
|
||||
var node = Preference.Instance.FindOrAddNodeByRepositoryPath(path, null, true);
|
||||
var launcher = App.GetLauncer();
|
||||
var page = null as LauncherPage;
|
||||
foreach (var one in launcher.Pages)
|
||||
|
|
|
@ -38,8 +38,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
CallUIThread(() =>
|
||||
{
|
||||
var normalizedPath = _targetPath.Replace("\\", "/");
|
||||
Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, _parentNode, true);
|
||||
Preference.Instance.FindOrAddNodeByRepositoryPath(_targetPath, _parentNode, true);
|
||||
Welcome.Instance.Refresh();
|
||||
});
|
||||
|
||||
|
|
|
@ -103,8 +103,7 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
var normalized = test.StdOut.Trim().Replace("\\", "/");
|
||||
var node = pref.FindOrAddNodeByRepositoryPath(normalized, null, false);
|
||||
var node = pref.FindOrAddNodeByRepositoryPath(test.StdOut.Trim(), null, false);
|
||||
Welcome.Instance.Refresh();
|
||||
OpenRepositoryInTab(node, null);
|
||||
}
|
||||
|
|
|
@ -405,13 +405,17 @@ namespace SourceGit.ViewModels
|
|||
|
||||
public RepositoryNode FindOrAddNodeByRepositoryPath(string repo, RepositoryNode parent, bool shouldMoveNode)
|
||||
{
|
||||
var node = FindNodeRecursive(repo, RepositoryNodes);
|
||||
var normalized = repo.Replace('\\', '/');
|
||||
if (normalized.EndsWith("/"))
|
||||
normalized = normalized.TrimEnd('/');
|
||||
|
||||
var node = FindNodeRecursive(normalized, RepositoryNodes);
|
||||
if (node == null)
|
||||
{
|
||||
node = new RepositoryNode()
|
||||
{
|
||||
Id = repo,
|
||||
Name = Path.GetFileName(repo),
|
||||
Id = normalized,
|
||||
Name = Path.GetFileName(normalized),
|
||||
Bookmark = 0,
|
||||
IsRepository = true,
|
||||
};
|
||||
|
|
|
@ -307,8 +307,7 @@ namespace SourceGit.Views
|
|||
return;
|
||||
}
|
||||
|
||||
var normalizedPath = test.StdOut.Trim().Replace("\\", "/");
|
||||
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, parent, true);
|
||||
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(test.StdOut.Trim(), parent, true);
|
||||
ViewModels.Welcome.Instance.Refresh();
|
||||
|
||||
var launcher = this.FindAncestorOfType<Launcher>()?.DataContext as ViewModels.Launcher;
|
||||
|
|
|
@ -63,8 +63,7 @@ namespace SourceGit.Views
|
|||
return;
|
||||
}
|
||||
|
||||
var normalizedPath = test.StdOut.Trim().Replace("\\", "/");
|
||||
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, parent, false);
|
||||
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(test.StdOut.Trim(), parent, false);
|
||||
ViewModels.Welcome.Instance.Refresh();
|
||||
|
||||
var launcher = this.FindAncestorOfType<Launcher>()?.DataContext as ViewModels.Launcher;
|
||||
|
|
Loading…
Reference in a new issue