summaryrefslogtreecommitdiffstats
path: root/routers/repo/commit.go
diff options
context:
space:
mode:
authorTony Tsang <tony@tcnhk.com>2015-02-06 17:02:32 +0800
committerTony Tsang <tony@tcnhk.com>2015-02-06 17:02:32 +0800
commitfc6d80d619d960b340bf1ebc7131add86985e725 (patch)
treec0456feb0ea004cc83dad3844fc927f4c3f4bcb6 /routers/repo/commit.go
parent16018e832394772591688a261646d3a80787ac9d (diff)
downloadgitea-fc6d80d619d960b340bf1ebc7131add86985e725.tar.gz
gitea-fc6d80d619d960b340bf1ebc7131add86985e725.zip
Link to previous commited source file (diff.view_file button) instead of returning 404 for deleted files.
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r--routers/repo/commit.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index e92ec8c88c..5d354c4b56 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -253,6 +253,9 @@ func Diff(ctx *middleware.Context) {
ctx.Data["Parents"] = parents
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitId)
+ if (commit.ParentCount() > 0) {
+ ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", parents[0])
+ }
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitId)
ctx.HTML(200, DIFF)
}
@@ -316,6 +319,7 @@ func CompareDiff(ctx *middleware.Context) {
ctx.Data["Diff"] = diff
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", afterCommitId)
+ ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", beforeCommitId)
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", afterCommitId)
ctx.HTML(200, DIFF)
}