-
Notifications
You must be signed in to change notification settings - Fork 154
glo:: use forgit::diff when entering a commit #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
glo:: use forgit::diff when entering a commit #219
Conversation
|
Looks reasonable enough to me! Thanks for the help, leaving to wfxr to approve officially |
ee72cef to
52ab616
Compare
cjappl
left a comment
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.
Looks good to me. Please don't merge until @wfxr gives his thumbs up
52ab616 to
2675443
Compare
|
@wfxr Thanks for your feedback. I did not verify my changes in zsh in the first place, so I'm sorry that it didn't work. After some checking it turns out that my (rather unrelated) quotation changes from I updated my branch with the quotation changes reverted. Should work in zsh now. |
29e32ab to
119aff1
Compare
|
I just updated my branch again to synchronize the quotation changes to the fish version. Should be ready to go now. |
|
@carlfriedrich Now the preview window works but when I hit |
|
@wfxr Ah, I see. Obviously it tries to use bash for the function call to |
@carlfriedrich |
|
@carlfriedrich Maybe you should capture the printed commit hash from |
|
@wfxr Well, that's exactly what I'm doing. Strange. Can't reproduce this here. Can you try with a clean shell environment? Does it happen there as well? |
@carlfriedrich Still the same.
I meant: BTW remove |
|
@carlfriedrich Would you mind if I add a commit to this pr? |
|
@wfxr Give me a few minutes, I am fixing it right now. Your proposal above would not be the same, because the log routine would quit after exiting from the first diff. |
7c00af9 to
3ff1bb8
Compare
|
@wfxr Sorry, took a bit longer that I thought. Had to double-check my test environment (turned out that it still wasn't working correctly) and had a business call in between. However, now I am confident that it works in all three shells, at least on my machine. :-) Can you check again? |
|
@carlfriedrich Still crashes: I'm using zsh-defer to load most of the plugins including |
|
@wfxr Ah, I wasn't aware of zsh-defer until now. Yes, in this case forgit is obviously not loaded yet when Different to bash, unfortunately zsh does not support function exporting, so there's no way to pass the functions of the current environment to a new subshell. Starting an interactive shell explicitly, which loads Is there a way to either
|
f569dd6 to
cdad8b3
Compare
|
@wfxr Even though I do not find it ideal, I have added a wait loop if the forgit functions are not found immediately. Can you check this? Better and cleaner way to do this would be transferring all the forgit functions to an actual executable script, so that they do not have to be loaded to the environment in the first place, but are available via the |
54f049c to
92a4b84
Compare
|
@wfxr I found a better solution: instead of a waiting loop, do not rely on forgit being loaded via |
92a4b84 to
aa8110e
Compare
|
@wfxr Sorry for spam. :-) I just re-added the |
|
Hi @carlfriedrich Thanks for your effort for this PR. Now I can jump into the forgit_log_pr_219.mp4However there still some issues.
IMO entering a interactive shell in a fzf keybinding is too tricky which will cause some unexpected behaviors we don't known even if the above problems were solved. The other thing I concern is there are a log of guys who use oh-my-zsh or enabled many plugins take quite a few seconds to load the shell. This change will result in So I tend to keep it simple and stupid. |
|
@wfxr Thanks a lot for your detailed feedback. Really appreciate your responsiveness and will to check my changes.
Yeah, finally! :-)
Okay, I have no idea where that comes from. :-/
That was a deliberate change. I like the preview short and overview-like, then being able to enter the change to see the detailed diff. I understand, however, that this is personal preference and doesn't meet everyone's taste.
I have no idea about that either, and cannot reproduce it unfortunately.
I see your point here. Obviously your zsh setup is already so much different from my test environment that it causes issues with this change, so there will probably be more issues with other setups. I just wanted to bring something upstream that I am using in bash for quite a few months now, so that other people can benefit from it. However, I didn't expect it to be incompatible with zsh. Too bad. :-/ One last option would be to make this feature bash-only, but I assume that you would like to keep the features for all shells on par? And one last general question for the bigger picture: I am not familiar with the zsh / oh-my-zsh plugin system. Is there a way to have a plugin that adds its folder to the PATH, so that we could have forgit in form of an executable script instead of env functions? Would that be an option? Because IMO we could use forgit feature chaining in more scenarios than just with |
aa8110e to
042a7df
Compare
|
So here's another shot for integrating I do not find it ideal, though. After quitting the diff, a new fzf instance is started, so the previous selection is gone. This makes it hard to browse through subsequent commit diffs. Unfortunately fzf does not provide a way to pre-select a line. @wfxr @cjappl What do you think? On one hand I think this is an improvement concerning usability, because forgit's diff function provides a better (and more consistent) user experience than a plain |
|
@carlfriedrich I tested this implementation. As you said, both improvements and flaws are significant. How about making it an optional feature to satisfy users who like this feature more without affecting others? |
042a7df to
a6df812
Compare
a6df812 to
a5d75fc
Compare
When using glo (forgit log) we can press Enter to show the changeset of the selected commit. The presentation, however, was rendered using the basic git diff command. We have a much more user friendly diff command gd (forgit diff) right in forgit, though. Use this instead.
a5d75fc to
15142af
Compare
|
For what it's worth, this messes with the ability to view larger commit messages in |
|
@nathanchance I'm sorry that this disrupts your workflow. You can bring back the old behaviour by defining a custom enter command and adding it to your export FORGIT_LOG_ENTER_CMD="echo {} | grep -Eo '[a-f0-9]+' | head -1 | tr -d '[:space:]' | xargs -I% git show --color=always % | LESS='-Rc' less"
export FORGIT_LOG_FZF_OPTS="--bind='enter:execute($FORGIT_LOG_ENTER_CMD)'"But may I ask why the new behavior actually prevents you from viewing the commit message? Don't you have it displayed in your preview window? Would one of these two options work for you? |
No worries!
Aha, I did not know about being able to scroll the preview window! That will work just fine for this, thanks a lot for pointing it out! |
|
@nathanchance Great, thanks for your feedback! |







When using
glo(forgit::log) we can pressEnterto show the changeset of the selected commit. The presentation, however, is rendered using the basicgit diffcommand. We have a much more user friendly diff commandgd(forgit::diff) right in forgit, though. Use this instead.Fixes #217.
Check list
Description
Type of change
Test environment