Skip to content
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

git plugin hangs when changing directories #3729

Closed
adamsiemion opened this issue Mar 27, 2015 · 9 comments
Closed

git plugin hangs when changing directories #3729

adamsiemion opened this issue Mar 27, 2015 · 9 comments

Comments

@adamsiemion
Copy link

From time to time when I change the directory in my git sources the shell hangs. Unfortunately I am not able to reproduce it, it happens from time to time.

Console output:

➜  webapp git:(feature/PROJECT-440-branch-name) ✗         cd ..
<I pressed the enter, Control-C, etc. but nothing helped>
➜  main <then this was displayed, but the shell was still unresponsive>

Environment:
Windows 7
CYGWIN_NT-6.1 WA-L049 1.7.33-2(0.280/5/3) 2014-11-13 15:47 x86_64 Cygwin
zsh 5.0.6 (x86_64-unknown-cygwin)

@mcornella
Copy link
Member

Can you see any pattern? Maybe the folder is over network? You can disable git prompt in all repositories with git config --global oh-my-zsh.hide-status 1.

Another trick you can use is running zsh in tracing mode and redirecting that to a file. If it works well, when the prompt gets frozen you can just close the shell and the tracing will be there for us to follow the execution trail:

exec zsh -xv 2>~/tracing.log

The output will be written in ~/tracing.log. If you upload this in a gist we'll take a look.
BTW, you can put this line in your .zshrc file to get tracing of every terminal session (the tracing file will be overwritten every time you start a session, use >> to append to the file instead).

/cc @apjanke: look at this method of debugging, I have a memory of us using something a little more complicated, am I right?

@mcornella
Copy link
Member

Wait, no, putting that line on .zshrc will lead to an infinite recursion because zsh will read .zshrc again. So don't do that, I don't know if there's a solution to this problem. But anyway, you should be able to run it manually whenever you want to capture the origin of your problem.

@apjanke
Copy link
Contributor

apjanke commented Mar 27, 2015

@mcornella: I remember you used the same set -vx method of debugging for #3706, which turned out to be a slow git status check over VM/network remote filesystems. That's all the zsh debugging settings I know; I just picked it up from you.

If you're going to turn it on for every session, you might want to stick a timestamp in the filename. Otherwise it'll break if you have multiple zsh sessions running at once. (I don't know what happens when multiple processes open the same file for appending. Last one clobbers? Indeterminate interleaving/partial clobbering?)

STAMP=$(date +%C%y%m%d-%H%M%s)
exec zsh -xv 2>$ZSH/log/tracing-$STAMP.log

And I dunno if using that exec in ~/.zshrc would work right, since the new non-login zsh wouldn't inherit all the parameters and shell opts of the top one. You might need to do something like if [[ XTRACE is not set ]]; then exec zsh -xv 2>that_log_file; fi so it picks up the initialization code again but doesn't end up in an infinite loop re-reading .zshrc each time.

You might be thinking of the detailed oh-my-zsh diagnostic dump function I wrote. That could also be useful here; knowing the exact zsh config could provide hints as to what's happening here, or help us reproduce it. @adko-pl, could you use that to give us details on your OMZ setup? To do so, download that diagnostics.zsh, source it, do omz_diagnostic_dump > zsh-config-adkopl.txt, and post that output file as a gist.


EDIT: Removed the -l from the exec zsh call; the new shell doesn't need to be a login shell.

@mcornella
Copy link
Member

Nice, I think a Troubleshooting section in the wiki will be very useful to put these shortcuts.

@mcornella
Copy link
Member

@adko-pl any updates?

@adamsiemion
Copy link
Author

@mcornella I have followed your suggestion and enabled tracing, but since then I was not able to reproduce this issue. It seems it no longer exists, therefore I am closing this ticket. Thank you @mcornella for your awesome support!

@mcornella
Copy link
Member

Nice, thank you! 😄

@terwer
Copy link

terwer commented Apr 26, 2019

git config --global oh-my-zsh.hide-status 1

Thanks,it worked for me

@andilabs
Copy link

andilabs commented May 29, 2020

seriously no way to have working zsh with displaying git info?
I pulled my projects repo to have a bit cleaner .git but the problem is still there ;(
actually this sucks for any kind of git repo independently if this is tiny one with 2 branches or huge one with thousands of them...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants