Skip to content

[Enhancement] Allow admin to merge pr with protected file changes #12078

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 35 commits into from
Oct 13, 2020

Conversation

a1012112796
Copy link
Member

As tilte, show protected message in diff page and merge box.

view:
tmp1

tmp2

@techknowlogick techknowlogick added the type/enhancement An improvement of existing functionality label Jun 28, 2020
@techknowlogick techknowlogick added this to the 1.13.0 milestone Jun 28, 2020
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 28, 2020
Co-authored-by: Cirno the Strongest <[email protected]>
@lafriks
Copy link
Member

lafriks commented Jun 29, 2020

You should probably add UI text for singular and plural changed files with .TrN

@codecov-commenter
Copy link

codecov-commenter commented Aug 20, 2020

Codecov Report

Merging #12078 into master will decrease coverage by 0.05%.
The diff coverage is 25.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12078      +/-   ##
==========================================
- Coverage   42.84%   42.79%   -0.06%     
==========================================
  Files         662      663       +1     
  Lines       73002    73103     +101     
==========================================
+ Hits        31279    31281       +2     
- Misses      36652    36737      +85     
- Partials     5071     5085      +14     
Impacted Files Coverage Δ
models/migrations/migrations.go 2.46% <ø> (ø)
models/migrations/v153.go 0.00% <0.00%> (ø)
models/pull.go 54.54% <ø> (-0.63%) ⬇️
modules/repofiles/update.go 37.08% <ø> (ø)
modules/setting/repository.go 56.36% <ø> (ø)
routers/api/v1/repo/branch.go 36.85% <0.00%> (-0.58%) ⬇️
routers/repo/issue.go 36.65% <0.00%> (-0.08%) ⬇️
routers/repo/pull.go 33.21% <0.00%> (-0.33%) ⬇️
routers/repo/setting_protected_branch.go 42.69% <0.00%> (-0.74%) ⬇️
services/gitdiff/gitdiff.go 72.85% <ø> (ø)
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f404bdd...3e27c68. Read the comment docs.

protectedFilePath string
)

// Check Protected file pattern

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think it's now possible that the result of pull_service.CheckPRReadyToMerge(pr) may actually be incorrect - in that the changeProtectedFiles bit of it might be out-of-date. I think we're gonna need to drop that check from CheckPRReadyToMerge or avoid it somehow.

* move pr proteced files check to TestPatch
* Call TestPatch when protected branches settings changed
@lunny
Copy link
Member

lunny commented Sep 11, 2020

Please resolve the conflicts.

@lunny
Copy link
Member

lunny commented Sep 18, 2020

Please don't add all codes to models. I think those codes could be in services.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 21, 2020
@codecov-io
Copy link

codecov-io commented Oct 12, 2020

Codecov Report

Merging #12078 into master will decrease coverage by 0.05%.
The diff coverage is 23.20%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12078      +/-   ##
==========================================
- Coverage   42.37%   42.32%   -0.06%     
==========================================
  Files         676      677       +1     
  Lines       74531    74628      +97     
==========================================
+ Hits        31584    31585       +1     
- Misses      37814    37901      +87     
- Partials     5133     5142       +9     
Impacted Files Coverage Δ
models/migrations/migrations.go 2.44% <ø> (ø)
models/migrations/v155.go 0.00% <0.00%> (ø)
models/pull.go 54.54% <ø> (-0.63%) ⬇️
modules/repofiles/update.go 37.08% <ø> (ø)
routers/api/v1/repo/branch.go 36.85% <0.00%> (-0.58%) ⬇️
routers/api/v1/repo/pull.go 25.05% <0.00%> (ø)
routers/repo/issue.go 34.92% <0.00%> (-0.07%) ⬇️
routers/repo/pull.go 33.29% <0.00%> (-0.33%) ⬇️
routers/repo/setting_protected_branch.go 42.69% <0.00%> (-0.74%) ⬇️
services/gitdiff/gitdiff.go 74.48% <ø> (+1.63%) ⬆️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da32d0e...538317e. Read the comment docs.

Adds a lot of comments and simplifies the logic

Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
@zeripath
Copy link
Contributor

OK I think I'm done adjusting this now!

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 13, 2020
@techknowlogick techknowlogick merged commit dfa7291 into go-gitea:master Oct 13, 2020
@a1012112796 a1012112796 deleted the protected_files branch October 14, 2020 02:17
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
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. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants