From 0d60766a216ef199c1a2a8ba2a106a82c5409374 Mon Sep 17 00:00:00 2001 From: jonschlinkert Date: Fri, 27 Feb 2015 13:08:38 -0500 Subject: [PATCH] return `null` when .git/config doesn't exist --- index.js | 2 +- test.js | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/index.js b/index.js index 2c68c8d..6bdd805 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ function git(cwd, cb) { git.sync = function configSync(cwd) { var fp = resolve(cwd); if (!fs.existsSync(fp)) { - throw new Error('.git/config does not exist.'); + return null; } return ini.parse(fs.readFileSync(fp, 'utf8')); }; diff --git a/test.js b/test.js index fb3b183..da9ec3b 100644 --- a/test.js +++ b/test.js @@ -17,12 +17,6 @@ describe('sync:', function () { git.sync().should.not.have.properties(['foo']); 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 () {