mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
enhance: update filters after a filtered branch renamed (#536)
This commit is contained in:
parent
4e57cd50cd
commit
6fe7dfad7f
2 changed files with 16 additions and 3 deletions
|
@ -8,7 +8,6 @@ namespace SourceGit.ViewModels
|
||||||
public Models.Branch Target
|
public Models.Branch Target
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Required(ErrorMessage = "Branch name is required!!!")]
|
[Required(ErrorMessage = "Branch name is required!!!")]
|
||||||
|
@ -54,8 +53,19 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
var oldName = Target.FullName;
|
||||||
var succ = Commands.Branch.Rename(_repo.FullPath, Target.Name, _name);
|
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;
|
return succ;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -841,7 +841,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
if (_settings.Filters.Count != validFilters.Count)
|
if (_settings.Filters.Count != validFilters.Count)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Post(() =>
|
Dispatcher.UIThread.Invoke(() =>
|
||||||
{
|
{
|
||||||
_settings.Filters.Clear();
|
_settings.Filters.Clear();
|
||||||
_settings.Filters.AddRange(validFilters);
|
_settings.Filters.AddRange(validFilters);
|
||||||
|
@ -850,6 +850,9 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (_settings.Filters.Count != 0)
|
||||||
|
Dispatcher.UIThread.Invoke(() => _settings.Filters.Clear());
|
||||||
|
|
||||||
limits += "--exclude=refs/stash --all";
|
limits += "--exclude=refs/stash --all";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue