git ssb

30+

cel / git-ssb-web



Commit fbf36ab9f3e81a1c5b6e0b4c6eed51005e6e07ab

Compute diffs for new PRs using common ancestor

When comparing changes or creating a pull request, compare the head commit not
with the base commit but with a common ancestor ("merge base") of the head and
base commits. This makes for more useful diffs when the head and base are
divergent.
Charles Lehner committed on 7/25/2016, 7:35:52 PM
Parent: 09a90c8c8dd420350b85fbb6d781b88a9786512f

Files changed

lib/repos/pulls.jschanged
package.jsonchanged
lib/repos/pulls.jsView
@@ -394,16 +394,25 @@
394394 '<div class="tab-links">' +
395395 '<a href="#" id="files-link">' + req._t('FilesChanged') + '</a> ' +
396396 '<a href="#commits" id="commits-link">' +
397397 req._t('Commits') + '</a>' +
398- '</div>' +
399- '<section id="files-tab">'),
400- self.repo.renderDiffStat(req, [repo, headRepo],
401- [baseBranch, headBranch]),
402- pull.once('</section>' +
403- '<section id="commits-tab">'),
404- self.renderCommitLog(req, repo, baseBranch, headRepo, headBranch),
405- pull.once('</section>')
398+ '</div>'),
399+ u.readNext(function (cb) {
400+ GitRepo.getMergeBase(repo, baseBranch, headRepo, headBranch,
401+ function (err, concestor) {
402+ if (err) return cb(err)
403+ cb(null, cat([
404+ pull.once('<section id="files-tab">'),
405+ self.repo.renderDiffStat(req, [repo, headRepo],
406+ [concestor, headBranch]),
407+ pull.once('</section>' +
408+ '<section id="commits-tab">'),
409+ self.renderCommitLog(req, repo, concestor, headRepo, headBranch),
410+ pull.once('</section>')
411+ ]))
412+ }
413+ )
414+ })
406415 ])
407416 }
408417 }
409418
package.jsonView
@@ -11,9 +11,9 @@
1111 "multicb": "^1.2.1",
1212 "node-polyglot": "^1.0.0",
1313 "pull-cat": "^1.1.8",
1414 "pull-git-pack": "^0.2.0",
15- "pull-git-repo": "^0.4.2",
15+ "pull-git-repo": "^0.5.0",
1616 "pull-identify-filetype": "^1.1.0",
1717 "pull-many": "^1.0.6",
1818 "pull-paramap": "^1.1.6",
1919 "pull-stream": "^3.1.0",

Built with git-ssb-web