forgejo/routers/web/repo
emilylange c1f85ce27b
feat(performance): remove BranchName in /:owner/:repo/commit/:commit
`BranchName` provides the nearest branch of the requested `:commit`.

It's plenty fast on smaller repositories.
On larger repositories like nixpkgs, however, this can easily take 2-3
seconds on a modern machine on a NVMe.

For context, at the time of writing, nixpkgs has over 650k commits and
roughly 250 branches.

`BranchName` is used once in the whole view:
The cherry-pick target branch default selection.

And I believe that's a logic error, which is why this patch is so small.

The nearest branch of a given commit will always be a branch the commit
is already part of. The branch you most likely *don't* want to
cherry-pick to.

Sure, one can technically cherry-pick a commit onto the same branch, but
that simply results in an empty commit.

I don't believe this is intended and even less so worth the compute.

Instead, the cherry-pick branch selection suggestion now always uses
the default branch, which used to be the fallback.

If a user wants to know which branches contain the given commit,
`load-branches-and-tags` exists and should be used instead.

Also, to add insult to injury, `BranchName` was calculated for both
logged-in and not logged-in users, despite its only consumer, the
cherry-pick operation, only being rendered when a given user has
write/commit permissions.

But this isn't particularly surprising, given this happens a lot in
Forgejo's codebase.
2024-08-08 22:29:42 +02:00
..
actions Clear up old Actions logs (#31735) 2024-08-04 18:24:10 +02:00
badges
flags
setting feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
activity.go
attachment.go Implement external assets 2024-07-29 20:35:55 +02:00
blame.go
branch.go Hide the "Details" link of commit status when the user cannot access actions (#30156) 2024-08-04 08:47:07 +02:00
cherry_pick.go
code_frequency.go
commit.go feat(performance): remove BranchName in /:owner/:repo/commit/:commit 2024-08-08 22:29:42 +02:00
compare.go Hide the "Details" link of commit status when the user cannot access actions (#30156) 2024-08-04 08:47:07 +02:00
contributors.go
download.go
editor.go
editor_test.go
find.go
githttp.go
githttp_test.go
helper.go
helper_test.go
issue.go Fix the display of project type for deleted projects (#31732) 2024-08-04 10:14:34 +02:00
issue_content_history.go
issue_dependency.go
issue_label.go
issue_label_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
issue_lock.go
issue_pin.go
issue_stopwatch.go
issue_test.go
issue_timetrack.go
issue_watch.go
main_test.go
middlewares.go
migrate.go feat(i18n): allow different translations of creation links and titles (#4829) 2024-08-07 16:54:05 +00:00
milestone.go
packages.go
patch.go
projects.go
projects_test.go
pull.go Hide the "Details" link of commit status when the user cannot access actions (#30156) 2024-08-04 08:47:07 +02:00
pull_review.go
pull_review_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
recent_commits.go
release.go Implement external assets 2024-07-29 20:35:55 +02:00
release_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
render.go
repo.go feat(i18n): allow different translations of creation links and titles (#4829) 2024-08-07 16:54:05 +00:00
search.go feat: highlighted code search results (#4749) 2024-08-06 05:57:25 +00:00
topic.go
treelist.go
view.go Merge pull request '[UI] Do not include trailing EOL character when counting lines' (#4835) from gusted/forgejo-num-lines into forgejo 2024-08-06 12:23:24 +00:00
view_test.go
wiki.go Fix wiki revision pagination (#31760) 2024-08-04 18:24:10 +02:00
wiki_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00