-
Notifications
You must be signed in to change notification settings - Fork 219
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
Added support for git stash list
#1280
base: master
Are you sure you want to change the base?
Added support for git stash list
#1280
Conversation
- Linking the components together - Adding options - Building a buffer for viewing stashes.
All the pieces are wired up, all that's left is to implement everything correctly.
`M:open` lets me use `self.foo` inside the function.
Added proper structure for UI elements. But, no output on the newly created tab.
cc36f03
to
4098f2e
Compare
self:close() | ||
end, | ||
["<enter>"] = function() | ||
-- Still looking for how to view a stash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use
neogit/lua/neogit/lib/git/rev_parse.lua
Line 23 in f10084a
function M.oid(rev) |
git rev-parse 'stash@{0}'
) to get the OID from a stash, which can be passed into the buffer constructor.
@@ -219,7 +219,7 @@ M.CommitEntry = Component.new(function(commit, args) | |||
}, graph, { text(" ") }, ref, { text(commit.subject) }), | |||
{ | |||
virtual_text = { | |||
{ " ", "Constant" }, | |||
{ " ", "Constant" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ " ", "Constant" }, | |
{ " ", "Constant" }, |
lua/neogit/lib/git/stash.lua
Outdated
rel_date = cli.log | ||
.max_count(1) | ||
.format("%cr") | ||
.args("stash@{" .. idx .. "}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.args("stash@{" .. idx .. "}") | |
.args(("stash@{%s}"):format(idx)) |
Not a major thing, but in lua strings are interned, so concatenation operations will re-hash the new string, for every ..
operator.
In this case that would be something like:
hash("stash@{")
hash("stash@{1")
hash("stash@{1}")
Many successive re-hashings will have a noticeable performance hit. While it's probable that this list will never be long enough to encounter that, I just prefer to do string formatting or table.concat()
to join strings :)
Nice work! Left some feedback |
`get_commit_under_cursor` to malfunction.
Hey, @CKolkey I fixed all the issues you brought up in the review. I also merged the latest from |
@CKolkey hey there. Would you mind taking a look at the changes? |
It's pretty good - there are still a handful of comments I left that are unresolved though. Take care of those and we'll merge this :) |
Hey - is there any movement on this? @AlphabetsAlphabets if you're no longer working on this feature, you mind if I fork off of you and fix the mentioned comments? |
Hi, feel free to do so. I'm very busy right now. |
Added basic support for
git stash list
. Current functionality in the:Neogit
screen.Z
thenl
will give a list of stashes.ENTER
on any of the stashes will bring up a diff for that stash.