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

Move create/fork repository from models to modules/repository #9489

Merged
merged 9 commits into from
Jan 12, 2020

Conversation

lunny
Copy link
Member

@lunny lunny commented Dec 25, 2019

As title.

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Dec 25, 2019
@lunny lunny force-pushed the lunny/move_repository_create branch from 4967a27 to 7715c1a Compare December 25, 2019 15:57
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Dec 26, 2019
@6543
Copy link
Member

6543 commented Dec 28, 2019

@lunny this PR has conflicts

@6543
Copy link
Member

6543 commented Dec 28, 2019

should we add this to 1.11.0 ?

@lunny
Copy link
Member Author

lunny commented Dec 29, 2019

@6543 I will move it to 1.12.

@lunny lunny added this to the 1.12.0 milestone Dec 29, 2019
}

ctx := models.DefaultDBContext()
if err = repo.UpdateSize(ctx); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

(I know it was like this in the original, but) why is this executed outside of the creation transaction?

Copy link
Member Author

@lunny lunny Jan 11, 2020

Choose a reason for hiding this comment

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

I think this will save the repository size to database, but if it's failed, it should not block the fork. We could update the repository size on background later(currently not implemented).

log.Error("Failed to update size for repository: %v", err)
}

return repo, models.CopyLFS(ctx, repo, oldRepo)
Copy link
Member

Choose a reason for hiding this comment

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

Should this affect the size calculation of the repository?

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently all repositories' size don't include the LFS size. There should be a PR to do the work.

modules/repository/generate.go Outdated Show resolved Hide resolved
@lunny lunny force-pushed the lunny/move_repository_create branch 2 times, most recently from 9d0409a to 32759ab Compare January 11, 2020 03:56
@lunny
Copy link
Member Author

lunny commented Jan 11, 2020

@guillep2k done.

@guillep2k
Copy link
Member

Some strange fail on the CI 😓

@lunny
Copy link
Member Author

lunny commented Jan 11, 2020

@guillep2k there is a duplicated TestMain on modules/repository. I sent a commit to fix that.

@codecov-io
Copy link

codecov-io commented Jan 11, 2020

Codecov Report

Merging #9489 into master will increase coverage by 0.01%.
The diff coverage is 35.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9489      +/-   ##
==========================================
+ Coverage   42.22%   42.24%   +0.01%     
==========================================
  Files         593      597       +4     
  Lines       78207    78209       +2     
==========================================
+ Hits        33022    33037      +15     
+ Misses      41134    41124      -10     
+ Partials     4051     4048       -3
Impacted Files Coverage Δ
models/repo_generate.go 10.41% <ø> (+6.61%) ⬆️
modules/repository/repo.go 26.28% <0%> (ø) ⬆️
services/repository/generate.go 0% <0%> (ø) ⬆️
modules/repository/generate.go 0% <0%> (ø)
modules/repofiles/update.go 41.28% <0%> (ø) ⬆️
modules/migrations/gitea.go 7.96% <0%> (ø) ⬆️
services/mirror/mirror.go 18.75% <0%> (ø) ⬆️
routers/repo/issue_label.go 42.18% <0%> (ø) ⬆️
models/task.go 15.45% <100%> (-9.21%) ⬇️
services/repository/repository.go 56.25% <100%> (+8.33%) ⬆️
... and 20 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 5765212...21eefa8. Read the comment docs.

@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 Jan 11, 2020
@lunny lunny force-pushed the lunny/move_repository_create branch from 597be6d to 3d57347 Compare January 12, 2020 11:23
@lunny lunny merged commit b465d0d into go-gitea:master Jan 12, 2020
@lunny lunny deleted the lunny/move_repository_create branch January 12, 2020 12:11
@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/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.

5 participants