feat(git): case-insensitive status lookup on ignorecase repos

This commit is contained in:
2026-05-19 10:31:41 +02:00
parent 50db85ea5f
commit 085216a406
3 changed files with 63 additions and 1 deletions
+28
View File
@@ -173,6 +173,34 @@ t.test("_invalidate clears refs/head/resolve for refs/heads/*", function()
t.truthy(r._cache.stash_refs)
end)
t.test("_invalidate clears config on .git/config change", function()
local dir = h.make_repo({ a = "x" })
local r = assert(require("git.core.repo").resolve(dir))
r._cache.config = { core = {} }
r:_invalidate("config")
t.eq(r._cache.config, nil)
end)
t.test("status_entry_for: exact match on case-sensitive repo", function()
local dir = h.make_repo({ Foo = "x" })
t.write(dir, "Foo", "modified")
local r = assert(require("git.core.repo").resolve(dir))
wait_initial(r)
t.truthy(r:status_entry_for("Foo"))
t.eq(r:status_entry_for("foo"), nil, "case mismatch returns nil")
end)
t.test("status_entry_for: case-insensitive fallback when core.ignorecase=true", function()
local dir = h.make_repo({ Foo = "x" })
h.git(dir, "config", "core.ignorecase", "true")
t.write(dir, "Foo", "modified")
local r = assert(require("git.core.repo").resolve(dir))
wait_initial(r)
t.truthy(r:status_entry_for("Foo"), "exact match")
t.truthy(r:status_entry_for("foo"), "lowercase finds Foo")
t.truthy(r:status_entry_for("FOO"), "uppercase finds Foo")
end)
t.test("_invalidate matches stash_refs on refs/stash and logs/refs/stash", function()
local dir = h.make_repo({ a = "x" })
local r = assert(require("git.core.repo").resolve(dir))