aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-01-17 10:21:31 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-01-17 10:21:31 -1000
commit4f819768f2828788b1139b5454abf90dea4cc050 (patch)
treeb74f3a1daa55bba6667d6c8f68039fdfb9619f48 /lib/serve.js
parent464d359b34e33b2b561af2ffdfe4f6dd14178862 (diff)
downloadpatchfoo-4f819768f2828788b1139b5454abf90dea4cc050.tar.gz
patchfoo-4f819768f2828788b1139b5454abf90dea4cc050.zip
Handle git ref links where the commit is not in the message
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 145777d..2eecd09 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -1739,6 +1739,24 @@ Serve.prototype.gitCommit = 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 commit ' + rev),
+ self.respondSink(400)
+ )
+ var path = '/git/commit/' + rev
+ + '?msg=' + encodeURIComponent(msg.key)
+ return self.redirect(self.app.render.toUrl(path))
+ })
+ }
+
self.app.git.openObject({
obj: rev,
msg: self.query.msg,