-
Notifications
You must be signed in to change notification settings - Fork 142
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
Feature: add forgit show command #417
Conversation
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.
LGTM.
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.
Looking forward to see this feature merged, I definitely need this 😃
In addition to things I've pointed out in the code, there are two things I've noticed:
- The show command has not been added to conf.d/forgit.plugin.fish and as a result does not work in fish. Might the issue you were having with fish completions be related to this?
- Completions for zsh are missing. If I remember correctly, you're not a zsh user @carlfriedrich, so if you don't want to go through the hassle of setting up zsh on your system I'd offer to implement a zsh completion and add it to this PR. Just let me know.
01deb9a
to
d7dddb4
Compare
Thanks for your reviews everyone, especially for the good finds @sandr01d.
I am sorry, I simply forgot this. Updated it in the new commit version. However, I did not test the fish completions, I just did not add anything in the fish completions file. I was looking for something to copy from
Good point, I added them in the new commit version, but haven't tested them. Can you give them a quick test?
@cjappl Yep, thanks a lot, I will do so. |
Thanks for the updates @carlfriedrich. Fish is working now (except completions, but we can handle this in #418, so no objections from my side). Zsh completions are working fine too.
While this probably is an edge case, we should be able to filter out the additional information quite easily. |
d7dddb4
to
a95e8b2
Compare
@sandr01d Good catch, thank you! I updated the call producing the file list to use the commit object instead of the tag. I kept the original call for the preview and enter commands, though. IMO if you call |
a95e8b2
to
580c5cb
Compare
Use the new command in git log enter. This fixes the display of diffs for merge commits. Fixes wfxr#416.
Thinking more about this I am asking myself whether people might be interested in the commit message as well when calling |
Yes, absolutely. Having the tag information displayed is a big plus IMO.
I think this is a great idea! Wasn't aware of the |
@sandr01d So I gave it a shot and added a keybinding to toggle between the commit message and the commit diff. Works pretty well IMO and I already see myself using it a lot. I also added a border to the preview window indicating what is currently shown. And furthermore I added a border displaying the keybindings. I think maybe the latter might trigger a more general discussion (as I already suggested someting similar in #259) and maybe we might split that part out to a new MR. I did not yet check the fzf version, yet (we need at least 0.49.0 now). I wanted to discuss how we continue on this, first. Maybe we should merge the show feature as it was before the new commit (because it already worked before) and add everything else in one or more follow-ups. Let me know what you think and how you like the proposal. |
82261b7
to
58cb18a
Compare
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.
I find this super useful, well done @carlfriedrich! See my comments below regarding implementation details.
I think moving the second commit to a new PR would probably be best. E.g., I'm not a big fan of the bottom border and would prefer to have the keybindings displayed without it - but don't know if fzf supports this. With a new PR, we could also implement showing the existing keybindings of other functions (editing files with diff and add).
58cb18a
to
647b218
Compare
@sandr01d Thanks a lot for your new review. Really helpful! I updated the second commit according to your comments and removed the keybinding help text. Will file a new PR for that eventually. I also changed the keybinding from |
Yeah, makes sense to keep the keybinding consistent with what we already have. Once the opened thread above is resolved the only thing missing would be checking for the fzf version, so we don't break the function for users of older fzf versions. |
647b218
to
39ee4fe
Compare
Alt-T can now be used to toggle between showing the diff and the commit message in the fzf preview window. This requires fzf >= 0.49.0.
@sandr01d Thanks again. Please check if the quotes are fine for your and resolve the thread in case. Concerning the fzf version check: do you have an opinion what we do when the version is below 0.49.0? Should we exit forgit with an error immediately or should we just disable the features we cannot use with older versions? |
This is a tough one. I agree that introducing version checks for specific features of fzf would make maintenance difficult if we decide to implement similar features like the one in question for other functions (which is something I'd like to see). My concern is that there might be some users in restricted environments that are not able to install a different version of fzf than their distributions package manager provides. We had a similar case with #328. I wonder how many users would be negatively affected by such a change. Maybe it would be worth to open a discussion and start a poll on which distributions/versions people use? Not sure whether we'd see many responses, but might be worth a try. |
Sorry for the delay! Thanks for pinging :)
Generally in agreement with everything said here. I think we should do a (possibly major) version bump of forgit, and take in the new fzf.
This is my preference. I am against bloating the code with fzf version check
This is the key I think. This is why we version our code, so people can fall back to an older one. Do we have to do a major version number bump as this is a backwards incompatible change? (That would be my first thought) I think one of the possible good things here is that forgit is not really used as a CI/CD tool, but on devs machines directly where they have more control. I think this probably means we can be more aggressive moving forward than something crucial to many people's build pipelines. If we get many many reports we can always roll back and remove the feature, and I will eat my words :) |
@sandr01d @cjappl Thanks for your opinions!
I don't see that, actually. Linux is flexible and
This was actually about
Since we don't use semantic versioning, there is no such thing as major versions in If that's fine with you then, I would implement the hard version check. |
Hey @carlfriedrich, sorry for the delay.
Yes, please go ahead. |
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.
LGTM - good work
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.
Just one minor thing
I prepared restricting fzf to version >= 0.49.0 for the AUR packages. @cjappl can you handle brew? |
We have a requirement for the fzf version now. The minimum required fzf version is currently 0.49.0. If the installed version is lower, forgit will exit with an error message.
392f0f3
to
a5c0ad8
Compare
Yes, but I'm traveling until 1/29. I can handle it then, or someone else can dive in if they want to before then! I'll set a reminder for myself, just ping me if anyone gets there first. |
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.
All set from my side, thanks for all the work @carlfriedrich!
This is prepared for a PR and ready to go. When this review is submitted I will put it up for review in the homebrew repo. They are usually very prompt in approving and merging |
Put up for review here for brew: |
Use the new command in git log enter. This fixes the display of diffs for merge commits.
Fixes #416.
Check list
Description
Type of change
Test environment