Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: update branch_cache on get_branch() call
Update branch_cache on get_branch() call rather than on update_branch()
call to properly cache branches for all opened buffers, instead of only
the first buffer.

Fixes #1440
  • Loading branch information
rnxden committed Jul 5, 2025
commit 7c50a54660147c4aa341d9a393e5b634eb20c74a
3 changes: 2 additions & 1 deletion lua/lualine/components/branch/git_branch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ local function update_branch()
-- set to '' when git dir was not found
current_git_branch = ''
end
branch_cache[vim.api.nvim_get_current_buf()] = current_git_branch
end

---updates the current value of current_git_branch and sets up file watch on HEAD file if value changed
Expand Down Expand Up @@ -150,6 +149,8 @@ function M.get_branch(bufnr)
end
if bufnr then
return branch_cache[bufnr] or ''
else
branch_cache[vim.api.nvim_get_current_buf()] = current_git_branch
end
return current_git_branch
end
Expand Down
Loading