8
0
fredck 11 лет назад
Родитель
Сommit
938c2b83dc
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      packages/ckeditor5-utils/dev/tasks/res/tools.js

+ 9 - 1
packages/ckeditor5-utils/dev/tasks/res/tools.js

@@ -67,7 +67,15 @@ module.exports = {
 	getGitDirtyFiles: function() {
 	getGitDirtyFiles: function() {
 		// Cache it, so it is executed only once when running multiple tasks.
 		// Cache it, so it is executed only once when running multiple tasks.
 		if ( !dirtyFiles ) {
 		if ( !dirtyFiles ) {
-			dirtyFiles = this.shExec( 'git diff-index --name-only HEAD' ).replace( /\s*$/, '' ).split( '\n' );
+			dirtyFiles = this
+				// Compare the state of index with HEAD.
+				.shExec( 'git diff-index --name-only HEAD' )
+				// Remove trailing /n, to avoid empty entry.
+				.replace( /\s*$/, '' )
+				// Transform into array.
+				.split( '\n' );
+
+			// If nothing is returned, the array will one one empty string only.
 			if ( dirtyFiles.length == 1 && !dirtyFiles[ 0 ] ) {
 			if ( dirtyFiles.length == 1 && !dirtyFiles[ 0 ] ) {
 				dirtyFiles = [];
 				dirtyFiles = [];
 			}
 			}