NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
3.64k stars 218 forks source link

Refs view: pass ref details to branch popup actions #1350

Closed actionshrimp closed 1 month ago

actionshrimp commented 1 month ago

Hi! First of all, thanks so much for all your amazing work on neogit. I've been wanting to switch over to neovim for a while, but magit was the one thing that held me back, so when I came across neogit and how much functionality it already has, I was blown away and have been fully able to switch over ❤️!

This PR adds something I did really love from magit - adding a bit of contextual information about the selected ref to the normal-mode branch popup, to save a bit of typing and to allow you to see what you're selecting a bit more easily from the name picker vs just a commit sha. Currently it's passed for:

One thing I noticed while testing is the refs view doesn't seem to refresh on the first reopen, but is refreshed if you close it and re-open it again. However, I thought investigating that might start getting a bit involved for a first PR! Let me know if it makes sense to investigate separately though.

Demo of the behaviour here: https://github.com/NeogitOrg/neogit/assets/286704/33f034b7-2635-42a4-bb86-5a0a891c3289

CKolkey commented 1 month ago

Nice! So glad you find is useful, and really appreciate the kind words.

The refresh thing is because only the status buffer and log buffer have "rerender" logic. I think it would make sense to use the watcher class to trigger the buffer to rerender, depending on how cleanly the state can be passed in :) If that's something you wanna mess with, or if you wanna try to do it another way, be my guest

edit: I made a merge conflict that hit your branch, so I went ahead and fixed it.

actionshrimp commented 1 month ago

Great, thanks. I have rebased and fixed the formatting issue. Thanks for the pointer about the refresh - I will have a look and try to fix in a separate PR!

CKolkey commented 1 month ago

Great contribution - I never used Magit, so these subtle things (that really make it shine) sometimes are overlooked. Really appreciate any suggestions for how to polish this up, if you have any more :)