refactor(git/status): rework entries into typed variants on porcelain v2
This commit is contained in:
+9
-10
@@ -651,17 +651,16 @@ end
|
||||
---@return string[]
|
||||
local function complete_unstaged_paths(r, lead)
|
||||
local matches = {}
|
||||
for path, entry_list in pairs(r.status.entries) do
|
||||
for path, entry in pairs(r.status.entries) do
|
||||
if path:sub(1, #lead) == lead then
|
||||
for _, e in ipairs(entry_list) do
|
||||
if
|
||||
e.kind == "unstaged"
|
||||
or e.kind == "untracked"
|
||||
or e.kind == "unmerged"
|
||||
then
|
||||
table.insert(matches, path)
|
||||
break
|
||||
end
|
||||
local include = entry.kind == "untracked"
|
||||
or entry.kind == "unmerged"
|
||||
if not include and entry.kind == "changed" then
|
||||
---@cast entry ow.Git.Status.ChangedEntry
|
||||
include = entry.unstaged ~= nil
|
||||
end
|
||||
if include then
|
||||
table.insert(matches, path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user