primefaces: Inconsistent Line Ending: Mix of CRLF and LF in the Repository - moment.js in particular

1) Environment

2) Expected behavior

All files should be committed with Unix Style ended with LF. (Almost all files are ended with LF by the way)

3) Actual behavior

Some files were committed with Windows Style CRLF (Actually, there is one as far as I can tell: moment.js). As a result, For any of those files, git diff will see the whole file as changed when it’s not

4) Steps to reproduce

Use bash command:

cat -A [the following file]

https://github.com/primefaces/primefaces/blob/master/src/main/resources/META-INF/resources/primefaces/moment/moment.js

...
hooks.HTML5_FMT = {^M$
        DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm',             // <input type="datetime-local" />^M$
        DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss',  // <input type="datetime-local" step="1" />^M$
        DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS',   // <input type="datetime-local" step="0.001" />^M$
        DATE: 'YYYY-MM-DD',                             // <input type="date" />^M$
        TIME: 'HH:mm',                                  // <input type="time" />^M$
        TIME_SECONDS: 'HH:mm:ss',                       // <input type="time" step="1" />^M$
        TIME_MS: 'HH:mm:ss.SSS',                        // <input type="time" step="0.001" />^M$
        WEEK: 'YYYY-[W]WW',                             // <input type="week" />^M$
        MONTH: 'YYYY-MM'                                // <input type="month" />^M$
    };^M$
^M$
    return hooks;^M$
...

Note that ^M$ means CRLF


Pick another file (the normal case):

https://github.com/primefaces/primefaces/blob/master/src/main/resources/META-INF/resources/primefaces/datatable/datatable.js

use the same cat command

$
        if(!row.parent().attr('tabindex')) {$
            this.frozenTbody.trigger('focus');$
        }$
    },$
$
    //@Override$
    saveColumnOrder: function() {$
        var columnIds = [],$
        columns = $(this.jqId + '_frozenThead:first th,' + this.jqId + '_scrollableThead:first th');$
$
        columns.each(function(i, item) {$
            columnIds.push($(item).attr('id'));$
        });$
$
        this.orderStateHolder.val(columnIds.join(','));$
    }$
$
});$

Note that $ means LF

5) Thought

For cross platform development, it is recommended to use a consistent line ending. Since almost all the files are currently ended with LF, the moment.js should be also ended with LF instead CRLF.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

OK to get my fork back to out of “hell” I had to do this and now everything is all good!

git fetch upstream
git checkout master
git reset --hard upstream/master  
git push origin master --force