summaryrefslogtreecommitdiffstats
path: root/routers/repo/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/pull.go')
-rw-r--r--routers/repo/pull.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index 14d2f50821..14b8670a20 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -535,6 +535,11 @@ func ViewPullFiles(ctx *context.Context) {
ctx.Data["Diff"] = diff
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
+ baseCommit, err := ctx.Repo.GitRepo.GetCommit(startCommitID)
+ if err != nil {
+ ctx.ServerError("GetCommit", err)
+ return
+ }
commit, err := gitRepo.GetCommit(endCommitID)
if err != nil {
ctx.ServerError("GetCommit", err)
@@ -542,9 +547,29 @@ func ViewPullFiles(ctx *context.Context) {
}
ctx.Data["IsImageFile"] = commit.IsImageFile
+ ctx.Data["ImageInfoBase"] = func(name string) *git.ImageMetaData {
+ result, err := baseCommit.ImageInfo(name)
+ if err != nil {
+ log.Error("ImageInfo failed: %v", err)
+ return nil
+ }
+ return result
+ }
+ ctx.Data["ImageInfo"] = func(name string) *git.ImageMetaData {
+ result, err := commit.ImageInfo(name)
+ if err != nil {
+ log.Error("ImageInfo failed: %v", err)
+ return nil
+ }
+ return result
+ }
+
+ baseTarget := path.Join(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", "commit", endCommitID)
- ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", "commit", startCommitID)
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", "commit", endCommitID)
+ ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(baseTarget, "src", "commit", startCommitID)
+ ctx.Data["BeforeRawPath"] = setting.AppSubURL + "/" + path.Join(baseTarget, "raw", "commit", startCommitID)
+
ctx.Data["RequireHighlightJS"] = true
ctx.Data["RequireTribute"] = true
if ctx.Data["Assignees"], err = ctx.Repo.Repository.GetAssignees(); err != nil {