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

Fix forked repo has no icon and language stat. #10791

Merged
merged 24 commits into from
Apr 8, 2020
Merged

Fix forked repo has no icon and language stat. #10791

merged 24 commits into from
Apr 8, 2020

Conversation

L0veSunshine
Copy link
Contributor

Fix #10790
I'm not sure if sleep 1.5 seconds is a good method, but this method is simple enough, If the language stat indexer can't analysis code and write the result to database in 1.5 second, After you fresh the page the language stat will display.

@L0veSunshine
Copy link
Contributor Author

Another solution is copy the older repo's language statistic from data base. But is a little bit troublesome. and re-index can be more accurate.

There is an unsolved issue: the original repo and the forked repo has different size on the information bar. It has no influence, but is very strange.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 22, 2020
@codecov-io
Copy link

codecov-io commented Mar 22, 2020

Codecov Report

Merging #10791 into master will decrease coverage by 0.06%.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10791      +/-   ##
==========================================
- Coverage   43.56%   43.50%   -0.07%     
==========================================
  Files         589      597       +8     
  Lines       82674    83972    +1298     
==========================================
+ Hits        36020    36534     +514     
- Misses      42183    42921     +738     
- Partials     4471     4517      +46     
Impacted Files Coverage Δ
modules/repository/fork.go 54.68% <0.00%> (-2.69%) ⬇️
models/repo_language_stats.go 66.37% <50.00%> (-4.42%) ⬇️
routers/user/avatar.go 23.25% <0.00%> (-20.23%) ⬇️
modules/ssh/ssh_graceful.go 30.76% <0.00%> (-9.24%) ⬇️
routers/repo/issue_label.go 35.71% <0.00%> (-6.48%) ⬇️
modules/base/tool.go 59.09% <0.00%> (-5.93%) ⬇️
routers/private/hook.go 32.39% <0.00%> (-4.22%) ⬇️
modules/repofiles/delete.go 44.51% <0.00%> (-2.43%) ⬇️
routers/repo/branch.go 53.70% <0.00%> (-2.03%) ⬇️
routers/repo/editor.go 24.34% <0.00%> (-1.80%) ⬇️
... and 66 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 dcaa564...9fd6d8b. Read the comment docs.

@lunny lunny added the type/bug label Mar 22, 2020
@lunny lunny added this to the 1.12.0 milestone Mar 22, 2020
routers/repo/pull.go Outdated Show resolved Hide resolved
@lafriks
Copy link
Member

lafriks commented Mar 22, 2020

It would be better and faster just to copy stats from original repo

@L0veSunshine
Copy link
Contributor Author

It would be better and faster just to copy stats from original repo

Thanks your suggestion, I will try another way.
Because i am not familiar with the repo and language stat structure, i use the most easy method.😂
May you give me some tip why the new repo and the original one's size is a little bit different. I worry that directly copy the language stat will cause errors by these difference.

@lafriks
Copy link
Member

lafriks commented Mar 22, 2020

Size could probably be different because git mirror will not copy all refs but that just wild guess

@L0veSunshine
Copy link
Contributor Author

L0veSunshine commented Mar 22, 2020

Size could probably be different because git mirror will not copy all refs but that just wild guess

One more question, thank you very much.
I am sorry i am not familiar with xorm framework,the operation in xorm is asynchronous or synchronous?
if the operations in xorm is asynchronous, how can i confirm the copy operation has done. only if the operation had finished then redirect url the language stat will be right.

@lafriks
Copy link
Member

lafriks commented Mar 22, 2020

xorm operations are synchronous

@L0veSunshine
Copy link
Contributor Author

xorm operations are synchronous

Thanks, i will have a try.

@L0veSunshine
Copy link
Contributor Author

All the test is passing, it is ready to review.

lunny
lunny previously requested changes Mar 24, 2020
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
modules/repository/fork.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
models/repo_language_stats.go Outdated Show resolved Hide resolved
update the indexer after the loop
Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

LGTM 😅

@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 Apr 1, 2020
@6543
Copy link
Member

6543 commented Apr 1, 2020

@L0veSunshine thanks for your work

@L0veSunshine
Copy link
Contributor Author

@L0veSunshine thanks for your work

Thanks for your guidence. I am also very glad to contribute to the gitea project.

@L0veSunshine
Copy link
Contributor Author

LGTM 😅

Thanks.

if you resolve the old conversations ... https://github.com/go-gitea/gitea/pull/10791/files#r401787651

I am sorry i was newer in github😂. i had resolve it.

@6543
Copy link
Member

6543 commented Apr 2, 2020

@lunny this need your review

@lunny lunny dismissed their stale review April 6, 2020 03:03

Have no more time to review.

@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 Apr 7, 2020
@lafriks
Copy link
Member

lafriks commented Apr 8, 2020

Make lgtm work

@lafriks lafriks merged commit 08208cd into go-gitea:master Apr 8, 2020
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* Update header.tmpl

* Update _repository.less

* Update pull.go

* Update indexer.go

* Update pull.go

* Update pull.go

* Update indexer.go

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

* fix forked repo doesn't have language stat

Thanks the advice from lunny and 6543.

* fix forked repo doesn't have language stat

Modified as suggested by 6543.

* fix forked repo doesn't have language stat

simplify the function.

* fix forked repo doesn't have language stat

update the indexer after the loop

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
@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/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forked repo has no icon and language stat
7 participants