From 0deb59b6e24a9d506cfe9a208d4c24ba20523d33 Mon Sep 17 00:00:00 2001 From: Cameron Diver Date: Thu, 1 Nov 2018 12:21:56 +0000 Subject: [PATCH] Dont ignore balena metadata directories when balena pushing Change-type: patch Signed-off-by: Cameron Diver --- lib/utils/ignore.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/utils/ignore.ts b/lib/utils/ignore.ts index c773df2f..111f7e4f 100644 --- a/lib/utils/ignore.ts +++ b/lib/utils/ignore.ts @@ -77,6 +77,7 @@ export class FileIgnorer { if (/\s*#/.test(line) || _.isEmpty(line)) { return; } + this.addEntry(line, fullPath, type); }); @@ -86,6 +87,14 @@ export class FileIgnorer { // Pass this function as a predicate to a filter function, and it will filter // any ignored files public filter = (filename: string): boolean => { + const relFile = path.relative(this.basePath, filename); + + // Don't ignore any metadata files + const baseDir = path.dirname(relFile).split(path.sep)[0]; + if (baseDir === '.balena' || baseDir === '.resin') { + return true; + } + const dockerIgnoreHandle = dockerIgnore(); const gitIgnoreHandle = ignore(); @@ -102,8 +111,6 @@ export class FileIgnorer { { handle: gitIgnoreHandle, entries: this.gitIgnoreEntries }, ]; - const relFile = path.relative(this.basePath, filename); - _.each(ignoreTypes, ({ handle, entries }) => { _.each(entries, ({ pattern, filePath }) => { if (FileIgnorer.contains(path.posix.dirname(filePath), filename)) {