Skip to content

Commit c27a014

Browse files
committed
Ensure git.diff has maxBuffer opt - closes #192
1 parent 941bb9f commit c27a014

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,23 @@ Remove untracked files from the working tree
703703

704704
`cb`: function (optional), passed err if any
705705

706+
### git.diff(branch, opt)
707+
`git diff master <options>`
708+
709+
Diffs between git objects
710+
711+
`branch`: String, branch name, commit name, or git tag
712+
713+
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
714+
715+
```js
716+
gulp.task('diff', function(){
717+
gulp.src('./*')
718+
.pipe(git.diff('develop', {log: true}))
719+
.pipe(gulp.dest('./diff.out'));
720+
});
721+
```
722+
706723
#### You can view more examples in the [example folder.](https://github.com/stevelacy/gulp-git/tree/master/examples)
707724

708725
<br/>

lib/diff.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ module.exports = function (compare, opt) {
8383
if (opt.args) {
8484
cmd += ' ' + opt.args;
8585
}
86-
exec('git diff --raw -z ' + cmd, {cwd: opt.cwd}, function(err, stdout) {
86+
87+
var maxBuffer = opt.maxBuffer || 200 * 1024;
88+
89+
exec('git diff --raw -z ' + cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout) {
8790
if (err) return srcStream.emit('error', err);
8891
var files = getReaslt(stdout);
8992

0 commit comments

Comments
 (0)