Skip to content

Commit a638018

Browse files
committed
Allow options to be passed for the spawned git process
Closes #1
1 parent 8fba1a0 commit a638018

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ $ npm install git-log-parser
1111

1212
## API
1313

14-
#### `log.parse(config)` -> `Stream(commits)`
14+
#### `log.parse(config, options)` -> `Stream(commits)`
1515

1616
Accepts a `config` object mapping to the [options accepted by `git log`](http://git-scm.com/docs/git-log). `config` will be automatically converted to command line options and flags by [argv-formatter](https://github.com/bendrucker/argv-formatter). Returns a stream of commit objects.
1717

18+
`options` is passed directly to [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
19+
1820
A commit is structured as follows:
1921

2022
```js

src/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function trim () {
3030
});
3131
}
3232

33-
function log (args) {
34-
return fwd(spawn('git', ['log'].concat(args)), function (code, stderr) {
33+
function log (args, options) {
34+
return fwd(spawn('git', ['log'].concat(args), options), function (code, stderr) {
3535
return new Error('git log failed:\n\n' + stderr);
3636
})
3737
.stdout;
@@ -42,11 +42,11 @@ function args (config, fieldMap) {
4242
return toArgv(config);
4343
}
4444

45-
exports.parse = function parseLogStream (config) {
45+
exports.parse = function parseLogStream (config, options) {
4646
config = config || {};
4747
var map = fields.map();
4848
return combine([
49-
log(args(config, map)),
49+
log(args(config, map), options),
5050
split(END + '\n'),
5151
trim(),
5252
through.obj(function (chunk, enc, callback) {

0 commit comments

Comments
 (0)