aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js12
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', {