mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-25 04:36:23 +00:00
fixes #1642
This commit is contained in:
@@ -120,7 +120,7 @@ gulp.task('tslint', function () {
|
||||
.pipe(gulptslint.report(reporter, options));
|
||||
});
|
||||
|
||||
var hygiene = exports.hygiene = function (some) {
|
||||
var hygiene = exports.hygiene = function (some, options) {
|
||||
var errorCount = 0;
|
||||
|
||||
var eol = es.through(function (file) {
|
||||
@@ -181,7 +181,7 @@ var hygiene = exports.hygiene = function (some) {
|
||||
return gulp.src(some || all, { base: '.' })
|
||||
.pipe(filter(function (f) { return !f.stat.isDirectory(); }))
|
||||
.pipe(filter(eolFilter))
|
||||
.pipe(eol)
|
||||
.pipe(options.skipEOL ? es.through() : eol)
|
||||
.pipe(filter(indentationFilter))
|
||||
.pipe(indentation)
|
||||
.pipe(filter(copyrightFilter))
|
||||
@@ -204,21 +204,25 @@ gulp.task('hygiene', function () {
|
||||
// this allows us to run this as a git pre-commit hook
|
||||
if (require.main === module) {
|
||||
var cp = require('child_process');
|
||||
cp.exec('git diff --cached --name-only', function (err, out) {
|
||||
if (err) {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
cp.exec('git config core.autocrlf', function (err, out) {
|
||||
var skipEOL = out.trim() === 'true';
|
||||
|
||||
var some = out
|
||||
.split(/\r?\n/)
|
||||
.filter(function (l) { return !!l; });
|
||||
cp.exec('git diff --cached --name-only', function (err, out) {
|
||||
if (err) {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
hygiene(some).on('error', function (err) {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
var some = out
|
||||
.split(/\r?\n/)
|
||||
.filter(function (l) { return !!l; });
|
||||
|
||||
hygiene(some, { skipEOL: skipEOL }).on('error', function (err) {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user