scmbreeze / scm_breeze

Adds numbered shortcuts to the output git status, and much more
https://madebynathan.com/2011/10/19/git-shortcuts-like-youve-never-seen-before/
MIT License
2.82k stars 192 forks source link

Running git funcitons in subshell breaks vared in zsh #321

Open AndreasArledal opened 1 year ago

AndreasArledal commented 1 year ago

136fb6b4ee446fff8bd976768702200460714c96 breaks git_command_prompt in my zsh setup. Seems like vared is not working properly in subshell.

git_commit_prompt:vared:8: ZLE not enabled

saiqulhaq-hh commented 1 year ago

so I have to downgrade? it's not working on my WSL terminal

saiqulhaq-hh commented 1 year ago

image it works after I checkout the previous commit thanks

M-Porter commented 1 year ago

Confirmed rolling back to previous commit of 6c85b866af60887449099895d2aa2d6d45fae246 fixes the issue.

Commit message of 136fb6b4ee446fff8bd976768702200460714c96 states

Define git functions with parentheses instead of curly braces, so that we can press Ctrl+C to quit the commit prompt without terminating the shell session. (Parentheses run the function in a subshell.)

I do not have the issue. I am able to ctrl-c without my current shell session terminating.

Can we get a rollback then a PR with the proposed changes as not to break environments by just pushing to main.

mattflo-outpace commented 1 year ago

Took me a while to find this. I reverted the offending commit locally. This should get fixed. Super annoying.

ghthor commented 1 year ago

I think this is the reason[1] this isn't working after the targeted commit. When these were changed to running in a subshell, the vared aka variable edit command that is provided by zsh is not longer available, as the function in now running in a subshell that is non-interactive??

The reason for running these functions in a subshell seems legitimate, so I not sure how to handle the situation? Maybe removing the usage of vared here? Maybe reverting https://github.com/scmbreeze/scm_breeze/commit/136fb6b4ee446fff8bd976768702200460714c96 and only running the parts of the functions that block/wait/take a long time within a subshell so that ctrl+c doesn't exit the interactive shell that called the function?

Sorry for the annoyance

[1] https://github.com/scmbreeze/scm_breeze/commit/136fb6b4ee446fff8bd976768702200460714c96#diff-9070c9d1a356a6ef9eacfc3002d78d0d9b5b88ba9c8509884d66564f3a7aa3ccR220

Tobbe commented 8 months ago

I just ran into this too. So leaving a comment to bump this issue 🙂

saiqulhaq commented 6 months ago

cd ~/.scm_breeze git checkout 6c85b866af60887449099895d2aa2d6d45fae246