2013-02-01 08:51:26 +09:00
|
|
|
'use strict';
|
2012-08-21 02:33:41 +09:00
|
|
|
|
|
|
|
function checkIfCrlfIsPresent(files) {
|
|
|
|
var failed = [];
|
|
|
|
|
|
|
|
(ls(files)).forEach(function checkCrlf(file) {
|
|
|
|
if ((cat(file)).match(/.*\r.*/)) {
|
|
|
|
failed.push(file);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (failed.length) {
|
|
|
|
var errorMessage =
|
|
|
|
'Please remove carriage return\'s from\n' + failed.join('\n') + '\n' +
|
|
|
|
'Also check your setting for: git config core.autocrlf.';
|
|
|
|
|
|
|
|
echo();
|
|
|
|
echo(errorMessage);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent;
|