-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6695 from elastic/jasper/backport/6692/4.x
[backport] PR #6692 to 4.x
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { startsWith } from 'lodash'; | ||
|
||
// Fails if any .rej files are found | ||
// .rej files are an artifact from a failed git-apply or a jasper backport | ||
|
||
// This check is intentionally performed on the files in the repo rather than | ||
// on the files that are to be committed. | ||
|
||
export default grunt => { | ||
grunt.registerTask('rejectRejFiles', 'Reject any git-apply .rej files', () => { | ||
const ignoredTopLevelDirs = [ | ||
'esvm', | ||
'installedPlugins', | ||
'node_modules', | ||
'optimize' | ||
]; | ||
|
||
const matchBase = true; | ||
const filter = file => ( | ||
ignoredTopLevelDirs.every(dir => !startsWith(file, dir)) | ||
); | ||
|
||
const files = grunt.file.expand({ filter, matchBase }, '*.rej'); | ||
if (files.length > 0) { | ||
const err = `.rej files are not allowed:\n${files.join('\n')}`; | ||
grunt.log.error(err); | ||
return false; | ||
} | ||
}); | ||
}; |