From 65e820e4d58c4bd926dc67dbee58823e9874cd7b Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 6 Jan 2025 10:41:41 +0800 Subject: [PATCH] fix: new created branch expanded state is not remembered --- src/ViewModels/CreateBranch.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ViewModels/CreateBranch.cs b/src/ViewModels/CreateBranch.cs index 3560ea8d..7bd8913d 100644 --- a/src/ViewModels/CreateBranch.cs +++ b/src/ViewModels/CreateBranch.cs @@ -126,13 +126,18 @@ namespace SourceGit.ViewModels CallUIThread(() => { - if (succ && CheckoutAfterCreated && _repo.HistoriesFilterMode == Models.FilterMode.Included) + if (succ && CheckoutAfterCreated) { var fake = new Models.Branch() { IsLocal = true, FullName = $"refs/heads/{_name}" }; if (BasedOn is Models.Branch based && !based.IsLocal) fake.Upstream = based.FullName; - _repo.SetBranchFilterMode(fake, Models.FilterMode.Included, true, false); + var folderEndIdx = fake.FullName.LastIndexOf('/'); + if (folderEndIdx > 10) + _repo.Settings.ExpandedBranchNodesInSideBar.Add(fake.FullName.Substring(0, folderEndIdx)); + + if (_repo.HistoriesFilterMode == Models.FilterMode.Included) + _repo.SetBranchFilterMode(fake, Models.FilterMode.Included, true, false); } _repo.MarkBranchesDirtyManually();