From a57411ab6a6b464a3a89e6acd79840c13f56658a Mon Sep 17 00:00:00 2001 From: twio142 <64556708+twio142@users.noreply.github.com> Date: Sun, 30 Nov 2025 09:01:52 +0100 Subject: [PATCH 1/2] fix(session): handle special characters in search filters The "contains" filter would previously fail when searching for a string containing a hyphen (e.g., "repo-name"). This is fixed by using a literal substring search, ignoring Lua pattern characters. --- lua/git-dev/session.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/git-dev/session.lua b/lua/git-dev/session.lua index 29913d0..e122dc7 100644 --- a/lua/git-dev/session.lua +++ b/lua/git-dev/session.lua @@ -59,7 +59,7 @@ function Session:find(filters) filter.type == "equal" and not vim.deep_equal(repo_ctx[filter.name], filter.value) or filter.type == "contains" - and not repo_ctx[filter.name]:find(filter.value) + and not repo_ctx[filter.name]:find(filter.value, 1, true) then match = false break From 6939ccdc1b1ad09e75ecdaa4e63d317a208aba6d Mon Sep 17 00:00:00 2001 From: twio142 <64556708+twio142@users.noreply.github.com> Date: Sat, 6 Dec 2025 14:23:48 +0100 Subject: [PATCH 2/2] test: add a test case --- tests/session_spec.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/session_spec.lua b/tests/session_spec.lua index 26772c0..2a728e1 100644 --- a/tests/session_spec.lua +++ b/tests/session_spec.lua @@ -16,6 +16,10 @@ local function gen_repos() foo = "gas", foo2 = "gas2", }, + { + foo = "test-hyphen", + foo2 = "test-hyphen2", + }, } for i, repo in ipairs(repos) do repo.repo_dir = i @@ -37,6 +41,7 @@ local filters_to_nr = { }, 1, }, + { { { name = "foo", value = "test-h", type = "contains" } }, 1 }, } local function test_sanity()