cartodb-4.42/lib/build/branchFiles/branchFiles.js
2024-04-06 05:25:13 +00:00

41 lines
901 B
JavaScript

/**
* branchFiles
*
* Outputs the list of modified files in the current branch compared to master.
* Includes already commited files and the ones unstaged.
*/
var _ = require('underscore');
var colors = require('colors');
var modifiedFiles = require('./modifiedFiles');
var fileList = [];
var getModifiedFiles = function () {
modifiedFiles()
.then(function (files) {
var newFiles = _.difference(files, fileList);
var removedFiles = _.difference(fileList, files);
var change = false;
fileList = files;
if (newFiles.length > 0) {
change = true;
}
if (removedFiles.length > 0) {
change = true;
}
if (change) {
fileList.forEach(function file (file) {
console.log(file);
});
}
})
.catch(function (reason) {
console.log(colors.red(reason));
});
};
getModifiedFiles();