Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lua/neogit/lib/git/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local git = require("neogit.lib.git")
local util = require("neogit.lib.util")
local config = require("neogit.config")
local record = require("neogit.lib.record")
local state = require("neogit.lib.state")

---@class NeogitGitLog
local M = {}
Expand Down Expand Up @@ -420,13 +421,17 @@ function M.parent(commit)
end

function M.register(meta)
meta.update_recent = function(state)
state.recent = { items = {} }
meta.update_recent = function(repo_state)
repo_state.recent = { items = {} }

local count = config.values.status.recent_commit_count
local order = state.get({ "NeogitMarginPopup", "-order" }, "topo")

if count > 0 then
state.recent.items =
util.filter_map(M.list({ "--max-count=" .. tostring(count) }, nil, {}, true), M.present_commit)
repo_state.recent.items = util.filter_map(
M.list({ "--max-count=" .. tostring(count), "--" .. order .. "-order" }, {}, {}, true),
M.present_commit
)
end
end
end
Expand Down
23 changes: 14 additions & 9 deletions lua/neogit/popups/margin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@ function M.create(env)
.builder()
:name("NeogitMarginPopup")
-- :option("n", "max-count", "256", "Limit number of commits", { default = "256", key_prefix = "-" })
-- :switch("o", "topo", "Order commits by", {
-- cli_suffix = "-order",
-- options = {
-- { display = "", value = "" },
-- { display = "topo", value = "topo" },
-- { display = "author-date", value = "author-date" },
-- { display = "date", value = "date" },
-- },
-- })
:switch(
"o",
"topo",
"Order commits by",
{
cli_suffix = "-order",
options = {
{ display = "", value = "" },
{ display = "topo", value = "topo" },
{ display = "author-date", value = "author-date" },
{ display = "date", value = "date" },
},
}
)
-- :switch("g", "graph", "Show graph", {
-- enabled = true,
-- internal = true,
Expand Down
2 changes: 1 addition & 1 deletion spec/popups/margin_popup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[
" Arguments ",
# " -n Limit number of commits (--max-count=256) ",
# " -o Order commits by (--[topo|author-date|date]-order) ",
" -o Order commits by (--[topo|author-date|date]-order) ",
# " -g Show graph (--graph) ",
# " -c Show graph in color (--color) ",
" -d Show refnames (--decorate) ",
Expand Down
Loading