From 8a472cb4724684ce8b1f9fce2051ecb9805b44c7 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 15 Jan 2025 10:42:35 +0800 Subject: [PATCH] fix: sometimes tags did not update after deleting selected tag (#908) --- src/Models/Watcher.cs | 5 +++++ src/ViewModels/DeleteTag.cs | 6 +++++- src/ViewModels/Repository.cs | 13 +++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Models/Watcher.cs b/src/Models/Watcher.cs index c63f0e55..7a6c5163 100644 --- a/src/Models/Watcher.cs +++ b/src/Models/Watcher.cs @@ -72,6 +72,11 @@ namespace SourceGit.Models _updateBranch = DateTime.Now.ToFileTime() - 1; } + public void MarkTagDirtyManually() + { + _updateTags = DateTime.Now.ToFileTime() - 1; + } + public void MarkWorkingCopyDirtyManually() { _updateWC = DateTime.Now.ToFileTime() - 1; diff --git a/src/ViewModels/DeleteTag.cs b/src/ViewModels/DeleteTag.cs index 7d631a38..7b53e798 100644 --- a/src/ViewModels/DeleteTag.cs +++ b/src/ViewModels/DeleteTag.cs @@ -33,7 +33,11 @@ namespace SourceGit.ViewModels { var remotes = ShouldPushToRemote ? _repo.Remotes : null; var succ = Commands.Tag.Delete(_repo.FullPath, Target.Name, remotes); - CallUIThread(() => _repo.SetWatcherEnabled(true)); + CallUIThread(() => + { + _repo.MarkTagsDirtyManually(); + _repo.SetWatcherEnabled(true); + }); return succ; }); } diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 28f32da5..7f619f1e 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -771,6 +771,19 @@ namespace SourceGit.ViewModels } } + public void MarkTagsDirtyManually() + { + if (_watcher == null) + { + Task.Run(RefreshTags); + Task.Run(RefreshCommits); + } + else + { + _watcher.MarkTagDirtyManually(); + } + } + public void MarkWorkingCopyDirtyManually() { if (_watcher == null)