return `null` when .git/config doesn't exist

master
jonschlinkert 10 years ago
parent 7df10825c8
commit 0d60766a21

@ -38,7 +38,7 @@ function git(cwd, cb) {
git.sync = function configSync(cwd) { git.sync = function configSync(cwd) {
var fp = resolve(cwd); var fp = resolve(cwd);
if (!fs.existsSync(fp)) { if (!fs.existsSync(fp)) {
throw new Error('.git/config does not exist.'); return null;
} }
return ini.parse(fs.readFileSync(fp, 'utf8')); return ini.parse(fs.readFileSync(fp, 'utf8'));
}; };

@ -17,12 +17,6 @@ describe('sync:', function () {
git.sync().should.not.have.properties(['foo']); git.sync().should.not.have.properties(['foo']);
git.sync().should.not.throw; git.sync().should.not.throw;
}); });
it('should throw an error when .git/config does not exist:', function () {
(function () {
git.sync('foo');
}).should.throw('.git/config does not exist.');
});
}); });
describe('async:', function () { describe('async:', function () {

Loading…
Cancel
Save