diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2020-03-14 22:48:09 -0400 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2020-03-19 17:43:55 -0400 |
commit | b9dbfb3db9ee72c3b45f688786427105e2785799 (patch) | |
tree | 0ea2db37d42458597edab559d76a14b309db88dd /lib | |
parent | 4b39f0da46508c8802fdfe726721fbad62281af1 (diff) | |
download | patchfoo-b9dbfb3db9ee72c3b45f688786427105e2785799.tar.gz patchfoo-b9dbfb3db9ee72c3b45f688786427105e2785799.zip |
git: handle messsages linking to git blobs not present in that specific message
Search parent commits for the linked git object
Diffstat (limited to 'lib')
-rw-r--r-- | lib/serve.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js index 653a1e0..4089635 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -2426,6 +2426,7 @@ Serve.prototype.gitCommit = function (rev) { + '?msg=' + encodeURIComponent(msg.key)) + '&commit=' + rev + '&path=' + encodeURIComponent(file.name) + + '&search=1' }, 'created') : file.hash ? ph('a', {href: @@ -2434,6 +2435,7 @@ Serve.prototype.gitCommit = function (rev) { + '?msg=' + encodeURIComponent(msg.key)) + '&commit=' + rev + '&path=' + encodeURIComponent(file.name) + + '&search=1' }, 'changed') : file.mode ? 'mode changed' : JSON.stringify(file)) @@ -2651,6 +2653,24 @@ Serve.prototype.gitBlob = 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 blob ' + rev), + self.respondSink(400) + ) + var path = '/git/blob/' + rev + + '?msg=' + encodeURIComponent(msg.key) + return self.redirect(self.app.render.toUrl(path)) + }) + } + self.getMsgDecryptedMaybeOoo(self.query.msg, function (err, msg) { if (err) return pull( pull.once(u.renderError(err).outerHTML), |