Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a branches_count field to Repository #19786

Open
ChenTerence opened this issue May 23, 2022 · 3 comments · Fixed by #22743
Open

Add a branches_count field to Repository #19786

ChenTerence opened this issue May 23, 2022 · 3 comments · Fixed by #22743
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@ChenTerence
Copy link

Feature Description

Currently GET /repos/{owner}/{repo}/branches is the only way to access this information. However, I am already calling GET /users/{username}/repos and would like to avoid the extra request if possible.

Screenshots

No response

@ChenTerence ChenTerence added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels May 23, 2022
@lunny
Copy link
Member

lunny commented May 23, 2022

But then Gitea needs to sync the data from git data with database which is complicated.

@ChenTerence
Copy link
Author

Thank you for your replying!

The reason I gave this recommendation is because I found it is necessary to prepare a report for the information security chief to make a review for the security audit.

And I found it takes a long time to generate a report, so that's why I gave this recommendation.

@lunny
Copy link
Member

lunny commented Jun 16, 2023

depends on #22743

@lunny lunny removed the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jun 24, 2023
lunny added a commit that referenced this issue Jun 29, 2023
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>
@lunny lunny reopened this Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants