diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-09-24 19:34:51 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-09-24 19:34:51 -1000 |
commit | e9e878093f895aedaf1982f94f0f75f0fd113d77 (patch) | |
tree | 33e37eaff2af0541bf9756ebd119a8e93558bc71 /lib | |
parent | fc8772e0891532f8ed7117f9d253c59aa170a173 (diff) | |
download | patchfoo-e9e878093f895aedaf1982f94f0f75f0fd113d77.tar.gz patchfoo-e9e878093f895aedaf1982f94f0f75f0fd113d77.zip |
Link to git blob files with extensions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/serve.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/serve.js b/lib/serve.js index 259a697..951daea 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -2325,12 +2325,20 @@ Serve.prototype.gitDiff = function (revs) { var msg1Date = new Date(msg1.value.timestamp) var msg2Date = new Date(msg2.value.timestamp) var revsShort = rev1.substr(0, 8) + '..' + rev2.substr(0, 8) + var path = self.query.path && String(self.query.path) + var ext = path && path.replace(/^[^.\/]*/, '') + var blob1Url = '/git/blob/' + rev1 + + '?msg=' + encodeURIComponent(msg1.key) + + (ext ? '&ext=' + encodeURIComponent(ext) : '') + var blob2Url = '/git/blob/' + rev2 + + '?msg=' + encodeURIComponent(msg2.key) + + (ext ? '&ext=' + encodeURIComponent(ext) : '') pull( ph('section', [ ph('h3', ph('a', {href: ''}, revsShort)), ph('div', [ ph('a', { - href: self.app.render.toUrl('/git/blob/' + rev1 + '?msg=' + encodeURIComponent(msg1.key)) + href: self.app.render.toUrl(blob1Url) }, rev1), ' ', self.phIdLink(msg1.value.author), ' ', ph('a', { @@ -2340,7 +2348,7 @@ Serve.prototype.gitDiff = function (revs) { ]), ph('div', [ ph('a', { - href: self.app.render.toUrl('/git/blob/' + rev2 + '?msg=' + encodeURIComponent(msg2.key)) + href: self.app.render.toUrl(blob2Url) }, rev2), ' ', self.phIdLink(msg2.value.author), ' ', ph('a', { |