diff --git a/src/ViewModels/RenameBranch.cs b/src/ViewModels/RenameBranch.cs index acd38ced..9b387f9d 100644 --- a/src/ViewModels/RenameBranch.cs +++ b/src/ViewModels/RenameBranch.cs @@ -8,7 +8,6 @@ namespace SourceGit.ViewModels public Models.Branch Target { get; - private set; } [Required(ErrorMessage = "Branch name is required!!!")] @@ -54,8 +53,19 @@ namespace SourceGit.ViewModels return Task.Run(() => { + var oldName = Target.FullName; var succ = Commands.Branch.Rename(_repo.FullPath, Target.Name, _name); - CallUIThread(() => _repo.SetWatcherEnabled(true)); + CallUIThread(() => + { + if (succ && _repo.Settings.Filters.Contains(oldName)) + { + _repo.Settings.Filters.Remove(oldName); + _repo.Settings.Filters.Add($"refs/heads/{_name}"); + } + + _repo.MarkBranchesDirtyManually(); + _repo.SetWatcherEnabled(true); + }); return succ; }); } diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 414a135b..8038f333 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -841,7 +841,7 @@ namespace SourceGit.ViewModels if (_settings.Filters.Count != validFilters.Count) { - Dispatcher.UIThread.Post(() => + Dispatcher.UIThread.Invoke(() => { _settings.Filters.Clear(); _settings.Filters.AddRange(validFilters); @@ -850,6 +850,9 @@ namespace SourceGit.ViewModels } else { + if (_settings.Filters.Count != 0) + Dispatcher.UIThread.Invoke(() => _settings.Filters.Clear()); + limits += "--exclude=refs/stash --all"; }