Skip to content

Commit

Permalink
WIP flog graph
Browse files Browse the repository at this point in the history
  • Loading branch information
CKolkey committed Nov 8, 2023
1 parent 08073c0 commit 100aded
Show file tree
Hide file tree
Showing 5 changed files with 539 additions and 5 deletions.
1 change: 1 addition & 0 deletions lua/neogit/lib/ansi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function M.parse(str, opts)
local out = {}
for g in parsed:gmatch(".") do
if g == mark then
assert(not vim.tbl_isempty(colored), "ANSI Parser didn't construct all graph parts: " .. str)
table.insert(out, table.remove(colored, 1))
else
table.insert(out, { text = g, color = "Gray", oid = oid })
Expand Down
15 changes: 12 additions & 3 deletions lua/neogit/lib/git/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ end
--- @return table, string|nil
local function determine_order(options, graph)
if
(graph or {})[1]
graph
and not vim.tbl_contains(options, "--date-order")
and not vim.tbl_contains(options, "--author-date-order")
and not vim.tbl_contains(options, "--topo-order")
Expand Down Expand Up @@ -332,7 +332,7 @@ local function format(show_signature)
local signature_format = {
[["signer":"%GS"]],
[["signer_key":"%GK"]],
[["verification_flag":"%G?"]]
[["verification_flag":"%G?"]],
}

table.insert(template, table.concat(signature_format, ","))
Expand Down Expand Up @@ -395,7 +395,16 @@ function M.list(options, graph, files)
.call()
:trim().stdout

return parse_log(parse_json(output), graph or {})
local commits = parse_json(output)

local graph_output
if graph then
graph_output = require("neogit.lib.graph").build(commits)
else
graph_output = {}
end

return parse_log(commits, graph_output)
end

---Determines if commit a is an ancestor of commit b
Expand Down
Loading

0 comments on commit 100aded

Please sign in to comment.