diff options
author | Mario Lubenka <mario.lubenka@googlemail.com> | 2019-06-12 01:32:08 +0200 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2019-06-11 19:32:08 -0400 |
commit | 1608f63e396c78bcbea3605b812556ddf441a6c4 (patch) | |
tree | ea9fd908eefc3acafce94d79625243b4999258dc /routers | |
parent | 499a8a1cdd815cc25554371598140f5fb01e216f (diff) | |
download | gitea-1608f63e396c78bcbea3605b812556ddf441a6c4.tar.gz gitea-1608f63e396c78bcbea3605b812556ddf441a6c4.zip |
Fixes diff on merged pull requests (#7171)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/pull.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go index 182f715545..71c684356d 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -286,7 +286,7 @@ func PrepareMergedViewPullInfo(ctx *context.Context, issue *models.Issue) *git.C setMergeTarget(ctx, pull) ctx.Data["HasMerged"] = true - prInfo, err := ctx.Repo.GitRepo.GetCompareInfo(ctx.Repo.Repository.RepoPath(), + compareInfo, err := ctx.Repo.GitRepo.GetCompareInfo(ctx.Repo.Repository.RepoPath(), pull.MergeBase, pull.GetGitRefName()) if err != nil { @@ -301,9 +301,9 @@ func PrepareMergedViewPullInfo(ctx *context.Context, issue *models.Issue) *git.C ctx.ServerError("GetCompareInfo", err) return nil } - ctx.Data["NumCommits"] = prInfo.Commits.Len() - ctx.Data["NumFiles"] = prInfo.NumFiles - return prInfo + ctx.Data["NumCommits"] = compareInfo.Commits.Len() + ctx.Data["NumFiles"] = compareInfo.NumFiles + return compareInfo } // PrepareViewPullInfo show meta information for a pull request preview page @@ -336,7 +336,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare return nil } - prInfo, err := headGitRepo.GetCompareInfo(models.RepoPath(repo.Owner.Name, repo.Name), + compareInfo, err := headGitRepo.GetCompareInfo(models.RepoPath(repo.Owner.Name, repo.Name), pull.BaseBranch, pull.HeadBranch) if err != nil { if strings.Contains(err.Error(), "fatal: Not a valid object name") { @@ -361,9 +361,9 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare ctx.Data["ConflictedFiles"] = pull.ConflictedFiles } - ctx.Data["NumCommits"] = prInfo.Commits.Len() - ctx.Data["NumFiles"] = prInfo.NumFiles - return prInfo + ctx.Data["NumCommits"] = compareInfo.Commits.Len() + ctx.Data["NumFiles"] = compareInfo.NumFiles + return compareInfo } // ViewPullCommits show commits for a pull request |