NeogitOrg / neogit

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

Add support to goto hunk locations from commit view #1239

Open printfdebugging opened 7 months ago

printfdebugging commented 7 months ago

Is your feature request related to a problem? Please describe. I contribute to libreoffice quite often, and therefore have to commit my changes and push them as patches. Now when I want to go back to some hunk in the commit, and modify it, I cannot do it from the commit view.

Describe the solution you'd like I would like the commit view to behave like the views for unstaged and untracked changes, where pressing enter takes me to the change

printfdebugging commented 7 months ago

and I would like to work on this one :)

printfdebugging commented 7 months ago

/assign

printfdebugging commented 7 months ago

We don't have a bot here I guess.

CKolkey commented 7 months ago

Beep boop... er, no, no bot, haha. But happy to help however I can :)

I -highly- suggest you base on the nightly branch, if you haven't already done so. It still works with nvim 0.9, but has a bunch of new stuff for 0.10

printfdebugging commented 7 months ago

@CKolkey Yes, thanks for reminding, I was using neovim from package manager :). This is the right time to have a local copy of my own.

printfdebugging commented 7 months ago

I will take some time(3-4 days min). This is a really cool plugin, and I don't want to just copy and paste all the functions from status/to commit_view/, and call it a day. Plan is to read it through, and learn how it does what it does in depth(would be more than a crash course to neovim lua plugin developement). Then I will refactor the common functions, and send it for review.

CKolkey commented 7 months ago

No rush - one thing I'm wondering: when you goto the hunk/file from the commit view, are you imaging it being from HEAD or at the commit you're looking at?

printfdebugging commented 7 months ago

Does it matter? I don't know how we look for the specific hunk location in the files yet, but if it is purely using line number from the diffs, then it should be something like "Take me to this line number of the file, if the file exists, and if this line number is in the bounds". yth line in file x on HEAD

CKolkey commented 7 months ago

Might be cool to have both, actually. Something like <cr> going to the location on current HEAD (as you describe) and <s-cr> checking out the commit first, then opening the file. No worries though, just mess around with it and see what you come up with :)

printfdebugging commented 6 months ago

Hi, I realize that I since I don't have any experience with lua, (Just that I read the PIL book), I am not reaching anywhere. Even if I hunt and gather some lines of code from here and there, that will not help much. I do understand the code though like what's going on in the util.lua, but that's not enough to see the whole picture. (eye opener for me)

I will be back to work on this issue, and the other issues, and if in case someone else wants this very bad, they can take it from here (I don't want to leave it, but sometimes a stepback helps take a big leap). Will write some programs of my own, do some playing around. I hope @CKolkey finds it reasonible. Or you can suggest me some approach.

CKolkey commented 6 months ago

No worries :) This isn't the simplest codebase to jump into - looking forward to see what you come up with

star-szr commented 5 months ago

Doing some light issue triage and just noting that this seems very similar if not identical to #456.