ignore **/.git/**

fix #2
This commit is contained in:
Joao Moreno 2015-09-29 17:21:48 +02:00
parent f88b764e99
commit da2c670d8d
2 changed files with 27 additions and 1 deletions

View file

@ -89,7 +89,12 @@ function toVsixManifest(manifest: Manifest): Promise<string> {
}));
}
const defaultIgnore = ['.vscodeignore', '**/*.vsix', '**/.DS_Store'];
const defaultIgnore = [
'.vscodeignore',
'**/.git/**',
'**/*.vsix',
'**/.DS_Store'
];
function collectFiles(cwd: string): Promise<string[]> {
return nfcall<string[]>(glob, '**', { cwd, nodir: true, dot: true }).then(files => {

View file

@ -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);
});
});