fix<Filters>: remove from filters after a branch or tag deleted

This commit is contained in:
leo 2021-08-28 20:56:50 +08:00
parent 16b324424c
commit 36b5c7b809
2 changed files with 15 additions and 0 deletions

View file

@ -29,6 +29,11 @@ namespace SourceGit.Commands {
Args = $"tag --delete {name}";
if (!Exec()) return false;
var repo = Models.Preference.Instance.FindRepository(Cwd);
if (repo != null && repo.Filters.Contains(name)) {
repo.Filters.Remove(name);
}
if (push) {
var remotes = new Remotes(Cwd).Result();
foreach (var r in remotes) {

View file

@ -27,11 +27,21 @@ namespace SourceGit.Views.Popups {
public override Task<bool> Start() {
return Task.Run(() => {
Models.Watcher.SetEnabled(repo, false);
var full = branch;
if (string.IsNullOrEmpty(remote)) {
full = $"refs/heads/{branch}";
new Commands.Branch(repo, branch).Delete();
} else {
full = $"refs/remotes/{remote}/{branch}";
new Commands.Push(repo, remote, branch).Exec();
}
var exists = Models.Preference.Instance.FindRepository(repo);
if (exists != null && exists.Filters.Contains(full)) {
exists.Filters.Remove(full);
}
Models.Watcher.SetEnabled(repo, true);
return true;
});