aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/serve.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index f96c72a..424e9f3 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -1938,6 +1938,7 @@ Serve.prototype.gitCommit = function (rev) {
self.app.git.openObject({
obj: rev,
msg: self.query.msg,
+ type: 'commit',
}, function (err, obj) {
if (err && err.name === 'BlobNotFoundError')
return self.askWantBlobs(err.links)
@@ -2049,9 +2050,28 @@ Serve.prototype.gitTag = function (rev) {
self.respondSink(400)
)
+ if (self.query.search) {
+ return self.app.git.getObjectMsg({
+ obj: rev,
+ headMsgId: self.query.msg,
+ }, function (err, msg) {
+ if (err && err.name === 'BlobNotFoundError')
+ return self.askWantBlobs(err.links)
+ if (err) return pull(
+ pull.once(u.renderError(err).outerHTML),
+ self.wrapPage('git tag ' + rev),
+ self.respondSink(400)
+ )
+ var path = '/git/tag/' + rev
+ + '?msg=' + encodeURIComponent(msg.key)
+ return self.redirect(self.app.render.toUrl(path))
+ })
+ }
+
self.app.git.openObject({
obj: rev,
msg: self.query.msg,
+ type: 'tag',
}, function (err, obj) {
if (err && err.name === 'BlobNotFoundError')
return self.askWantBlobs(err.links)
@@ -2060,8 +2080,14 @@ Serve.prototype.gitTag = function (rev) {
self.wrapPage('git tag ' + rev),
self.respondSink(400)
)
+
var msgDate = new Date(obj.msg.value.timestamp)
self.app.git.getTag(obj, function (err, tag) {
+ if (err && err.message === 'expected type \'tag\' but found \'commit\'') {
+ var path = '/git/commit/' + rev
+ + '?msg=' + encodeURIComponent(self.query.msg)
+ return self.redirect(self.app.render.toUrl(path))
+ }
var missingBlobs
if (err && err.name === 'BlobNotFoundError')
missingBlobs = err.links, err = null