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

Broken in cygwin due to Windows-style \r\n line endings #333

Closed
Zenexer opened this issue Sep 11, 2013 · 4 comments
Closed

Broken in cygwin due to Windows-style \r\n line endings #333

Zenexer opened this issue Sep 11, 2013 · 4 comments

Comments

@Zenexer
Copy link

Zenexer commented Sep 11, 2013

There are stay \r\n line endings in autoload/vundle.vim. Result on cygwin:

E492: Not an editor command: ^M
line    8:
E182: Invalid command name
line    9:
E492: Not an editor command: ^M
line   11:
E182: Invalid command name
line   12:
E492: Not an editor command: ^M
line   14:
E182: Invalid command name
line   15:
E492: Not an editor command: ^M
line   17:
E182: Invalid command name
line   18:
E492: Not an editor command: ^M
line   20:
E182: Invalid command name
line   21:
E492: Not an editor command: ^M
line   23:
E182: Invalid command name
line   24:
E492: Not an editor command: ^M
line   27:
E492: Not an editor command: ^M

... and lots more.

Solution: use Unix-style line endings. This is vim, after all.

@starcraftman
Copy link
Contributor

Hi @Zenexer.

Firstly, rest assured that the source code doesn't have Windows line endings in the repository.

I've been testing this a bit today. This is a legit bug. It isn't really Vundle's fault though, it comes down to the difference between cygwin and msysgit. Funnily enough, I actually use cygwin on one of my WIndows boxes and msysgit on the other which is why I looked at this. Prior to this issue, I only installed Vundle on the msysgit machine.

I tested this by writing a simple shell script at the bottom of this post. On msysgit, this script works whether the End Of Line (hereafter EOL) is UNIX(\n) or Windows (\cr\n). However, cygwin complains when the file ends in Windows EOL. This is an important distinction when combined with how default each shell clones the repositories on windows by default. After removing my gitconfig file it appears that both msysgit and cygwin will checkout the repository with Windows EOL unless told otherwise.

This is something we should probably document. A quick fix for you if you don't want to have to run dos2unix over the vundle files is to change your core.autocrlf setting with: `git config --global core.autocrlf false. This means it will be checked out with UNIX line endings. To read more about line endings and git see (http://www.git-scm.com/book/ch7-1.html#Formatting-and-Whitespace), git's approach depends entirely on user settings so unless we programmed some detection its mainly a doc fix well need for this.

Basically there are 3 usual settings for this. If set to input, no conversion happens during checkin but it will be set to native on checkout. Input is usually for unix systems. If true, it checks out at crlf and checks in as lf. That is usually windows. To disable entirely changes on checkout/checing it gets set to false.

I'm gonna tag this as a bug for now, I guess we shall evaluate the PR in due time and see if that is suitable to fix it on cygwin. The pull request in question is #288.

#!/bin/bash
echo "This is a test."

@Zenexer
Copy link
Author

Zenexer commented Feb 10, 2014

It never occurred to me that Cygwin would deliberately check anything out with Windows line endings.

You can fix this with a .gitattributes file: Dealing with line endings: Per-repository settings

Something like this should do the trick:

*.vim text eol=lf
*.sh text eol=lf

I've used that in the past to fix such problems on Windows, and it seems to be effective.

@Shougo
Copy link
Contributor

Shougo commented Feb 10, 2014

This is not Vundle's problem. It is git setting features. You should close this issue.

@MarcWeber
Copy link

http://stackoverflow.com/questions/4181870/git-on-windows-what-do-the-crlf-settings-mean Home directories .gitconfig or such can be used to change the setting probably

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

No branches or pull requests

5 participants