From da2c670d8dce372ae15b4c914612ceefa1e26bf5 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Tue, 29 Sep 2015 17:21:48 +0200 Subject: [PATCH] ignore **/.git/** fix #2 --- src/package.ts | 7 ++++++- test/package.test.js | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/package.ts b/src/package.ts index f8a9e39..870ff6c 100644 --- a/src/package.ts +++ b/src/package.ts @@ -89,7 +89,12 @@ function toVsixManifest(manifest: Manifest): Promise { })); } -const defaultIgnore = ['.vscodeignore', '**/*.vsix', '**/.DS_Store']; +const defaultIgnore = [ + '.vscodeignore', + '**/.git/**', + '**/*.vsix', + '**/.DS_Store' +]; function collectFiles(cwd: string): Promise { return nfcall(glob, '**', { cwd, nodir: true, dot: true }).then(files => { diff --git a/test/package.test.js b/test/package.test.js index 79ab3da..0fe49e7 100644 --- a/test/package.test.js +++ b/test/package.test.js @@ -1,5 +1,6 @@ import { readManifest, collect } from '../out/package'; import * as path from 'path'; +import * as fs from 'fs'; import * as assert from 'assert'; const fixture = name => path.join(__dirname, 'fixtures', name); @@ -17,4 +18,24 @@ describe('collect', () => { }) .catch(cb); }); + + it('should ignore .git/**', cb => { + const cwd = fixture('uuid'); + + if (!fs.existsSync(path.join(cwd, '.git'))) { + fs.mkdirSync(path.join(cwd, '.git')); + } + + if (!fs.existsSync(path.join(cwd, '.git', 'hello'))) { + fs.writeFileSync(path.join(cwd, '.git', 'hello'), 'world'); + } + + readManifest(cwd) + .then(manifest => collect(cwd, manifest)) + .then(files => { + assert.equal(files.length, 3); + cb(); + }) + .catch(cb); + }); }); \ No newline at end of file