1 | const commits = require('./commits')
|
2 | const numstat = require('./commit-numstat')
|
3 | const la = require('lazy-ass')
|
4 | const is = require('check-more-types')
|
5 | const R = require('ramda')
|
6 | const debug = require('debug')('ggit')
|
7 |
|
8 | const ids = R.map(R.prop('id'))
|
9 | const stats = R.map(numstat)
|
10 | const wait = list => Promise.all(list)
|
11 | const changes = R.map(R.prop('changes'))
|
12 | const justFiles = R.compose(R.uniq, R.flatten, R.map(R.keys))
|
13 |
|
14 |
|
15 | function changedFilesAfter (sha, branch = 'master') {
|
16 | la(is.unemptyString(sha), 'missing from SHA', sha)
|
17 | debug('changed files after %s', sha)
|
18 | debug('on branch %s', branch)
|
19 | return commits
|
20 | .after(sha, branch)
|
21 | .then(ids)
|
22 | .then(
|
23 | R.tap(list => {
|
24 | debug('commits')
|
25 | debug(list)
|
26 | })
|
27 | )
|
28 | .then(stats)
|
29 | .then(wait)
|
30 | .then(changes)
|
31 | .then(justFiles)
|
32 | }
|
33 |
|
34 | if (!module.parent) {
|
35 | changedFilesAfter('a12f55f').then(console.log).catch(console.error)
|
36 | }
|
37 |
|
38 | module.exports = changedFilesAfter
|