refactor(git): minor structural cleanups
This commit is contained in:
+19
-21
@@ -18,8 +18,8 @@ local SIDEBAR_WIDTH = 50
|
||||
---@field section string
|
||||
---@field path string
|
||||
---@field orig string?
|
||||
---@field x string?
|
||||
---@field y string?
|
||||
---@field x string porcelain v1 column 1 (always set; may be a literal space)
|
||||
---@field y string porcelain v1 column 2 (always set; may be a literal space)
|
||||
|
||||
---@class ow.Git.CommitEntry
|
||||
---@field section string
|
||||
@@ -61,11 +61,11 @@ local function entry_code(entry)
|
||||
if entry.section == "Untracked" then
|
||||
return "??"
|
||||
elseif entry.section == "Unmerged" then
|
||||
return (entry.x or " ") .. (entry.y or " ")
|
||||
return entry.x .. entry.y
|
||||
elseif entry.section == "Staged" then
|
||||
return (entry.x or " ") .. " "
|
||||
return entry.x .. " "
|
||||
elseif entry.section == "Unstaged" then
|
||||
return " " .. (entry.y or " ")
|
||||
return " " .. entry.y
|
||||
end
|
||||
end
|
||||
|
||||
@@ -174,24 +174,22 @@ local function fetch_status(worktree, callback)
|
||||
table.insert(groups.Unmerged, entry)
|
||||
else
|
||||
if x ~= " " then
|
||||
table.insert(
|
||||
groups.Staged,
|
||||
vim.tbl_extend(
|
||||
"force",
|
||||
entry,
|
||||
{ section = "Staged" }
|
||||
)
|
||||
)
|
||||
table.insert(groups.Staged, {
|
||||
section = "Staged",
|
||||
path = entry.path,
|
||||
orig = entry.orig,
|
||||
x = entry.x,
|
||||
y = entry.y,
|
||||
})
|
||||
end
|
||||
if y ~= " " then
|
||||
table.insert(
|
||||
groups.Unstaged,
|
||||
vim.tbl_extend(
|
||||
"force",
|
||||
entry,
|
||||
{ section = "Unstaged" }
|
||||
)
|
||||
)
|
||||
table.insert(groups.Unstaged, {
|
||||
section = "Unstaged",
|
||||
path = entry.path,
|
||||
orig = entry.orig,
|
||||
x = entry.x,
|
||||
y = entry.y,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user