Skip to content

Commit

Permalink
Ensure git.diff has maxBuffer opt - closes #192
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlacy committed Feb 6, 2019
1 parent 941bb9f commit c27a014
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
17 changes: 17 additions & 0 deletions README.md
Expand Up @@ -703,6 +703,23 @@ Remove untracked files from the working tree

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

### git.diff(branch, opt)
`git diff master <options>`

Diffs between git objects

`branch`: String, branch name, commit name, or git tag

`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`

```js
gulp.task('diff', function(){
gulp.src('./*')
.pipe(git.diff('develop', {log: true}))
.pipe(gulp.dest('./diff.out'));
});
```

#### You can view more examples in the [example folder.](https://github.com/stevelacy/gulp-git/tree/master/examples)

<br/>
Expand Down
5 changes: 4 additions & 1 deletion lib/diff.js
Expand Up @@ -83,7 +83,10 @@ module.exports = function (compare, opt) {
if (opt.args) {
cmd += ' ' + opt.args;
}
exec('git diff --raw -z ' + cmd, {cwd: opt.cwd}, function(err, stdout) {

var maxBuffer = opt.maxBuffer || 200 * 1024;

exec('git diff --raw -z ' + cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout) {
if (err) return srcStream.emit('error', err);
var files = getReaslt(stdout);

Expand Down

0 comments on commit c27a014

Please sign in to comment.