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
+34
View File
@@ -108,6 +108,9 @@ local INVALIDATION_RULES = {
stash_refs = function(relpath)
return relpath == "refs/stash" or relpath == "logs/refs/stash"
end,
config = function(relpath)
return relpath == "config"
end,
}
---@param relpath string
@@ -599,6 +602,37 @@ function Repo:resolve_sha(abbrev)
return result[1], result[2]
end
---@private
---@return table<string, table<string, string>>
function Repo:_config()
return self:get_cached("config", function(self)
return read_git_config(vim.fs.joinpath(self.gitdir, "config")) or {}
end)
end
---@private
---@return boolean
function Repo:_ignorecase()
local cfg = self:_config()
return cfg.core and cfg.core.ignorecase == "true" or false
end
---@param rel string
---@return ow.Git.Status.Entry?
function Repo:status_entry_for(rel)
local direct = self.status.entries[rel]
if direct or not self:_ignorecase() then
return direct
end
local lower = rel:lower()
for path, entry in pairs(self.status.entries) do
if path:lower() == lower then
return entry
end
end
return nil
end
---@type table<string, true>
local no_repo_dirs = {}