mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
Merge pull request #167 from gadfly3173/fix/add-remote-ssh
fix: remove null-check of sshKey in AddRemote and change command execution order
This commit is contained in:
commit
7d49d2b913
1 changed files with 3 additions and 7 deletions
|
@ -79,11 +79,8 @@ namespace SourceGit.ViewModels
|
|||
|
||||
public static ValidationResult ValidateSSHKey(string sshkey, ValidationContext ctx)
|
||||
{
|
||||
if (ctx.ObjectInstance is AddRemote add && add._useSSH)
|
||||
if (ctx.ObjectInstance is AddRemote { _useSSH: true } && !string.IsNullOrEmpty(sshkey))
|
||||
{
|
||||
if (string.IsNullOrEmpty(sshkey))
|
||||
return new ValidationResult("SSH private key is required");
|
||||
|
||||
if (!File.Exists(sshkey))
|
||||
return new ValidationResult("Given SSH private key can NOT be found!");
|
||||
}
|
||||
|
@ -102,10 +99,9 @@ namespace SourceGit.ViewModels
|
|||
if (succ)
|
||||
{
|
||||
SetProgressDescription("Fetching from added remote ...");
|
||||
new Commands.Fetch(_repo.FullPath, _name, true, SetProgressDescription).Exec();
|
||||
|
||||
SetProgressDescription("Post processing ...");
|
||||
new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
|
||||
|
||||
new Commands.Fetch(_repo.FullPath, _name, true, SetProgressDescription).Exec();
|
||||
}
|
||||
CallUIThread(() =>
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue