From f921afc6563192690e4d314f45cf245277036230 Mon Sep 17 00:00:00 2001 From: Hass Khalid Date: Sat, 15 Mar 2025 14:43:22 +0000 Subject: [PATCH 1/4] config option for always displaying recent section --- lua/neogit/config.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/neogit/config.lua b/lua/neogit/config.lua index 11c3e68a9..4de242ed4 100644 --- a/lua/neogit/config.lua +++ b/lua/neogit/config.lua @@ -516,6 +516,7 @@ function M.get_default_values() recent = { folded = true, hidden = false, + always = false, }, rebase = { folded = true, From 927e7c39dbd155d8f604cd2c2a212c5c2ed2d7ce Mon Sep 17 00:00:00 2001 From: Hass Khalid Date: Sat, 15 Mar 2025 14:44:43 +0000 Subject: [PATCH 2/4] ui logic for recent updated for the always section additionally tidied up on the logic for show_recent --- lua/neogit/buffers/status/ui.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/neogit/buffers/status/ui.lua b/lua/neogit/buffers/status/ui.lua index 1efc135f6..962314642 100755 --- a/lua/neogit/buffers/status/ui.lua +++ b/lua/neogit/buffers/status/ui.lua @@ -517,6 +517,8 @@ function M.Status(state, config) local show_recent = #state.recent.items > 0 and not config.sections.recent.hidden + and (config.sections.recent.always or not show_upstream_unmerged) + return { List { @@ -668,7 +670,7 @@ function M.Status(state, config) folded = config.sections.unmerged_pushRemote.folded, name = "pushRemote_unmerged", }, - not show_upstream_unmerged and show_recent and Section { + show_recent and Section { title = SectionTitle { title = "Recent Commits", highlight = "NeogitRecentcommits" }, count = false, render = SectionItemCommit, From bc14260974098856d8d77bd12941f610332f7eea Mon Sep 17 00:00:00 2001 From: Hass Khalid Date: Sat, 15 Mar 2025 14:47:24 +0000 Subject: [PATCH 3/4] sections.recent.always config documentation --- README.md | 1 + doc/neogit.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 3f09469cb..d52db8cdb 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,7 @@ neogit.setup { recent = { folded = true, hidden = false, + always = false, }, rebase = { folded = true, diff --git a/doc/neogit.txt b/doc/neogit.txt index 35665bfae..54c73f98c 100644 --- a/doc/neogit.txt +++ b/doc/neogit.txt @@ -307,6 +307,7 @@ to Neovim users. recent = { folded = true, hidden = false, + always = false, }, rebase = { folded = true, From 8c449bb29f46a983d6d3742d88ee446ca0754851 Mon Sep 17 00:00:00 2001 From: Hass Khalid Date: Sat, 15 Mar 2025 15:09:28 +0000 Subject: [PATCH 4/4] added tests for additional config --- tests/specs/neogit/config_spec.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/specs/neogit/config_spec.lua b/tests/specs/neogit/config_spec.lua index 0d169c33c..1032f10b2 100644 --- a/tests/specs/neogit/config_spec.lua +++ b/tests/specs/neogit/config_spec.lua @@ -404,6 +404,16 @@ describe("Neogit config", function() assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) end) + it("should return invalid when sections.recent.hidden isn't a boolean", function() + config.values.sections.recent.hidden = "not a boolean" + assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) + end) + + it("should return invalid when sections.recent.always isn't a boolean", function() + config.values.sections.recent.always = "not a boolean" + assert.False(vim.tbl_count(require("neogit.config").validate_config()) ~= 0) + end) + it("should return invalid when sections.recent.folded isn't a boolean", function() config.values.sections.recent.folded = "not a boolean" assert.True(vim.tbl_count(require("neogit.config").validate_config()) ~= 0)