Ignore history files form changes to prevent endless loop

This commit is contained in:
Catenocrypt 2021-02-22 17:26:16 +01:00
parent 6b628a09e5
commit fdefb587e0

View File

@ -14,6 +14,7 @@ class VersionInfo {
const FilenameLatest = "history/LATEST.json"; const FilenameLatest = "history/LATEST.json";
const FilenameChangeTemplate = "history/versions/"; const FilenameChangeTemplate = "history/versions/";
const IgnoreHistoryPrefix = "history/";
const TooManyChangesLimit = 40; const TooManyChangesLimit = 40;
//const util = require('util'); //const util = require('util');
@ -75,7 +76,11 @@ async function getChangedFiles(commitStart: string, commitEnd: string): Promise<
if (!bulk) { if (!bulk) {
return []; return [];
} }
const list: string[] = bulk.split("\n").filter(l => l); const list: string[] = bulk.split("\n").filter(l => {
if (!l) return false;
if (l.startsWith(IgnoreHistoryPrefix)) return false;
return true;
});
return list; return list;
} }
@ -143,7 +148,7 @@ export async function processChanges(): Promise<number> {
const files: string[] = await getChangedFiles(ver.commit, currCommit); const files: string[] = await getChangedFiles(ver.commit, currCommit);
console.log(`${files.length} changed files found`); console.log(`${files.length} changed files found`);
if (!files || files.length == 0) { if (!files || files.length == 0) {
console.log(`Error: Could not obtain list of changed files between commits ${ver.commit} and ${currCommit}`); console.log(`Error: Could not obtain list of changed files, or no changed files between commits ${ver.commit} and ${currCommit}`);
return 4; return 4;
} }
if (files.length == 0) { if (files.length == 0) {