Skip to content

Conversation

laughingman-hass
Copy link

fixes #1687

This PR adds a new option config.sections.recent.always, which defaults to false. This keeps the current behavior which only shows the recent section if there is no unmerged commits. which looks like this

image

Setting this option to true will always show the recent section. which looks like this

image

@laughingman-hass
Copy link
Author

laughingman-hass commented Mar 15, 2025

I didn't find a documentation section, where I could provide additional context for the option or the current behavior. Happy to add this, if you can point me to somewhere.

@SheffeyG
Copy link
Contributor

I also prefer the 'Recent Commits' section for rebasing and other actions, but displaying both the Recent and Unmerged sections simultaneously causes a rendering bug:

image

In the screenshot, both Unpush and Recent sections has commit test, and I choosed the first one in the 'Unpushed' section, but the last one in the 'Recent' section get rendered.

This bug is kind hard to fix, as neogit use oid (commit hash) to identify each commit components, after the components oid indexed, if buffer components oid is not unique, it will always point to the last component. I've tried to fix this, but there's no cursor status stored, so I give up.

A workaround for this is hide the Unmerged section as unmerged_upstream = { hidden = true }, so the Recent Commits section is always shown, and it will correctly rendered.

@laughingman-hass
Copy link
Author

laughingman-hass commented Sep 14, 2025

@SheffeyG thats interesting. I'm currently away and will have a look if there is a nice way to fix this when i'm back. Personally i didn't like the same commit showing up in recent and unmerged, maybe there is a way to just show new commits in unmerged and recent to show previous commits.

@CKolkey
Copy link
Member

CKolkey commented Sep 16, 2025

So... I think I made a pretty core assumption that an object's OID would only be in a given buffer once:

if item.oid then
self.oid_index[item.oid] = item
end

That index is used to apply the "active item" highlight.

local item = buffer.ui:find_component_by_oid(active_oid)

And given that it's a hash-like lua table, last entry for a given OID wins. This is what @SheffeyG was pointing out, and... I don't think there's an easy fix.

@laughingman-hass You could in theory XOR the "unmerged" and "recent" commits, but both are fetched concurrently when we re-sync internal state to repo state, so you'd need to have some kind of callback that operates on both tables after they are updated. Kind of a PITA if you ask me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add an option for persistent recent commits section
3 participants