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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ neogit.setup {
-- Flag description: https://git-scm.com/docs/git-branch#Documentation/git-branch.txt---sortltkeygt
-- Sorting keys: https://git-scm.com/docs/git-for-each-ref#_options
sort_branches = "-committerdate",
-- Value passed to the `--<commit_order>-order` flag of the `git log` command
-- Determines how commits are traversed and displayed in the log / graph:
-- "topo" topological order (parents always before children, good for graphs, slower on large repos)
-- "date" chronological order by commit date
-- "author-date" chronological order by author date
-- "" disable explicit ordering (fastest, recommended for very large repos)
commit_order = "topo"
-- Default for new branch name prompts
initial_branch_name = "",
-- Change the default way of opening neogit
Expand Down
7 changes: 7 additions & 0 deletions doc/neogit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ to Neovim users.
-- Flag description: https://git-scm.com/docs/git-branch#Documentation/git-branch.txt---sortltkeygt
-- Sorting keys: https://git-scm.com/docs/git-for-each-ref#_options
sort_branches = "-committerdate",
-- Value passed to the `--<commit_order>-order` flag of the `git log` command
-- Determines how commits are traversed and displayed in the log / graph:
-- "topo" topological order (parents always before children, good for graphs, slower on large repos)
-- "date" chronological order by commit date
-- "author-date" chronological order by author date
-- "" disable explicit ordering (fastest, recommended for very large repos)
commit_order = "topo"
-- Default for new branch name prompts
initial_branch_name = "",
-- Change the default way of opening neogit
Expand Down
8 changes: 8 additions & 0 deletions lua/neogit/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ end
---| "ascii"
---| "unicode"
---| "kitty"
---
---@alias NeogitCommitOrder
---| ""
---| "topo"
---| "author-date"
---| "date"

---@class NeogitConfigStatusOptions
---@field recent_commit_count? integer The number of recent commits to display
Expand Down Expand Up @@ -346,6 +352,7 @@ end
---@field use_per_project_settings? boolean Scope persisted settings on a per-project basis
---@field remember_settings? boolean Whether neogit should persist flags from popups, e.g. git push flags
---@field sort_branches? string Value used for `--sort` for the `git branch` command
---@field commit_order? NeogitCommitOrder Value used for `--<commit_order>-order` for the `git log` command
---@field initial_branch_name? string Default for new branch name prompts
---@field kind? WindowKind The default type of window neogit should open in
---@field floating? NeogitConfigFloating The floating window style
Expand Down Expand Up @@ -408,6 +415,7 @@ function M.get_default_values()
remember_settings = true,
fetch_after_checkout = false,
sort_branches = "-committerdate",
commit_order = "topo",
kind = "tab",
floating = {
relative = "editor",
Expand Down
14 changes: 9 additions & 5 deletions lua/neogit/lib/git/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,17 @@ function M.register(meta)
repo_state.recent = { items = {} }

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

if count > 0 then
repo_state.recent.items = util.filter_map(
M.list({ "--max-count=" .. tostring(count), "--" .. order .. "-order" }, {}, {}, true),
M.present_commit
)
local args = { "--max-count=" .. tostring(count) }
local graph = nil
if order and order ~= "" then
table.insert(args, "--" .. order .. "-order")
graph = {}
end

repo_state.recent.items = util.filter_map(M.list(args, graph, {}, false), M.present_commit)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lua/neogit/popups/margin/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local popup = require("neogit.lib.popup")
-- local config = require("neogit.config")
local config = require("neogit.config")
local actions = require("neogit.popups.margin.actions")

local M = {}
Expand All @@ -13,7 +13,7 @@ function M.create(env)
-- :option("n", "max-count", "256", "Limit number of commits", { default = "256", key_prefix = "-" })
:switch(
"o",
"topo",
config.values.commit_order,
"Order commits by",
{
cli_suffix = "-order",
Expand Down
Loading