diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-01-02 10:34:19 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-01-02 10:34:19 +0900 |
| commit | 67ba5426d8d74e35c948108acc54946a1908406d (patch) | |
| tree | 84d5321d012080c8ed99c9f289997bf918cebbde /mac | |
| parent | daa5c24fceec0a20f83185b9049517b0410904b7 (diff) | |
Diffstat (limited to 'mac')
| -rw-r--r-- | mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua index be4daa4..a9e39c2 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua @@ -927,18 +927,18 @@ return { ---@param buf_id integer ---@return nil local function updateGitStatus(buf_id) - local cwd = vim.uv.cwd() - if not cwd or not vim.fs.root(cwd, ".git") then + local git_root = vim.fs.root(buf_id, ".git") + if not git_root then return end local currentTime = os.time() - if gitStatusCache[cwd] and currentTime - gitStatusCache[cwd].time < cacheTimeout then - updateMiniWithGit(buf_id, gitStatusCache[cwd].statusMap) + if gitStatusCache[git_root] and currentTime - gitStatusCache[git_root].time < cacheTimeout then + updateMiniWithGit(buf_id, gitStatusCache[git_root].statusMap) else - fetchGitStatus(cwd, function(content) + fetchGitStatus(git_root, function(content) local gitStatusMap = parseGitStatus(content) - gitStatusCache[cwd] = { + gitStatusCache[git_root] = { time = currentTime, statusMap = gitStatusMap, } @@ -979,9 +979,9 @@ return { pattern = "MiniFilesBufferUpdate", callback = function(sii) local bufnr = sii.data.buf_id - local cwd = vim.fn.expand("%:p:h") - if gitStatusCache[cwd] then - updateMiniWithGit(bufnr, gitStatusCache[cwd].statusMap) + local git_root = vim.fs.root(bufnr, ".git") + if git_root and gitStatusCache[git_root] then + updateMiniWithGit(bufnr, gitStatusCache[git_root].statusMap) end end, }) |
