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

Sync branches into databases #22743

Merged
merged 82 commits into from
Jun 29, 2023
Merged

Sync branches into databases #22743

merged 82 commits into from
Jun 29, 2023

Conversation

lunny
Copy link
Member

@lunny lunny commented Feb 4, 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.

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

silverwind pushed a commit that referenced this pull request Jun 8, 2023
Extract from #22743

`DeleteBranch` will trigger a push update event, so that
`pull_service.CloseBranchPulls` has been invoked twice and
`AddDeletedBranch` is better to be moved to push update then even user
delete a branch via git command, it will also be triggered.

Co-authored-by: Giteabot <teabot@gitea.io>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 14, 2023
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 14, 2023
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 15, 2023
@pull-request-size pull-request-size bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 15, 2023
@lunny lunny added the type/enhancement An improvement of existing functionality label Jun 15, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 29, 2023
@lunny lunny enabled auto-merge (squash) June 29, 2023 09:21
@lunny lunny merged commit 6e19484 into go-gitea:main Jun 29, 2023
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 29, 2023
lunny added a commit that referenced this pull request Jul 1, 2023
Fix #25558
Extract from #22743

This PR added a repository's check when creating/deleting branches via
API. Mirror repository and archive repository cannot do that.
techknowlogick pushed a commit that referenced this pull request Jul 1, 2023
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 2, 2023
* giteaoffical/main: (89 commits)
  Move some files under repo/setting (go-gitea#25585)
  Following-up improvments for various PRs (go-gitea#25620)
  Set SSH_AUTHORIZED_KEYS_BACKUP to false (go-gitea#25412)
  Fix bug of branches API with tests (go-gitea#25578)
  [skip ci] Updated translations via Crowdin
  Application as a maintainer (go-gitea#25614)
  Adding  branch-name copy  to clipboard branches screen. (go-gitea#25596)
  Use AfterCommitId to get commit for Viewed functionality (go-gitea#25529)
  Fix branch commit message too long problem (go-gitea#25588)
  Restrict `[actions].DEFAULT_ACTIONS_URL` to only `github` or `self` (go-gitea#25581)
  Add API for changing Avatars (go-gitea#25369)
  read-only checkboxes don't appear and don't entirely act the way one might expect (go-gitea#25573)
  Redirect to package after version deletion (go-gitea#25594)
  Update emoji set to Unicode 15 (go-gitea#25595)
  Fix `lint-swagger` action (go-gitea#25593)
  Replace fomantic divider module with our own (go-gitea#25539)
  Add documentation about supported workflow trigger events (go-gitea#25582)
  Sync branches into databases (go-gitea#22743)
  Fix milestones deletion (go-gitea#25583)
  Reduce table padding globally (go-gitea#25568)
  ...

# Conflicts:
#	templates/repo/wiki/revision.tmpl
@lunny lunny deleted the lunny/sync_branches branch July 2, 2023 13:01
silverwind pushed a commit that referenced this pull request Jul 6, 2023
Caused by #22743

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
@silverwind
Copy link
Member

Possible regression: #25909

lunny pushed a commit that referenced this pull request Jul 26, 2023
There's a typo in #22743
The correct table name is `deleted_branch` not `deleted_branches`
@lunny lunny mentioned this pull request Sep 13, 2023
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a branches_count field to Repository
6 participants