diff options
author | silverwind <me@silverwind.io> | 2022-07-15 15:01:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-15 14:01:32 +0100 |
commit | 7d20c8323a9d5d48631d7eb793dcd2d19b25f6d4 (patch) | |
tree | a27a9fd37ecde5fc7cff2a19e5a7b6c2dd0c44ab /routers/web/repo/view.go | |
parent | 4c0fce8f7b3ec185ca34e301fb67bf2d28d972d4 (diff) | |
download | gitea-7d20c8323a9d5d48631d7eb793dcd2d19b25f6d4.tar.gz gitea-7d20c8323a9d5d48631d7eb793dcd2d19b25f6d4.zip |
Fix commit status icon when in subdirectory (#20285)
When viewing a subdirectory and the latest commit to that directory in
the table, the commit status icon incorrectly showed the status of the
HEAD commit instead of the latest for that directory.
Diffstat (limited to 'routers/web/repo/view.go')
-rw-r--r-- | routers/web/repo/view.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 17169699df..6b6660f774 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -854,15 +854,15 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri } ctx.Data["LatestCommitVerification"] = verification ctx.Data["LatestCommitUser"] = user_model.ValidateCommitWithEmail(latestCommit) - } - statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, ctx.Repo.Commit.ID.String(), db.ListOptions{}) - if err != nil { - log.Error("GetLatestCommitStatus: %v", err) - } + statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, latestCommit.ID.String(), db.ListOptions{}) + if err != nil { + log.Error("GetLatestCommitStatus: %v", err) + } - ctx.Data["LatestCommitStatus"] = git_model.CalcCommitStatus(statuses) - ctx.Data["LatestCommitStatuses"] = statuses + ctx.Data["LatestCommitStatus"] = git_model.CalcCommitStatus(statuses) + ctx.Data["LatestCommitStatuses"] = statuses + } branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL() treeLink := branchLink |