fix<Dashboard>: update filters for commits when branch changed or tag deleted

This commit is contained in:
leo 2020-09-29 10:53:49 +08:00
parent 5f34f968d7
commit 382ea6b89a
2 changed files with 13 additions and 2 deletions

View file

@ -390,7 +390,17 @@ namespace SourceGit.Git {
if (nextUpdateTree > 0 && now >= nextUpdateTree) {
nextUpdateTree = 0;
Branches(true);
var branches = Branches(true);
var badFilters = new List<string>();
foreach (var filter in LogFilters) {
if (filter.StartsWith("refs/heads/") || filter.StartsWith("refs/remotes/")) {
var idx = branches.FindIndex(b => b.FullName == filter);
if (idx < 0) badFilters.Add(filter);
}
}
foreach (var bad in badFilters) LogFilters.Remove(bad);
OnBranchChanged?.Invoke();
OnCommitsChanged?.Invoke();
}

View file

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
@ -101,6 +101,7 @@ namespace SourceGit.Git {
}
}
repo.LogFilters.Remove(name);
repo.OnCommitsChanged?.Invoke();
}