git ssb

30+

cel / git-ssb-web



Commit a7f3b74c5bb6baf2129fd4ff15bb9eaea0e7567c

Merge upstream latest

Ev Bogue committed on 7/17/2016, 11:15:16 PM
Parent: 8a06021c8e2887b1f6bcb31c9fe4a835c7d2f7b5
Parent: 0b0753593eee0bace2669f35bab7cdc182cf203a

Files changed

lib/repos/index.jschanged
package.jsonchanged
lib/repos/index.jsView
@@ -106,9 +106,9 @@
106106 return this.serveRepoCommits(req, repo, branch)
107107 case 'commit':
108108 return this.serveRepoCommit(req, repo, path[1])
109109 case 'tag':
110- return this.serveRepoTag(req, repo, branch)
110 + return this.serveRepoTag(req, repo, branch, filePath)
111111 case 'tree':
112112 return this.serveRepoTree(req, repo, branch, filePath)
113113 case 'blob':
114114 return this.serveRepoBlob(req, repo, branch, filePath)
@@ -544,25 +544,33 @@
544544 }
545545
546546 /* Repo tag */
547547
548-R.serveRepoTag = function (req, repo, rev) {
548 +R.serveRepoTag = function (req, repo, rev, path) {
549549 var self = this
550550 return u.readNext(function (cb) {
551551 repo.getTagParsed(rev, function (err, tag) {
552- if (err) return cb(err)
552 + if (err) {
553 + if (/Expected tag, got commit/.test(err.message)) {
554 + req._u.pathname = u.encodeLink([repo.id, 'commit', rev].concat(path))
555 + return cb(null, self.web.serveRedirect(req, url.format(req._u)))
556 + }
557 + return cb(null, self.web.serveError(req, err))
558 + }
559 +
553560 var title = req._t('TagName', {
554561 tag: u.escape(tag.tag)
555562 }) + ' · %{author}/%{repo}'
556563 var body = (tag.title + '\n\n' +
557564 tag.body.replace(/-----BEGIN PGP SIGNATURE-----\n[^.]*?\n-----END PGP SIGNATURE-----\s*$/, '')).trim()
565 + var date = tag.tagger.date
558566 cb(null, self.renderRepoPage(req, repo, 'tags', tag.object, title,
559567 pull.once(
560568 '<section class="collapse">' +
561569 '<h3>' + u.link([repo.id, 'tag', rev], tag.tag) + '</h3>' +
562570 req._t('TaggedOn', {
563571 name: u.escape(tag.tagger.name),
564- date: tag.tagger.date.toLocaleString(req._locale)
572 + date: date && date.toLocaleString(req._locale)
565573 }) + '<br/>' +
566574 u.link([repo.id, tag.type, tag.object]) +
567575 u.linkify(u.pre(body)) +
568576 '</section>')))
package.jsonView
@@ -1,7 +1,7 @@
11 {
22 "name": "git-ssb-web",
3- "version": "1.16.0",
3 + "version": "1.16.1",
44 "description": "web server for browsing git repos on ssb",
55 "bin": "server.js",
66 "dependencies": {
77 "asyncmemo": "^0.1.0",
@@ -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.1",
15 + "pull-git-repo": "^0.4.2",
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