# git-diff-tree

> Shelling out to git-diff-tree(1) in a Node streamy fashion

Latest version **1.1.0** (published 2019-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-diff-tree
pnpm add git-diff-tree
yarn add git-diff-tree
bun add git-diff-tree
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-12-20 |
| First published | 2014-06-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 25.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Alexandru Vladutu |
| Maintainers | alessioalex |
| Keywords | git, diff, tree, diff-tree, git-diff |

## Links

- npm: https://www.npmjs.com/package/git-diff-tree
- Repository: https://github.com/alessioalex/git-diff-tree
- Issues: https://github.com/alessioalex/git-diff-tree/issues
- npm.io page: https://npm.io/package/git-diff-tree

## Dependencies (4)

- [through2](https://npm.io/package/through2.md) 2.0.0
- [pump-chain](https://npm.io/package/pump-chain.md) 1.0.0
- [git-spawned-stream](https://npm.io/package/git-spawned-stream.md) 1.0.1
- [split-transform-stream](https://npm.io/package/split-transform-stream.md) 0.1.1

## Recent versions

- 1.1.0 (latest) — 2019-12-20
- 1.0.0 — 2015-11-27
- 0.1.2 — 2014-07-14
- 0.1.1 — 2014-07-13
- 0.1.0 — 2014-06-13

## README

# git-diff-tree

Shelling out to [git-diff-tree(1)](https://www.kernel.org/pub/software/scm/git/docs/git-diff-tree.html) in a Node streamy fashion.

[![build status](https://secure.travis-ci.org/alessioalex/git-diff-tree.png)](http://travis-ci.org/alessioalex/git-diff-tree)

## Usage

```js
gitDiffTree(repoPath, [options]);
```

Where options defaults to:

```js
{
  rev : 'HEAD',
  originalRev : '--root',
  // don't output data for files that have more lines changed than allowed
  MAX_DIFF_LINES_PER_FILE: 300,
  // when the diff output is bigger than the limit destroy the stream
  MAX_DIFF_SIZE: (3 * 1024 * 1024) // 3 Mb
}
```

Example:

```js
var gitDiffTree = require('git-diff-tree');
var path = require('path');
var repoPath = path.resolve(process.env.REPO || (__dirname + '/../.git'));

gitDiffTree(repoPath).on('data', function(type, data) {
  if (type === 'raw') {
    console.log('RAW DATA');
  } else if (type === 'patch') {
    console.log('PATCH DATA');
  } else if (type === 'stats') {
    console.log('FILE STATS');
  } else if (type === 'noshow') {
    console.log('Diffs not shown because files were too big');
  }
  console.log('------ \n');
  console.log(data);
  console.log('=================\n');
  // console.log(type, data);
}).on('error', function(err) {
  console.log('OH NOES!!');
  throw err;
}).on('cut', function() {
  console.log('-----------------');
  console.log('Diff to big, got cut :|');
}).on('end', function() {
  console.log('-----------------');
  console.log("That's all folks");
});
```

## Tests

```
npm test
```

## License

MIT

---
_Source: https://npm.io/package/git-diff-tree · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
