refactor(git): move the zero-sha check into core/util

This commit is contained in:
2026-05-22 16:38:49 +02:00
parent a401e0a12b
commit a786d8458d
2 changed files with 7 additions and 7 deletions
+6
View File
@@ -26,6 +26,12 @@ function M.is_uri(name)
return name:match("^%a+://") ~= nil return name:match("^%a+://") ~= nil
end end
---@param sha string?
---@return boolean
function M.is_zero_sha(sha)
return sha == nil or sha:match("^0+$") ~= nil
end
---@param buf integer ---@param buf integer
---@param name string ---@param name string
function M.set_buf_name(buf, name) function M.set_buf_name(buf, name)
+1 -7
View File
@@ -65,12 +65,6 @@ local function diff_section()
} }
end end
---@param sha string?
---@return boolean
local function is_zero(sha)
return sha == nil or sha:match("^0+$") ~= nil
end
---@param rev ow.Git.Revision ---@param rev ow.Git.Revision
---@return boolean ---@return boolean
local function is_immutable_rev(rev) local function is_immutable_rev(rev)
@@ -291,7 +285,7 @@ end
---@param path string ---@param path string
---@return integer? ---@return integer?
local function side_buf(r, blob, path) local function side_buf(r, blob, path)
if not blob or is_zero(blob) then if not blob or util.is_zero_sha(blob) then
return nil return nil
end end
local full, status = r:resolve_sha(blob) local full, status = r:resolve_sha(blob)