feat: show breadcrumb path in path filtered commit history view (#12116)

Resolves forgejo/forgejo#8754

Add the breadcrumb path that already exists when browsing directories to the commit history of files/directories.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12116
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
Mauritz Sjödin
2026-05-01 01:53:10 +02:00
committed by Gusted
parent 75cfa31af5
commit 254a44b97b
7 changed files with 44 additions and 18 deletions
+12
View File
@@ -45,10 +45,19 @@ const (
func RefCommits(ctx *context.Context) {
switch {
case len(ctx.Repo.TreePath) == 0:
ctx.Data["TreeNames"] = []string{}
Commits(ctx)
case ctx.Repo.TreePath == "search":
ctx.Data["TreeNames"] = []string{}
SearchCommits(ctx)
default:
treeNames := strings.Split(ctx.Repo.TreePath, "/")
paths := make([]string, len(treeNames))
for i := range treeNames {
paths[i] = strings.Join(treeNames[:i+1], "/")
}
ctx.Data["TreeNames"] = treeNames
ctx.Data["Paths"] = paths
FileHistory(ctx)
}
}
@@ -272,6 +281,9 @@ func FileHistory(ctx *context.Context) {
}
}
branchLink := ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()
ctx.Data["BranchLink"] = branchLink
ctx.Data["Commits"] = git_model.ParseCommitsWithStatus(ctx, commits, ctx.Repo.Repository)
ctx.Data["Username"] = ctx.Repo.Owner.Name