@@ -256,15 +256,16 @@ func ViewPullCommits(ctx *context.Context) {
256
256
return
257
257
}
258
258
pull := issue .PullRequest
259
- ctx .Data ["Username" ] = pull .HeadUserName
260
- ctx .Data ["Reponame" ] = pull .HeadRepo .Name
261
259
262
260
var commits * list.List
263
261
if pull .HasMerged {
264
262
PrepareMergedViewPullInfo (ctx , issue )
265
263
if ctx .Written () {
266
264
return
267
265
}
266
+ ctx .Data ["Username" ] = ctx .Repo .Owner .Name
267
+ ctx .Data ["Reponame" ] = ctx .Repo .Repository .Name
268
+
268
269
startCommit , err := ctx .Repo .GitRepo .GetCommit (pull .MergeBase )
269
270
if err != nil {
270
271
ctx .Handle (500 , "Repo.GitRepo.GetCommit" , err )
@@ -280,7 +281,6 @@ func ViewPullCommits(ctx *context.Context) {
280
281
ctx .Handle (500 , "Repo.GitRepo.CommitsBetween" , err )
281
282
return
282
283
}
283
-
284
284
} else {
285
285
prInfo := PrepareViewPullInfo (ctx , issue )
286
286
if ctx .Written () {
@@ -289,6 +289,8 @@ func ViewPullCommits(ctx *context.Context) {
289
289
ctx .Handle (404 , "ViewPullCommits" , nil )
290
290
return
291
291
}
292
+ ctx .Data ["Username" ] = pull .HeadUserName
293
+ ctx .Data ["Reponame" ] = pull .HeadRepo .Name
292
294
commits = prInfo .Commits
293
295
}
294
296
@@ -319,6 +321,7 @@ func ViewPullFiles(ctx *context.Context) {
319
321
gitRepo * git.Repository
320
322
)
321
323
324
+ var headTarget string
322
325
if pull .HasMerged {
323
326
PrepareMergedViewPullInfo (ctx , issue )
324
327
if ctx .Written () {
@@ -329,6 +332,10 @@ func ViewPullFiles(ctx *context.Context) {
329
332
startCommitID = pull .MergeBase
330
333
endCommitID = pull .MergedCommitID
331
334
gitRepo = ctx .Repo .GitRepo
335
+
336
+ headTarget = path .Join (ctx .Repo .Owner .Name , ctx .Repo .Repository .Name )
337
+ ctx .Data ["Username" ] = ctx .Repo .Owner .Name
338
+ ctx .Data ["Reponame" ] = ctx .Repo .Repository .Name
332
339
} else {
333
340
prInfo := PrepareViewPullInfo (ctx , issue )
334
341
if ctx .Written () {
@@ -356,6 +363,10 @@ func ViewPullFiles(ctx *context.Context) {
356
363
startCommitID = prInfo .MergeBase
357
364
endCommitID = headCommitID
358
365
gitRepo = headGitRepo
366
+
367
+ headTarget = path .Join (pull .HeadUserName , pull .HeadRepo .Name )
368
+ ctx .Data ["Username" ] = pull .HeadUserName
369
+ ctx .Data ["Reponame" ] = pull .HeadRepo .Name
359
370
}
360
371
361
372
diff , err := models .GetDiffRange (diffRepoPath ,
@@ -374,9 +385,6 @@ func ViewPullFiles(ctx *context.Context) {
374
385
return
375
386
}
376
387
377
- headTarget := path .Join (pull .HeadUserName , pull .HeadRepo .Name )
378
- ctx .Data ["Username" ] = pull .HeadUserName
379
- ctx .Data ["Reponame" ] = pull .HeadRepo .Name
380
388
ctx .Data ["IsImageFile" ] = commit .IsImageFile
381
389
ctx .Data ["SourcePath" ] = setting .AppSubURL + "/" + path .Join (headTarget , "src" , endCommitID )
382
390
ctx .Data ["BeforeSourcePath" ] = setting .AppSubURL + "/" + path .Join (headTarget , "src" , startCommitID )
0 commit comments