forgejo/routers/api/v1/repo
Lunny Xiao 6e19484f4d
Sync branches into databases (#22743)
Related #14180
Related #25233 
Related #22639
Close #19786
Related #12763 

This PR will change all the branches retrieve method from reading git
data to read database to reduce git read operations.

- [x] Sync git branches information into database when push git data
- [x] Create a new table `Branch`, merge some columns of `DeletedBranch`
into `Branch` table and drop the table `DeletedBranch`.
- [x] Read `Branch` table when visit `code` -> `branch` page
- [x] Read `Branch` table when list branch names in `code` page dropdown
- [x] Read `Branch` table when list git ref compare page
- [x] Provide a button in admin page to manually sync all branches.
- [x] Sync branches if repository is not empty but database branches are
empty when visiting pages with branches list
- [x] Use `commit_time desc` as the default FindBranch order by to keep
consistent as before and deleted branches will be always at the end.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
2023-06-29 10:03:20 +00:00
..
blob.go
branch.go Sync branches into databases (#22743) 2023-06-29 10:03:20 +00:00
collaborators.go
commits.go
file.go Sync branches into databases (#22743) 2023-06-29 10:03:20 +00:00
fork.go Fix Permission in API returned repository struct (#25388) 2023-06-22 13:08:08 +00:00
git_hook.go
git_ref.go
hook.go Fix Permission in API returned repository struct (#25388) 2023-06-22 13:08:08 +00:00
hook_test.go Refactor web package and context package (#25298) 2023-06-18 09:59:09 +02:00
issue.go
issue_attachment.go
issue_comment.go
issue_comment_attachment.go
issue_dependency.go
issue_label.go
issue_pin.go Followup to pinned Issues (#24945) 2023-05-30 15:26:51 +00:00
issue_reaction.go
issue_stopwatch.go
issue_subscription.go
issue_tracked_time.go
key.go Fix Permission in API returned repository struct (#25388) 2023-06-22 13:08:08 +00:00
label.go
language.go
main_test.go
migrate.go Fix Permission in API returned repository struct (#25388) 2023-06-22 13:08:08 +00:00
milestone.go
mirror.go Use correct response code in push mirror creation response in v1_json.tmpl (#25476) 2023-06-28 22:00:19 +00:00
notes.go
patch.go Sync branches into databases (#22743) 2023-06-29 10:03:20 +00:00
pull.go
pull_review.go
release.go
release_attachment.go
release_tags.go
repo.go Fix Permission in API returned repository struct (#25388) 2023-06-22 13:08:08 +00:00
repo_test.go Refactor web package and context package (#25298) 2023-06-18 09:59:09 +02:00
star.go
status.go Fix Permission in API returned repository struct (#25388) 2023-06-22 13:08:08 +00:00
subscriber.go
tag.go
teams.go
topic.go
transfer.go Fix Permission in API returned repository struct (#25388) 2023-06-22 13:08:08 +00:00
tree.go
wiki.go