diff deleted fix

This commit is contained in:
Yuri Kuznetsov
2020-09-15 12:53:45 +03:00
parent 5ca5ee55ee
commit bc4a9a07b6
+57 -8
View File
@@ -444,16 +444,17 @@ class Diff
getDeletedFileList (versionFrom) {
process.chdir(this.espoPath);
var deletedFileList = [];
var deletedFileList = this.getRepositoryDeletedFileList(versionFrom);
var previousAllFileList = this.getPreviousAllFileList(versionFrom);
var actualAllFileList = this.getActualAllFileList();
var stdout = cp.execSync('git diff --name-only --diff-filter=D ' + versionFrom).toString();
(stdout || '').trim().split('\n').forEach(function (file) {
if (file == '') {
return;
previousAllFileList.forEach(function (file) {
if (
! ~actualAllFileList.indexOf(file) &&
! ~deletedFileList.indexOf(file)
) {
deletedFileList.push(file);
}
deletedFileList.push(file);
});
deletedFileList = deletedFileList.filter(function (item) {
@@ -469,6 +470,54 @@ class Diff
return deletedFileList;
}
getRepositoryDeletedFileList (versionFrom) {
var deletedFileList = [];
var stdout = cp.execSync('git diff --name-only --diff-filter=D ' + versionFrom).toString();
(stdout || '').trim().split('\n').forEach(function (file) {
if (file == '') {
return;
}
deletedFileList.push(file);
});
return deletedFileList;
}
getActualAllFileList () {
var actualAllFileList = [];
var stdout = cp.execSync('git ls-tree -r --name-only HEAD').toString();
(stdout || '').trim().split('\n').forEach(function (file) {
if (file == '') {
return;
}
actualAllFileList.push(file);
});
return actualAllFileList;
}
getPreviousAllFileList (versionFrom) {
var previousAllFileList = [];
var stdout = cp.execSync('git ls-tree -r --name-only ' + versionFrom).toString();
(stdout || '').trim().split('\n').forEach(function (file) {
if (file == '') {
return;
}
previousAllFileList.push(file);
});
return previousAllFileList;
}
}
function execute (command, callback) {