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

.oh-my-zsh/plugins/git/git.plugin.zsh:local:2: not valid in this context: git_cmd^M #3963

Closed
shiduanguang opened this issue Jun 8, 2015 · 5 comments

Comments

@shiduanguang
Copy link

After the latest upgrade_oh_my_zsh, I got this error and the git plugin didn't work.

@apjanke
Copy link
Contributor

apjanke commented Jun 8, 2015

Can you be more specific about the errors you're seeing? When do you see that error message?

As an experiment, delete line 2 of plugins/git/git.plugin.zsh, where it says local git_cmd. Does that fix it?

@apjanke
Copy link
Contributor

apjanke commented Jun 8, 2015

Also, check to make sure you don't have a DOS-mode file for plugins/git/git.plugin.zsh for some reason, if you're on a non-DOS system. I think ^M is \r, and I can reproduce this error by running some bogus DOS-mode text on my OS X 10.9 system.

$ eval $(printf 'local git_cmd\r')
local: not valid in this context: git_cmd^M

And if I unix2dos plugins/git/git.plugin.zsh, then I get that error message upon starting a shell session.

Last login: Mon Jun  8 05:32:39 on ttys006
/Users/janke/.oh-my-zsh/plugins/git/git.plugin.zsh:local:2: not valid in this context: git_cmd^M
➜  ~

@razor-x
Copy link

razor-x commented Jun 8, 2015

Not sure if this is related, but I just updated and now whenever I open a new shell I get git_cmd=git and then my normal prompt, e.g.,

git_cmd=git
$

@apjanke
Copy link
Contributor

apjanke commented Jun 8, 2015

It's related; that top-level local was added in a recent update to the git plugin. There's an outstanding PR #3962 to fix it.

@shiduanguang
Copy link
Author

This problem is solved now, the reason is that I set my git line endings incorrectly.
On Mac OS X 10.10.3:

$ cd ~/.oh-my-zsh
$ git reset --hard cffeefde903149df8ef48224fedf5205cb2497c3
$ git config --global core.autocrlf input
$ git pull

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

3 participants