mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
refactor: rewrite Preference.FindOrAddNodeByRepositoryPath
* prevent moving node while opening repository directly from commandline * supports to set parent node while dropping folder to initialize repository
This commit is contained in:
parent
8d726656dc
commit
faf2c39056
6 changed files with 15 additions and 12 deletions
|
@ -11,9 +11,11 @@ namespace SourceGit.ViewModels
|
|||
set => SetProperty(ref _targetPath, value);
|
||||
}
|
||||
|
||||
public Init(string path)
|
||||
public Init(string path, RepositoryNode parent)
|
||||
{
|
||||
TargetPath = path;
|
||||
_targetPath = path;
|
||||
_parentNode = parent;
|
||||
|
||||
View = new Views.Init() { DataContext = this };
|
||||
}
|
||||
|
||||
|
@ -31,13 +33,14 @@ namespace SourceGit.ViewModels
|
|||
CallUIThread(() =>
|
||||
{
|
||||
var repo = Preference.AddRepository(_targetPath, gitDir);
|
||||
Preference.FindOrAddNodeByRepositoryPath(repo.FullPath, null);
|
||||
Preference.FindOrAddNodeByRepositoryPath(repo.FullPath, _parentNode, true);
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private string _targetPath;
|
||||
private string _targetPath = string.Empty;
|
||||
private RepositoryNode _parentNode = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue