function branchDiff (branch1, branch2, options, callback) {
if (!branch1 || !branch2) {
return callback(new Error('Must supply two branch names to compare'))
}
const repoPath = options.repoPath || process.cwd()
findMergeBase(repoPath, branch1, branch2, (err, commit) => {
if (err) { return callback(err) }
map(
[branch1, branch2], (branch, callback) => {
collect(repoPath, branch, commit, branch === branch2 && options.endRef).pipe(listStream.obj(callback))
}
, (err, branchCommits) => err ? callback(err) : diffCollected(options, branchCommits, callback)
)
})
}