perf(git): fold revspec validation into the cat-file -p the loader needs anyway
This commit is contained in:
@@ -343,18 +343,4 @@ function M.rev_parse(worktree, ref, short)
|
||||
return trimmed ~= "" and trimmed or nil
|
||||
end
|
||||
|
||||
---Verify a revspec resolves to an existing git object. `cat-file -e` is
|
||||
---git's cheapest existence check, and unlike `rev-parse --verify` it
|
||||
---also accepts the `<commit>:<path>` form that BufReadCmd revspec URIs
|
||||
---use.
|
||||
---@param worktree string
|
||||
---@param revspec string
|
||||
---@return boolean
|
||||
function M.object_exists(worktree, revspec)
|
||||
return util.exec(
|
||||
{ "git", "cat-file", "-e", revspec },
|
||||
{ cwd = worktree, silent = true }
|
||||
) ~= nil
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user