From 4d7b16dc758537269ade586760c70e8d68de3249 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 21 Aug 2023 20:04:25 +0800 Subject: [PATCH] fix: fix filter not work when there's no files under .git/refs/xxx/ --- src/Models/Repository.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Models/Repository.cs b/src/Models/Repository.cs index e0be31bf..7774e54d 100644 --- a/src/Models/Repository.cs +++ b/src/Models/Repository.cs @@ -100,10 +100,12 @@ namespace SourceGit.Models { // 未填写参数就检测,去掉无效的过滤 if (Filters.Count > 0) { var invalidFilters = new List(); + var branches = new Commands.Branches(Path).Result(); var tags = new Commands.Tags(Path).Result(); + foreach (var filter in Filters) { if (filter.StartsWith("refs/")) { - if (!ExistsInGitDir(filter)) invalidFilters.Add(filter); + if (branches.FindIndex(b => b.FullName == filter) < 0) invalidFilters.Add(filter); } else { if (tags.FindIndex(t => t.Name == filter) < 0) invalidFilters.Add(filter); }