You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/routers/web/repo
Lunny Xiao 87db4a47c8
Also sync DB branches on push if necessary (#28361) (#28403)
Fix #28056
Backport #28361 

This PR will check whether the repo has zero branch when pushing a
branch. If that, it means this repository hasn't been synced.

The reason caused that is after user upgrade from v1.20 -> v1.21, he
just push branches without visit the repository user interface. Because
all repositories routers will check whether a branches sync is necessary
but push has not such check.

For every repository, it has two states, synced or not synced. If there
is zero branch for a repository, then it will be assumed as non-sync
state. Otherwise, it's synced state. So if we think it's synced, we just
need to update branch/insert new branch. Otherwise do a full sync. So
that, for every push, there will be almost no extra load added. It's
high performance than yours.

For the implementation, we in fact will try to update the branch first,
if updated success with affect records > 0, then all are done. Because
that means the branch has been in the database. If no record is
affected, that means the branch does not exist in database. So there are
two possibilities. One is this is a new branch, then we just need to
insert the record. Another is the branches haven't been synced, then we
need to sync all the branches into database.
1 year ago
..
actions Fix the runs will not be displayed bug when the main branch have no workflows but other branches have (#28359) (#28365) 1 year ago
setting Fix comment permissions (#28213) (#28216) 1 year ago
activity.go Implement FSFE REUSE for golang files (#21840) 2 years ago
attachment.go More refactoring of `db.DefaultContext` (#27083) 2 years ago
blame.go Read `previous` info from git blame (#28306) (#28310) 1 year ago
branch.go Also sync DB branches on push if necessary (#28361) (#28403) 1 year ago
cherry_pick.go Sync branches into databases (#22743) 2 years ago
commit.go More `db.DefaultContext` refactor (#27265) (#27347) 1 year ago
compare.go Replace ajax with fetch, improve image diff (#27267) (#27583) 1 year ago
download.go Less naked returns (#25713) 2 years ago
editor.go Revert "Fix EOL handling in web editor" (#28101) (#28172) 1 year ago
editor_test.go Move web/api context related testing function into a separate package (#26859) 2 years ago
find.go Implement FSFE REUSE for golang files (#21840) 2 years ago
githttp.go Fix http protocol auth (#27875) (#27876) 1 year ago
githttp_test.go Fix http protocol auth (#27875) (#27876) 1 year ago
helper.go Improve tree not found page (#26570) (#27346) 1 year ago
helper_test.go Make web context initialize correctly for different cases (#26726) 2 years ago
issue.go Fix issue will be detected as pull request when checking `First-time contributor` (#28237) (#28271) 1 year ago
issue_content_history.go Fix missing check (#28406) (#28411) 1 year ago
issue_dependency.go Add context parameter to some database functions (#26055) 2 years ago
issue_label.go Next round of `db.DefaultContext` refactor (#27089) 2 years ago
issue_label_test.go Move web/api context related testing function into a separate package (#26859) 2 years ago
issue_lock.go Use fetch form action for lock/unlock/pin/unpin on sidebar (#25380) 2 years ago
issue_pin.go Fix missing check (#28406) (#28411) 1 year ago
issue_stopwatch.go Next round of `db.DefaultContext` refactor (#27089) 2 years ago
issue_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
issue_timetrack.go Add context parameter to some database functions (#26055) 2 years ago
issue_watch.go Next round of `db.DefaultContext` refactor (#27089) 2 years ago
main_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
middlewares.go Fix viewing wiki commit on empty repo (#28040) (#28044) 1 year ago
migrate.go Next round of `db.DefaultContext` refactor (#27089) 2 years ago
milestone.go Fix `link-action` redirect network error (#27734) (#27749) 1 year ago
packages.go Fix the display of org level badges (#26504) 2 years ago
patch.go Sync branches into databases (#22743) 2 years ago
projects.go Fix comment permissions (#28213) (#28216) 1 year ago
projects_test.go Move web/api context related testing function into a separate package (#26859) 2 years ago
pull.go More `db.DefaultContext` refactor (#27265) (#27347) 1 year ago
pull_review.go More `db.DefaultContext` refactor (#27265) (#27347) 1 year ago
release.go Fix comment permissions (#28213) (#28216) 1 year ago
release_test.go Move web/api context related testing function into a separate package (#26859) 2 years ago
render.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo.go Another round of `db.DefaultContext` refactor (#27103) (#27262) 1 year ago
search.go Refactor indexer (#25174) 2 years ago
topic.go Next round of `db.DefaultContext` refactor (#27089) 2 years ago
treelist.go Implement FSFE REUSE for golang files (#21840) 2 years ago
view.go Fix object does not exist error when checking citation file (#28314) (#28369) 1 year ago
view_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
wiki.go Move notification interface to services layer (#26915) 2 years ago
wiki_test.go Move web/api context related testing function into a separate package (#26859) 2 years ago