tools: Actually check ignored files

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2023-03-01 07:44:31 +01:00
parent 75e13996f1
commit bd8a574e7a

View file

@ -12,7 +12,7 @@ const SECTION_START = "AUTOGENERATED COPYRIGHT HEADER START";
const SECTION_END = "AUTOGENERATED COPYRIGHT HEADER END";
async function git_isIgnored(path) {
await new Promise((resolve, reject) => {
return await new Promise((resolve, reject) => {
try {
let proc = CHILD_PROCESS.spawn("git", [
"check-ignore",
@ -36,11 +36,11 @@ async function git_isIgnored(path) {
/* Sync alternative
try {
return CHILD_PROCESS.spawnSync("git", [
"check-ignore",
"check-ignore",
path
], {
"cwd": PROCESS.cwd(),
"encoding": "utf8"
"cwd": PROCESS.cwd(),
"encoding": "utf8"
}).status == 0;
} catch (ex) {
return true;
@ -249,7 +249,7 @@ async function addCopyright(file) {
// Async/Promises
let content = await FSPROMISES.readFile(file);
let eol = (content.indexOf("\r\n") != -1 ? OS.EOL : "\n");
let copyright = await generateCopyright(file);
let header = makeHeader(file, copyright);
let insert = Buffer.from(header.join(eol) + eol);
@ -258,7 +258,7 @@ async function addCopyright(file) {
let startHeader = content.indexOf(SECTION_START);
startHeader = content.lastIndexOf(eol, startHeader);
startHeader += Buffer.from(eol).byteLength;
// Find the ending point.
let endHeader = content.indexOf(SECTION_END);
endHeader = content.indexOf(eol, endHeader);