Merge pull request #1009 from balena-io/ignored-balena-dir

Dont ignore balena metadata directories when balena pushing
This commit is contained in:
CameronDiver 2018-11-01 15:17:26 +01:00 committed by GitHub
commit 0983bf02e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)) {