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

Refactor the fork service slightly to take ForkRepoOptions #16744

Merged
merged 5 commits into from Aug 28, 2021

Conversation

kevans91
Copy link
Contributor

This reduces the number of places we need to change if we want to add other
options during fork time.

Signed-off-by: Kyle Evans kevans@FreeBSD.org

This reduces the number of places we need to change if we want to add other
options during fork time.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
@kevans91
Copy link
Contributor Author

I guess I should have mentioned: I have some local WIP that adds an option to disallow forking of a fork, the idea being that one could setup (in a highly controlled environment) something like: org1/repo forked to user1/repo with forking disabled on the latter, then forking is disabled on the former to prevent further forks.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 19, 2021
@jolheiser
Copy link
Member

jolheiser commented Aug 19, 2021

I guess I should have mentioned: I have some local WIP that adds an option to disallow forking of a fork, the idea being that one could setup (in a highly controlled environment) something like: org1/repo forked to user1/repo with forking disabled on the latter, then forking is disabled on the former to prevent further forks.

Just to clarify, there is still nothing inherently stopping someone from cloning and simply pushing to another remote (even on the same instance).

@kevans91
Copy link
Contributor Author

kevans91 commented Aug 19, 2021

I guess I should have mentioned: I have some local WIP that adds an option to disallow forking of a fork, the idea being that one could setup (in a highly controlled environment) something like: org1/repo forked to user1/repo with forking disabled on the latter, then forking is disabled on the former to prevent further forks.

Just to clarify, there is still nothing inherently stopping someone from cloning and simply pushing to another remote.

Right, the point isn't to stop someone from cloning the repo, it's to stop them from taking up more space or providing an authoritative looking repository on "this" server. The latter forbids new repos in general, but forks are a loophole.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
@codecov-commenter
Copy link

Codecov Report

Merging #16744 (5e47dc5) into main (0393789) will decrease coverage by 0.03%.
The diff coverage is 86.20%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16744      +/-   ##
==========================================
- Coverage   45.40%   45.36%   -0.04%     
==========================================
  Files         760      760              
  Lines       85483    85491       +8     
==========================================
- Hits        38814    38784      -30     
- Misses      40389    40423      +34     
- Partials     6280     6284       +4     
Impacted Files Coverage Δ
models/repo.go 54.77% <ø> (ø)
modules/repository/fork.go 48.38% <75.00%> (ø)
routers/api/v1/repo/fork.go 26.66% <100.00%> (+7.15%) ⬆️
routers/web/repo/pull.go 30.32% <100.00%> (+0.30%) ⬆️
services/repository/repository.go 52.27% <100.00%> (ø)
modules/util/timer.go 42.85% <0.00%> (-42.86%) ⬇️
models/repo_mirror.go 58.69% <0.00%> (-10.87%) ⬇️
services/mirror/mirror.go 9.61% <0.00%> (-7.70%) ⬇️
modules/cron/tasks_basic.go 85.43% <0.00%> (-2.92%) ⬇️
modules/queue/manager.go 65.34% <0.00%> (-2.85%) ⬇️
... and 7 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 0393789...5e47dc5. Read the comment docs.

models/repo.go Outdated Show resolved Hide resolved
@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Aug 20, 2021
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
@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 Aug 28, 2021
@zeripath
Copy link
Contributor

Needs go fmt but otherwise looks good

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
@kevans91
Copy link
Contributor Author

Bah, sorry, fixed.

@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 Aug 28, 2021
@lunny lunny merged commit cad7059 into go-gitea:main Aug 28, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
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/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants