diff options
author | Jason Song <i@wolfogre.com> | 2024-03-20 02:45:27 +0100 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-03-26 19:04:25 +0100 |
commit | 18e95af24f762cc1ad0ec23f619721422fe8e68a (patch) | |
tree | cf1280ca80063e8e8ab49415118571b2bbcee3bf /routers | |
parent | Remove jQuery `.attr` from the user search box (#29919) (diff) | |
download | forgejo-18e95af24f762cc1ad0ec23f619721422fe8e68a.tar.xz forgejo-18e95af24f762cc1ad0ec23f619721422fe8e68a.zip |
Restore deleted branches when syncing (#29898)
Regression of #29493. If a branch has been deleted, repushing it won't
restore it.
Lunny may have noticed that, but I didn't delve into the comment then
overlooked it:
https://github.com/go-gitea/gitea/pull/29493#discussion_r1509046867
The additional comments added are to explain the issue I found during
testing, which are unrelated to the fixes.
(cherry picked from commit f371f84fa3456c2a71470632b6458d81e4892a54)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/private/hook_post_receive.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/private/hook_post_receive.go b/routers/private/hook_post_receive.go index f5527cb15b..fff47caa88 100644 --- a/routers/private/hook_post_receive.go +++ b/routers/private/hook_post_receive.go @@ -75,6 +75,10 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) { updates = append(updates, option) if repo.IsEmpty && (refFullName.BranchName() == "master" || refFullName.BranchName() == "main") { // put the master/main branch first + // FIXME: It doesn't always work, since the master/main branch may not be the first batch of updates. + // If the user pushes many branches at once, the Git hook will call the internal API in batches, rather than all at once. + // See https://github.com/go-gitea/gitea/blob/cb52b17f92e2d2293f7c003649743464492bca48/cmd/hook.go#L27 + // If the user executes `git push origin --all` and pushes more than 30 branches, the master/main may not be the default branch. copy(updates[1:], updates) updates[0] = option } |