Skip to content

Allow force push to protected branches #28086

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

Merged
merged 48 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
50819b0
Allow force pushes to protected branches
Nov 16, 2023
f610efa
Updating label for whitelist deploy keys force push
Nov 16, 2023
9da0dc1
Update RemoveUserIDFromProtectedBranch for forcepush user/team IDs
Nov 16, 2023
7c6cd8b
Make fmt whitespace fix
Nov 16, 2023
2d2bbf2
Update strings for clarity
Nov 16, 2023
f28ecbe
Fix backend dup code lint err and generate swagger
Nov 24, 2023
fdbe77f
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Dec 14, 2023
be622e5
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Dec 19, 2023
cb057ff
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Jan 11, 2024
21cb9bc
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Jan 15, 2024
d102809
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Jan 31, 2024
5896945
Use slices.Contains instead of base.Int64sContains
Jan 31, 2024
945ea90
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Feb 2, 2024
a06a3e9
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Feb 2, 2024
9968020
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Feb 17, 2024
622e87c
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Apr 5, 2024
bf135f1
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Apr 13, 2024
11acb60
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Apr 19, 2024
a4d344c
Fix whitespace err
Apr 19, 2024
d038bc5
Make format
Apr 19, 2024
b58a3af
Remove debug log
Apr 19, 2024
dd2b74d
Fix typo in logging
Apr 19, 2024
a55d217
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman May 7, 2024
b85e559
Add initial force push tests (just git, no pr test)
May 8, 2024
d37d1c5
Fix test error, incorrect function param order
May 8, 2024
9d5b5fb
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman May 8, 2024
e7816e6
Improve force push test with explicit divergent history (otherwise gi…
May 9, 2024
7aca890
Add testcase for force pushing without normal push permission
May 9, 2024
d399196
Remove redundant locale str
May 9, 2024
812b08f
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman May 18, 2024
fe8778a
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Jun 30, 2024
9475e8c
Merge branch 'main' into allow-force-push-protected-branches
henrygoodman Jul 4, 2024
72d7c44
Rename ProtectedBranch struct fields for ids, change whitelist to all…
Jul 4, 2024
98add19
Add db migration v1.23 as v300
Jul 4, 2024
b3b3bd4
Update ProtectedBranch struct xorm tags
Jul 4, 2024
410eb59
Update migration for ProtectedBranch struct fields
Jul 5, 2024
be927f0
Update models/git/protected_branch.go
wxiaoguang Jul 5, 2024
933061a
Update models/git/protected_branch.go
wxiaoguang Jul 5, 2024
939a927
Update protected_branch.go
wxiaoguang Jul 5, 2024
8ad513c
Update protected_branch.go
wxiaoguang Jul 5, 2024
7e11c6e
Update v300.go
wxiaoguang Jul 5, 2024
9390d6f
Update v300.go
wxiaoguang Jul 5, 2024
1c81cb2
Update protected_branch.go
wxiaoguang Jul 5, 2024
79ee011
Update protected_branch.go
wxiaoguang Jul 5, 2024
a2cccd3
Remove explicit xorm column names
Jul 5, 2024
4546f15
Update v300.go
wxiaoguang Jul 5, 2024
534a1fe
Update remaining new whitelist -> allowlist refs
Jul 5, 2024
6b93981
Merge branch 'main' into allow-force-push-protected-branches
GiteaBot Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add db migration v1.23 as v300
  • Loading branch information
Henry Goodman committed Jul 4, 2024
commit 98add19a18f1a21921756a249752f33d6aff7cec
2 changes: 2 additions & 0 deletions models/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ var migrations = []Migration{

// v299 -> v300
NewMigration("Add content version to issue and comment table", v1_23.AddContentVersionToIssueAndComment),
// v300 -> v301
NewMigration("Add force-push branch protection support", v1_23.AddForcePushBranchProtection),
}

// GetCurrentDBVersion returns the current db version
Expand Down
23 changes: 23 additions & 0 deletions models/migrations/v1_23/v300.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package v1_23 //nolint

import "xorm.io/xorm"

func AddForcePushBranchProtection(x *xorm.Engine) error {
type ProtectedBranch struct {
WhitelistUserIDs []int64 `json:"whitelist_user_ids" xorm:"JSON TEXT"`
WhitelistTeamIDs []int64 `json:"whitelist_team_ids" xorm:"JSON TEXT"`
EnableForcePushAllowlist bool
ForcePushAllowlistUserIDs []int64 `json:"force_push_allowlist_user_ids" xorm:"JSON TEXT"`
ForcePushAllowlistTeamIDs []int64 `json:"force_push_allowlist_team_ids" xorm:"JSON TEXT"`
ForcePushAllowlistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
MergeWhitelistUserIDs []int64 `json:"merge_whitelist_user_ids" xorm:"JSON TEXT"`
MergeWhitelistTeamIDs []int64 `json:"merge_whitelist_team_ids" xorm:"JSON TEXT"`
ApprovalsWhitelistUserIDs []int64 `json:"approvals_whitelist_user_ids" xorm:"JSON TEXT"`
ApprovalsWhitelistTeamIDs []int64 `json:"approvals_whitelist_team_ids" xorm:"JSON TEXT"`
}

return x.Sync(new(ProtectedBranch))
}