chore: apply formatting

This commit is contained in:
2026-05-26 17:30:18 +02:00
parent 914aa493ff
commit 428ded2c4c
12 changed files with 305 additions and 280 deletions
+2 -6
View File
@@ -169,8 +169,7 @@ local function read_git_config(path)
section = s
out[section] = out[section] or {}
elseif section then
local key, value =
trimmed:match("^(%S+)%s*=%s*(.-)$")
local key, value = trimmed:match("^(%S+)%s*=%s*(.-)$")
if key then
out[section][key] = value
end
@@ -225,10 +224,7 @@ function Repo:_fetch_status()
end
self.status = status.parse(result.stdout or "")
local change = {
paths = status.diff_entries(
prior_entries,
self.status.entries
),
paths = status.diff_entries(prior_entries, self.status.entries),
branch_changed = not vim.deep_equal(
prior_branch,
self.status.branch
+5 -3
View File
@@ -489,8 +489,7 @@ local function recompute(buf)
state.head_sha = sha
end,
function()
local new =
vim.api.nvim_buf_get_lines(buf, 0, -1, false)
local new = vim.api.nvim_buf_get_lines(buf, 0, -1, false)
state.hunks = state.index
and compute_hunks(state.index, new)
or {}
@@ -524,7 +523,10 @@ function M.attach(buf)
if not r then
return
end
local rel = vim.fs.relpath(r.worktree, vim.fn.resolve(vim.api.nvim_buf_get_name(buf)))
local rel = vim.fs.relpath(
r.worktree,
vim.fn.resolve(vim.api.nvim_buf_get_name(buf))
)
if not rel then
return
end
+3 -1
View File
@@ -14,7 +14,9 @@ local function open_under_cursor(buf)
-- Anchor past the leading graph chars (matches the leading sha column,
-- not any hex word that happens to appear later in the subject).
local sha = r
and vim.api.nvim_get_current_line():match("^[*|/\\_ ]*(%x%x%x%x%x%x%x+)")
and vim.api
.nvim_get_current_line()
:match("^[*|/\\_ ]*(%x%x%x%x%x%x%x+)")
if not sha then
return false
end
+2 -7
View File
@@ -38,8 +38,7 @@ end
---@type table<integer, ow.Git.StatusView.State>
local state = {}
local group =
vim.api.nvim_create_augroup("ow.git.status_win", { clear = true })
local group = vim.api.nvim_create_augroup("ow.git.status_win", { clear = true })
local ns = vim.api.nvim_create_namespace("ow.git.status_win")
---@return integer? win
@@ -349,11 +348,7 @@ local function view_row(s, row, focus_left)
local left = older_pane(s, row)
local right = newer_pane(s, row)
if not left and not right then
util.warning(
"no content for %s row: %s",
row.section,
row.entry.path
)
util.warning("no content for %s row: %s", row.section, row.entry.path)
return
end
+2 -8
View File
@@ -20,10 +20,7 @@ local function render(entry)
end
local parts = {}
for _, mark in ipairs(marks) do
table.insert(
parts,
string.format("%%#%s#%s%%*", mark.hl, mark.char)
)
table.insert(parts, string.format("%%#%s#%s%%*", mark.hl, mark.char))
end
return table.concat(parts, " ")
end
@@ -73,10 +70,7 @@ repo.on("change", function(r)
local rel = vim.fs.relpath(r.worktree, vim.fn.resolve(name))
if rel then
set_status(buf, r, rel)
if
not any_visible
and #vim.fn.win_findbuf(buf) > 0
then
if not any_visible and #vim.fn.win_findbuf(buf) > 0 then
any_visible = true
end
end