Comparing version 2.1.0 to 2.1.1
11
index.js
@@ -52,4 +52,11 @@ module.exports = gitlog | ||
var prevWorkingDir = process.cwd() | ||
try { | ||
process.chdir(options.repo) | ||
} catch (e) { | ||
throw new Error('Repo location does not exist') | ||
} | ||
// Start constructing command | ||
var command = 'cd ' + options.repo + ' && git log -n ' + options.number | ||
var command = 'git log -n ' + options.number | ||
@@ -95,2 +102,4 @@ command = addOptional(command, options) | ||
}) | ||
process.chdir(prevWorkingDir); | ||
} | ||
@@ -97,0 +106,0 @@ |
{ | ||
"name": "gitlog", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Git log parser for Node.JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,6 +32,12 @@ var gitlog = require('../') | ||
it('throws an error when repo location does not exist', function() { | ||
(function() { | ||
gitlog({ repo: 'wrong directory' }, function() {}) | ||
}).should.throw('Repo location does not exist') | ||
}) | ||
it('throws an error when an unknown field is used', function() { | ||
var field = 'fake-field' | ||
; (function() { | ||
gitlog({ repo: 'test-repo', fields: [ field ] }, function() {}); | ||
gitlog({ repo: testRepoLocation, fields: [ field ] }, function() {}); | ||
}).should.throw('Unknown field: ' + field) | ||
@@ -38,0 +44,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18161
273