Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option for persistent recent section #1688

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ neogit.setup {
recent = {
folded = true,
hidden = false,
always = false,
},
rebase = {
folded = true,
Expand Down
1 change: 1 addition & 0 deletions doc/neogit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ to Neovim users.
recent = {
folded = true,
hidden = false,
always = false,
},
rebase = {
folded = true,
Expand Down
4 changes: 3 additions & 1 deletion lua/neogit/buffers/status/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lua/neogit/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ function M.get_default_values()
recent = {
folded = true,
hidden = false,
always = false,
},
rebase = {
folded = true,
Expand Down
10 changes: 10 additions & 0 deletions tests/specs/neogit/config_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the additional test for the hidden. I'm unsure why this results to true, even the the default config is false

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)
Expand Down