ccarruitero / makemehapi

Self guided workshops to teach you about hapi.
https://www.npmjs.com/package/makemehapi
Other
480 stars 107 forks source link

Changed to explicitly set the text line ending to ‘lf’ #190

Closed akihito-takeuchi closed 7 years ago

akihito-takeuchi commented 7 years ago

I updated the .gitattributes file to modify the line ending of .js files to 'LF'. Current release '5.2.1' has line ending problem in MacOS X. To fix this problem, I believe following steps are needed.

fiveisprime commented 7 years ago

Nothing.

I've tried all the tricks including what you've suggested and others - I've tried on OS X and Ubuntu (and even Windows), but I can never make git think there are changes to commit.

Can you PR the fix to line endings?

akihito-takeuchi commented 7 years ago

Git automatically changes the line ending when it restore the files in the local directory. The line ending of makemehapi.js may be changed, but git will never report it as the change to be committed.

If the line ending is CRLF, following command will show the lines in the file.

% grep "\r" makemehapi.js

I believe this command shows nothing now. You can test how .gitattributes file behaves with following steps. (Changing the line ending to 'CRLF', which will not work on my Mac)

  1. Make sure following command reports nothing. (If it print the contents of the file, you may want to create new clone. The makemehapi.js in new clone should have the line ending 'LF')

% grep "\r" makemehapi.js

  1. Change the .gitattributes as below to force the line ending to CRLF. (No need to commit)

% git diff --- a/.gitattributes +++ b/.gitattributes @@ -3,7 +3,7 @@

# Explicitly declare text files we want to always be normalized and converted # to native line endings on checkout. -*.js text eol=lf +*.js text eol=crlf

  1. Remove makemehapi.js and checkout again. (Force git to restore the file)

% rm makemehapi.js % git checkout makemehapi.js

  1. Confirm that line ending changed.

% git "\r" makemehapi.js

In the step 4, the command should print the contents of the file since the git restored the makemehapi.js with the line ending 'CRLF'.

In my understanding, the makemehapi.js should have the line ending 'LF' just before releasing the package through npm.