From be8098ebe31403cb7ed4ce2e408e6fcc135c72e4 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 16 Jun 2021 20:02:05 +0800 Subject: [PATCH] fix: do NOT validate remote's name when edit only remote's URL --- src/Views/Popups/Remote.xaml.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Views/Popups/Remote.xaml.cs b/src/Views/Popups/Remote.xaml.cs index 8e213fb4..8c84c766 100644 --- a/src/Views/Popups/Remote.xaml.cs +++ b/src/Views/Popups/Remote.xaml.cs @@ -31,8 +31,10 @@ namespace SourceGit.Views.Popups { } public override Task Start() { - txtName.GetBindingExpression(TextBox.TextProperty).UpdateSource(); - if (Validation.GetHasError(txtName)) return null; + if (remote == null || remote.Name != RemoteName) { + txtName.GetBindingExpression(TextBox.TextProperty).UpdateSource(); + if (Validation.GetHasError(txtName)) return null; + } txtUrl.GetBindingExpression(TextBox.TextProperty).UpdateSource(); if (Validation.GetHasError(txtUrl)) return null; @@ -44,11 +46,13 @@ namespace SourceGit.Views.Popups { if (succ) new Commands.Fetch(repo.Path, RemoteName, true, UpdateProgress).Exec(); } else { if (remote.URL != RemoteURL) { - new Commands.Remote(repo.Path).SetURL(remote.Name, RemoteURL); + var succ = new Commands.Remote(repo.Path).SetURL(remote.Name, RemoteURL); + if (succ) remote.URL = RemoteURL; } if (remote.Name != RemoteName) { - new Commands.Remote(repo.Path).Rename(remote.Name, RemoteName); + var succ = new Commands.Remote(repo.Path).Rename(remote.Name, RemoteName); + if (succ) remote.Name = RemoteName; } } Models.Watcher.SetEnabled(repo.Path, true);