From ec82e7c1e7be4607b129b6e7c43842f7b7d73a3d Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 11 Jul 2025 16:35:29 +0200 Subject: [PATCH] Make stash filtering work when filtering on a folder --- pkg/commands/git_commands/stash_loader.go | 2 +- pkg/integration/tests/stash/filter_by_path.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/commands/git_commands/stash_loader.go b/pkg/commands/git_commands/stash_loader.go index 243be807d..67c3fb317 100644 --- a/pkg/commands/git_commands/stash_loader.go +++ b/pkg/commands/git_commands/stash_loader.go @@ -56,7 +56,7 @@ outer: currentStashEntry = stashEntryFromLine(match[2], idx) for i+1 < len(lines) && !isAStash(lines[i+1]) { i++ - if lines[i] == filterPath { + if strings.HasPrefix(lines[i], filterPath) { stashEntries = append(stashEntries, currentStashEntry) continue outer } diff --git a/pkg/integration/tests/stash/filter_by_path.go b/pkg/integration/tests/stash/filter_by_path.go index 7881e9225..ea397d70e 100644 --- a/pkg/integration/tests/stash/filter_by_path.go +++ b/pkg/integration/tests/stash/filter_by_path.go @@ -53,11 +53,8 @@ var FilterByPath = NewIntegrationTest(NewIntegrationTestArgs{ filterBy("subdir") t.Views().Stash(). - /* EXPECTED: Lines( Contains("subdir/file2"), ) - ACTUAL: */ - IsEmpty() }, })