Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Models/RepositoryUIStates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,17 @@ public bool UpdateHistoryFilters(string pattern, FilterType type, FilterMode mod
return true;
}

public bool IsCoveredByFolderFilter(string path, FilterType type)
{
foreach (var filter in HistoryFilters)
{
if (filter.Type == type && path.StartsWith($"{filter.Pattern}/", StringComparison.Ordinal))
return true;
}

return false;
}

public void RemoveHistoryFilter(string pattern, FilterType type)
{
foreach (var filter in HistoryFilters)
Expand Down
6 changes: 4 additions & 2 deletions src/ViewModels/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,8 @@ public void RefreshAfterCreateBranch(Models.Branch created, bool checkout)
if (folderEndIdx > 10)
_uiStates.ExpandedBranchNodesInSideBar.Add(created.FullName.Substring(0, folderEndIdx));

if (_historyFilterMode == Models.FilterMode.Included)
if (_historyFilterMode == Models.FilterMode.Included &&
!_uiStates.IsCoveredByFolderFilter(created.FullName, Models.FilterType.LocalBranchFolder))
SetBranchFilterMode(created, Models.FilterMode.Included, false, false);

CurrentBranch = created;
Expand Down Expand Up @@ -817,7 +818,8 @@ public void RefreshAfterCheckoutBranch(Models.Branch checkouted)

checkouted.IsCurrent = true;
checkouted.WorktreePath = FullPath;
if (_historyFilterMode == Models.FilterMode.Included)
if (_historyFilterMode == Models.FilterMode.Included &&
!_uiStates.IsCoveredByFolderFilter(checkouted.FullName, Models.FilterType.LocalBranchFolder))
SetBranchFilterMode(checkouted, Models.FilterMode.Included, false, false);

List<Models.Branch> locals = [];
Expand Down